]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: clear tzname[] after timezone is changed
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 3 Mar 2023 03:07:25 +0000 (12:07 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 3 Mar 2023 10:45:32 +0000 (19:45 +0900)
Fixes the issue reported in fe56f21ae3943e79ce9faeb40b79c7093c50e644.

src/test/test-time-util.c

index cd4d635dfaba4dd6e72934ad8a9729f394ff7152..cec5bffd79ac64acce8b020ceec46bcb150075df 100644 (file)
@@ -707,6 +707,7 @@ TEST(parse_timestamp) {
                 test_parse_timestamp_one("70-01-01 09:00:01.0010 JST", 0, USEC_PER_SEC + 1000);
 
                 assert_se(set_unset_env("TZ", saved_tz, true) == 0);
+                tzset();
         }
 
         if (timezone_is_valid("America/New_York", LOG_DEBUG)) {
@@ -756,6 +757,7 @@ TEST(parse_timestamp) {
                 test_parse_timestamp_one("69-12-31 19:00:01.0010 EST", 0, USEC_PER_SEC + 1000);
 
                 assert_se(set_unset_env("TZ", saved_tz, true) == 0);
+                tzset();
         }
 
         /* -06 */
@@ -823,13 +825,12 @@ TEST(parse_timestamp) {
 
         /* without date */
         assert_se(parse_timestamp("today", &today) == 0);
-        // FIXME: currently failing, needs to investigate the changes from https://github.com/systemd/systemd/pull/26409
-        /*test_parse_timestamp_one("00:01", 0, today + USEC_PER_MINUTE);
+        test_parse_timestamp_one("00:01", 0, today + USEC_PER_MINUTE);
         test_parse_timestamp_one("00:00:01", 0, today + USEC_PER_SEC);
         test_parse_timestamp_one("00:00:01.001", 0, today + USEC_PER_SEC + 1000);
         test_parse_timestamp_one("00:00:01.0010", 0, today + USEC_PER_SEC + 1000);
         test_parse_timestamp_one("tomorrow", 0, today + USEC_PER_DAY);
-        test_parse_timestamp_one("yesterday", 0, today - USEC_PER_DAY);*/
+        test_parse_timestamp_one("yesterday", 0, today - USEC_PER_DAY);
 
         /* relative */
         assert_se(parse_timestamp("now", &now_usec) == 0);