Skip to content

Commit

Permalink
add logging to TestConfigurationMgr
Browse files Browse the repository at this point in the history
  • Loading branch information
msandstedt committed Jun 6, 2022
1 parent 5dab205 commit aa89c3d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/platform/tests/TestConfigurationMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ static void TestConfigurationMgr_FirmwareBuildTime(nlTestSuite * inSuite, void *
System::Clock::Seconds32 chipEpochTime;
NL_TEST_ASSERT(inSuite, ConfigurationMgr().GetFirmwareBuildChipEpochTime(chipEpochTime) == CHIP_NO_ERROR);

ChipLogProgress(TimeService, "Configuration Manager reported CHIP epoch build time: %" PRIu32, chipEpochTime.count());

char date[14]; // strlen("Jan 000 00000") == 13
char timeOfDay[12]; // strlen("000:000:000") == 11

Expand All @@ -249,13 +251,17 @@ static void TestConfigurationMgr_FirmwareBuildTime(nlTestSuite * inSuite, void *
NL_TEST_ASSERT(inSuite, printed > 0 && printed < static_cast<int>(sizeof(timeOfDay)));
}

ChipLogProgress(TimeService, "Recomputation to build date / time: %s %s", date, timeOfDay);

// Read the hard-coded build date / time strings that the configuration
// manager used to compute firmware build CHIP epoch time.
const char * expectedDate;
const char * expectedTimeOfDay;
NL_TEST_ASSERT(inSuite, ConfigurationMgr().GetHardCodedFirmwareBuildDate(&expectedDate) == CHIP_NO_ERROR);
NL_TEST_ASSERT(inSuite, ConfigurationMgr().GetHardCodedFirmwareBuildTimeOfDay(&expectedTimeOfDay) == CHIP_NO_ERROR);

ChipLogProgress(TimeService, "Expected date / time: %s %s", expectedDate, expectedTimeOfDay);

// Compare the strings. If they are identical, this means the configuration
// manager's parser for the __DATE__ / __TIME__ strings worked for the
// current build time.
Expand Down

0 comments on commit aa89c3d

Please sign in to comment.