summaryrefslogtreecommitdiffstats
path: root/src/test/test-proc-cmdline.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-03-22 19:06:16 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-03-24 07:20:05 +0100
commit1479799c4dc0c9cb18508fa784ea218c27f3bcc9 (patch)
tree9cff083ea8673fafcaac4250a56f4b2c7da47136 /src/test/test-proc-cmdline.c
parentproc-cmdline: rename variable (diff)
downloadsystemd-1479799c4dc0c9cb18508fa784ea218c27f3bcc9.tar.xz
systemd-1479799c4dc0c9cb18508fa784ea218c27f3bcc9.zip
proc-cmdline: use proc_cmdline_key_string() when we search for key
Diffstat (limited to 'src/test/test-proc-cmdline.c')
-rw-r--r--src/test/test-proc-cmdline.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/test/test-proc-cmdline.c b/src/test/test-proc-cmdline.c
index 1d54066ae6..b576c46c23 100644
--- a/src/test/test-proc-cmdline.c
+++ b/src/test/test-proc-cmdline.c
@@ -109,7 +109,7 @@ TEST(test_proc_cmdline_given) {
TEST(proc_cmdline_get_key) {
_cleanup_free_ char *value = NULL;
- assert_se(putenv((char*) "SYSTEMD_PROC_CMDLINE=foo_bar=quux wuff-piep=tuet zumm spaaace='ö ü ß' ticks=\"''\"\n\nkkk=uuu\n\n\n") == 0);
+ assert_se(putenv((char*) "SYSTEMD_PROC_CMDLINE=foo_bar=quux wuff-piep=tuet zumm-ghh spaaace='ö ü ß' ticks=\"''\"\n\nkkk=uuu\n\n\n") == 0);
assert_se(proc_cmdline_get_key("", 0, &value) == -EINVAL);
assert_se(proc_cmdline_get_key("abc", 0, NULL) == 0);
@@ -120,6 +120,7 @@ TEST(proc_cmdline_get_key) {
value = mfree(value);
assert_se(proc_cmdline_get_key("foo_bar", PROC_CMDLINE_VALUE_OPTIONAL, &value) > 0 && streq_ptr(value, "quux"));
value = mfree(value);
+ assert_se(proc_cmdline_get_key("foo_bar", 0, NULL) == 0);
assert_se(proc_cmdline_get_key("foo-bar", 0, &value) > 0 && streq_ptr(value, "quux"));
value = mfree(value);
assert_se(proc_cmdline_get_key("foo-bar", PROC_CMDLINE_VALUE_OPTIONAL, &value) > 0 && streq_ptr(value, "quux"));
@@ -138,9 +139,12 @@ TEST(proc_cmdline_get_key) {
assert_se(proc_cmdline_get_key("wuff_piep", 0, NULL) == 0);
assert_se(proc_cmdline_get_key("wuff_piep", PROC_CMDLINE_VALUE_OPTIONAL, NULL) == -EINVAL);
- assert_se(proc_cmdline_get_key("zumm", 0, &value) == 0 && value == NULL);
- assert_se(proc_cmdline_get_key("zumm", PROC_CMDLINE_VALUE_OPTIONAL, &value) > 0 && value == NULL);
- assert_se(proc_cmdline_get_key("zumm", 0, NULL) > 0);
+ assert_se(proc_cmdline_get_key("zumm-ghh", 0, &value) == 0 && value == NULL);
+ assert_se(proc_cmdline_get_key("zumm-ghh", PROC_CMDLINE_VALUE_OPTIONAL, &value) > 0 && value == NULL);
+ assert_se(proc_cmdline_get_key("zumm-ghh", 0, NULL) > 0);
+ assert_se(proc_cmdline_get_key("zumm_ghh", 0, &value) == 0 && value == NULL);
+ assert_se(proc_cmdline_get_key("zumm_ghh", PROC_CMDLINE_VALUE_OPTIONAL, &value) > 0 && value == NULL);
+ assert_se(proc_cmdline_get_key("zumm_ghh", 0, NULL) > 0);
assert_se(proc_cmdline_get_key("spaaace", 0, &value) > 0 && streq_ptr(value, "ö ü ß"));
value = mfree(value);