test-time-util: ignore failure on MSK timezone

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
```
This commit is contained in:
Yu Watanabe
2026-01-05 17:48:36 +09:00
parent f056560da7
commit 47d70d3a1b
+9 -4
View 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;