From: Mike Yuan Date: Mon, 13 Mar 2023 23:16:18 +0000 (+0800) Subject: test-time-util: add test cases to invalidate "show" and "cancel" X-Git-Tag: v254-rc1~1028^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=165655cb1de2e79d954d9165459143140e52c53b;p=thirdparty%2Fsystemd.git test-time-util: add test cases to invalidate "show" and "cancel" Ensure that systemctl reboot --when=show and --when=cancel will not result in ambiguities --- diff --git a/src/test/test-time-util.c b/src/test/test-time-util.c index e0386d4ec58..a7b24674528 100644 --- a/src/test/test-time-util.c +++ b/src/test/test-time-util.c @@ -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);