]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-time-util: ignore failure on MSK timezone
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 5 Jan 2026 07:01:34 +0000 (16:01 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 5 Jan 2026 08:48:36 +0000 (17:48 +0900)
Ignore the following failures:
- with glibc
```
TZ=Europe/Volgograd, tzname[0]=MSK, tzname[1]=MSD
@1414277092997572 → Sun 2014-10-26 01:44:52 MSK → @1414273492000000 → Sun 2014-10-26 01:44:52 MSK
src/test/test-time-util.c:448: Assertion failed: Expected "ignore" to be true
```
- with musl
```
TZ=Europe/Kirov, tzname[0]=MSK, tzname[1]=MSK
@1414277092997572 → Sun 2014-10-26 01:44:52 MSK → @1414273492000000 → Sun 2014-10-26 01:44:52 MSK
src/test/test-time-util.c:448: Assertion failed: Expected "ignore" to be true
```

src/test/test-time-util.c

index c56282781d2b981d102f221ba58dbf8ed023d0b8..d5d4992f827b440ed81eef47f1d4c50767e42ca9 100644 (file)
@@ -433,11 +433,13 @@ static void test_format_timestamp_impl(usec_t x) {
         if (x_sec == y_sec && streq(xx, yy))
                 return; /* Yay! */
 
-        /* When the timezone is built with rearguard being enabled (e.g. old Ubuntu and RHEL), the following
-         * timezone may provide time shifted 1 hour from the original. See
-         * https://github.com/systemd/systemd/issues/28472 and https://github.com/systemd/systemd/pull/35471 */
+        /* When the timezone is built with rearguard being enabled (e.g. old Ubuntu and RHEL), the timezone
+         * Africa/Windhoek may provide time shifted 1 hour from the original. See
+         * https://github.com/systemd/systemd/issues/28472 and https://github.com/systemd/systemd/pull/35471.
+         * Also, the same may happen on MSK timezone (e.g. Europe/Volgograd or Europe/Kirov). */
         bool ignore =
-                streq_ptr(getenv("TZ"), "Africa/Windhoek") &&
+                (streq_ptr(getenv("TZ"), "Africa/Windhoek") ||
+                 streq_ptr(get_tzname(/* dst= */ false), "MSK")) &&
                 (x_sec > y_sec ? x_sec - y_sec : y_sec - x_sec) == 3600;
 
         log_full(ignore ? LOG_WARNING : LOG_ERR,
@@ -459,6 +461,9 @@ static void test_format_timestamp_loop(void) {
         test_format_timestamp_impl(1504938962980066);
         test_format_timestamp_impl(1509482094632752);
 
+        /* With tzdata-2025c, the timestamp (randomly?) fails on MSK time zone (e.g. Europe/Volgograd). */
+        test_format_timestamp_impl(1414277092997572);
+
         for (unsigned i = 0; i < TRIAL; i++) {
                 usec_t x;