]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: don't go through all time zones if slow tests are disabled
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 28 Mar 2023 10:36:23 +0000 (12:36 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 28 Mar 2023 17:16:38 +0000 (18:16 +0100)
Let's skip going through all locally available time zones if we're built
with slow tests disabled, as that's quite slow, but do at least one test
with the UTC zone.

src/test/test-time-util.c

index a7b24674528a7e325005bcb60236679f912e654e..42701618048765e6a65760085cfc88d5960556dc 100644 (file)
@@ -448,6 +448,11 @@ static void test_format_timestamp_with_tz_one(const char *tz) {
 TEST(FORMAT_TIMESTAMP_with_tz) {
         _cleanup_strv_free_ char **timezones = NULL;
 
+        test_format_timestamp_with_tz_one("UTC");
+
+        if (!slow_tests_enabled())
+                return (void) log_tests_skipped("slow tests are disabled");
+
         assert_se(get_timezones(&timezones) >= 0);
         STRV_FOREACH(tz, timezones)
                 test_format_timestamp_with_tz_one(*tz);
@@ -896,6 +901,11 @@ static void test_parse_timestamp_with_tz_one(const char *tz) {
 TEST(parse_timestamp_with_tz) {
         _cleanup_strv_free_ char **timezones = NULL;
 
+        test_parse_timestamp_with_tz_one("UTC");
+
+        if (!slow_tests_enabled())
+                return (void) log_tests_skipped("slow tests are disabled");
+
         assert_se(get_timezones(&timezones) >= 0);
         STRV_FOREACH(tz, timezones)
                 test_parse_timestamp_with_tz_one(*tz);