mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
Merge pull request #31095 from bluca/test_time_tz
test: unset TZ before timezone-sensitive unit tests are run
This commit is contained in:
commit
20eeec72ed
3
.github/workflows/unit_tests.sh
vendored
3
.github/workflows/unit_tests.sh
vendored
@ -73,7 +73,8 @@ for phase in "${PHASES[@]}"; do
|
||||
MESON_ARGS+=(--fatal-meson-warnings)
|
||||
run_meson -Dnobody-group=nogroup --werror -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true "${MESON_ARGS[@]}" build
|
||||
ninja -C build -v
|
||||
meson test -C build --print-errorlogs
|
||||
# Ensure setting a timezone (like the reproducible build tests do) does not break time/date unit tests
|
||||
TZ=GMT+12 meson test -C build --print-errorlogs
|
||||
;;
|
||||
RUN_ASAN_UBSAN|RUN_GCC_ASAN_UBSAN|RUN_CLANG_ASAN_UBSAN|RUN_CLANG_ASAN_UBSAN_NO_DEPS)
|
||||
MESON_ARGS=(--optimization=1)
|
||||
|
@ -254,4 +254,11 @@ TEST(calendar_spec_from_string) {
|
||||
assert_se(calendar_spec_from_string("*:4,30:*\n", &c) == -EINVAL);
|
||||
}
|
||||
|
||||
DEFINE_TEST_MAIN(LOG_INFO);
|
||||
static int intro(void) {
|
||||
/* Tests have hard-coded results that do not expect a specific timezone to be set by the caller */
|
||||
assert_se(unsetenv("TZ") >= 0);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
DEFINE_TEST_MAIN_WITH_INTRO(LOG_INFO, intro);
|
||||
|
@ -62,6 +62,9 @@ static void test_one_noutc(const char *p) {
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
/* Tests have hard-coded results that do not expect a specific timezone to be set by the caller */
|
||||
assert_se(unsetenv("TZ") >= 0);
|
||||
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
test_one("17:41");
|
||||
|
@ -1171,6 +1171,9 @@ TEST(timezone_offset_change) {
|
||||
}
|
||||
|
||||
static int intro(void) {
|
||||
/* Tests have hard-coded results that do not expect a specific timezone to be set by the caller */
|
||||
assert_se(unsetenv("TZ") >= 0);
|
||||
|
||||
log_info("realtime=" USEC_FMT "\n"
|
||||
"monotonic=" USEC_FMT "\n"
|
||||
"boottime=" USEC_FMT "\n",
|
||||
|
Loading…
Reference in New Issue
Block a user