]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-time-util: add test cases to invalidate "show" and "cancel" 26683/head
authorMike Yuan <me@yhndnzj.com>
Mon, 13 Mar 2023 23:16:18 +0000 (07:16 +0800)
committerMike Yuan <me@yhndnzj.com>
Tue, 14 Mar 2023 11:21:11 +0000 (19:21 +0800)
Ensure that systemctl reboot --when=show and --when=cancel will not result in ambiguities

src/test/test-time-util.c

index e0386d4ec585b5ae8a12f209066d033a252da5b1..a7b24674528a7e325005bcb60236679f912e654e 100644 (file)
@@ -663,6 +663,11 @@ static bool timezone_equal(usec_t today, usec_t target) {
 static void test_parse_timestamp_impl(const char *tz) {
         usec_t today, now_usec;
 
+        /* Invalid: Ensure that systemctl reboot --when=show and --when=cancel
+         * will not result in ambiguities */
+        assert_se(parse_timestamp("show", NULL) == -EINVAL);
+        assert_se(parse_timestamp("cancel", NULL) == -EINVAL);
+
         /* UTC */
         test_parse_timestamp_one("Thu 1970-01-01 00:01 UTC", 0, USEC_PER_MINUTE);
         test_parse_timestamp_one("Thu 1970-01-01 00:00:01 UTC", 0, USEC_PER_SEC);