1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-04 05:17:43 +03:00

test: unset TZ before timezone-sensitive unit tests are run

Some tests have hard-coded results that need to match, and change if
the caller has a timezone set via the TZ= environment variable, as it
is the case during reproducible build tests. Unset it.

(cherry picked from commit 1e902c3463)
(cherry picked from commit 85c88db9c6)
(cherry picked from commit d7fa5b8acb)
(cherry picked from commit 4d6d1a9f05)
(cherry picked from commit d91a1c0f2c)
This commit is contained in:
Luca Boccassi 2024-01-26 00:22:38 +00:00
parent 99d69cd5e0
commit 5a5135440d
3 changed files with 9 additions and 0 deletions

View File

@ -121,6 +121,9 @@ static void test_hourly_bug_4031(void) {
int main(int argc, char* argv[]) {
CalendarSpec *c;
/* Tests have hard-coded results that do not expect a specific timezone to be set by the caller */
assert_se(unsetenv("TZ") >= 0);
test_one("Sat,Thu,Mon-Wed,Sat-Sun", "Mon..Thu,Sat,Sun *-*-* 00:00:00");
test_one("Sat,Thu,Mon..Wed,Sat..Sun", "Mon..Thu,Sat,Sun *-*-* 00:00:00");
test_one("Mon,Sun 12-*-* 2,1:23", "Mon,Sun 2012-*-* 01,02:23:00");

View File

@ -65,6 +65,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");

View File

@ -599,6 +599,9 @@ static void test_map_clock_usec(void) {
int main(int argc, char *argv[]) {
test_setup_logging(LOG_INFO);
/* 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",