Skip to content

Updates for Svc/PrmDb corresponding to UT cmake update for protected/private (#3446)#3772

Merged
LeStarch merged 2 commits intonasa:develfrom
m-aleem:devel-3446-aa
Jun 25, 2025
Merged

Updates for Svc/PrmDb corresponding to UT cmake update for protected/private (#3446)#3772
LeStarch merged 2 commits intonasa:develfrom
m-aleem:devel-3446-aa

Conversation

@m-aleem
Copy link
Contributor

@m-aleem m-aleem commented Jun 20, 2025

Related Issue(s) #3446
Has Unit Tests (y/n) Yes - Existing
Documentation Included (y/n) N/A

Change Description

I locally updated fprime/cmake/settings.cmake to change -DPROTECTED=protected -DPRIVATE=private. This causes additional build errors beyond all our updates in manual code for PRIVATE->private and PROTECTED->protected due to auto-coded files which use PRIVATE, PROTECTED. This set of changes is associated with fixing Svc/PrmDb so that the UTs in this directory can build and pass.

Approach in this case was:

  1. mv PrmDbTester.cpp PrmDbTestMain.cpp
  2. mv PrmDbImplTester.hpp PrmDbTester.hpp
  3. mv PrmDbImplTester.cpp PrmDbTester.cpp
  4. In UTs, change PrmDbImplTester to PrmDbTester where applicable
  5. Make class PrmDbTester a friend of PrmDbImpl

Rationale

#3446

Future Work

  1. Note that this PR does not include the update to fprime/cmake/settings.cmake itself - this will be done at the end
  2. Note that this PR does not include re-naming the flight code <X>Impl to <X> (separate issue)


class PrmDbTester : public PrmDbGTestBase {
public:
PrmDbTester(Svc::PrmDbImpl& inst);

Check warning

Code scanning / CppCheck

Single-parameter constructors should be marked explicit. Warning test

Single-parameter constructors should be marked explicit.
@m-aleem m-aleem marked this pull request as ready for review June 21, 2025 00:03
@m-aleem
Copy link
Contributor Author

m-aleem commented Jun 21, 2025

@LeStarch From my initial poking, the updates to use UT_AUTO_HELPERS seems like it would require enough further re-work of the existing Testers that I think it would be worth making that its own issue/task.

* requiring additional friendship declarations. It leverages the existing
* friendship between PrmDbImpl and PrmDbImplTester.
*/
class PrmDbImplTester {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't I expecting this to be renamed PrmDbTester? Or did I misunderstand?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this may be entirely unused. Perhaps we can remove?

Copy link
Contributor Author

@m-aleem m-aleem Jun 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have both PrmDbTester and PrmDbImplTester. (And what used to be PrmDbTester.cpp is now the TestMain file.)

  • PrmDbTester is a friend of PrmDbComponentBase
    • We use PrmDbTester to call doDispatch which is declared private in PrmDbComponentBase (in PrmDbComponentAc.hpp) by doing this->m_impl.doDispatch() from PrmDbTester
  • PrmDbImplTester is a friend of PrmDbImpl.
    • We use PrmDbImplTester to call clearDb which is declared private in PrmDbImpl (here) by doing this->m_implTester.clearDb() from PrmDbTester.
    • We will get errors if trying to do this->m_impl.clearDb()

@m-aleem m-aleem marked this pull request as draft June 23, 2025 23:20
@m-aleem
Copy link
Contributor Author

m-aleem commented Jun 23, 2025

I am going to move this back to draft to fix the naming inconsistencies. Will try to discuss with CogE on desired name and file pattern going forward.

@m-aleem m-aleem changed the title Updates for Svc/PrmDb corresponding to UT cmake udpate for protected/private (#3446) Updates for Svc/PrmDb corresponding to UT cmake update for protected/private (#3446) Jun 24, 2025
…private by updating driver name and updating PrmDbImplTester to PrmDbTester
@m-aleem m-aleem closed this Jun 24, 2025
@m-aleem m-aleem reopened this Jun 24, 2025
@m-aleem m-aleem marked this pull request as ready for review June 24, 2025 18:17
@m-aleem m-aleem requested a review from LeStarch June 24, 2025 18:21
@LeStarch LeStarch merged commit d399ccb into nasa:devel Jun 25, 2025
50 checks passed
@m-aleem m-aleem deleted the devel-3446-aa branch June 25, 2025 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants