Skip to content

Commit 732c3e5

Browse files
committed
tests: Fix a/z/c/z/test/zwave_command_class_time_parameters_test on UTC #46
This test was previously bypassed, it is now working as expected. The reason it was failing is because mktime use timezone to set the tm structure that will be returned to the next step of step. Setting timezone to UTC (+0) solves the problem Bug-SiliconLabsSoftware: #46 Origin: #69 Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
1 parent e786117 commit 732c3e5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

applications/zpc/components/zwave_command_classes/test/CMakeLists.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ target_add_unittest(
5454
zwave_command_class_time_parameters_test.c
5555
DEPENDS
5656
zwave_command_class_test_helpers
57-
${MOCK_LIBS})
58-
if(${BUILD_TESTING_PROPERTY_DISABLED})
57+
${MOCK_LIBS}
58+
)
59+
if(${ZPC_BUILD_TESTING_PROPERTY_DISABLED})
60+
message(WARNING "Please fix this test")
5961
set_tests_properties(zwave_command_class_time_parameters_test
6062
PROPERTIES DISABLED True)
6163
endif()

applications/zpc/components/zwave_command_classes/test/zwave_command_class_time_parameters_test.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*
1212
*****************************************************************************/
1313

14+
#include <stdlib.h>
1415
#include <time.h>
1516
#include <sys/time.h>
1617
#include <string.h>
@@ -48,7 +49,9 @@ struct tm test_time_info = {.tm_year = TEST_YEAR - 1900,
4849
.tm_isdst = -1};
4950

5051
/// Setup the test suite (called once before all test_xxx functions are called)
51-
void suiteSetUp() {}
52+
void suiteSetUp() {
53+
setenv("TZ", "UTC", 1);
54+
}
5255

5356
/// Teardown the test suite (called once after all test_xxx functions are called)
5457
int suiteTearDown(int num_failures)

0 commit comments

Comments
 (0)