proc-cmdline: introduce PROC_CMDLINE_TRUE_WHEN_MISSING

This commit is contained in:
Mike Yuan
2023-08-13 12:52:15 +08:00
parent f7590e3cb4
commit 97d5f09bd2
3 changed files with 13 additions and 8 deletions
+1
View File
@@ -180,6 +180,7 @@ TEST(proc_cmdline_get_bool) {
assert_se(proc_cmdline_get_bool("", /* flags = */ 0, &value) == -EINVAL);
assert_se(proc_cmdline_get_bool("abc", /* flags = */ 0, &value) == 0 && value == false);
assert_se(proc_cmdline_get_bool("unspecified", PROC_CMDLINE_TRUE_WHEN_MISSING, &value) == 0 && value == true);
assert_se(proc_cmdline_get_bool("foo_bar", /* flags = */ 0, &value) > 0 && value == true);
assert_se(proc_cmdline_get_bool("foo-bar", /* flags = */ 0, &value) > 0 && value == true);
assert_se(proc_cmdline_get_bool("bar-waldo", /* flags = */ 0, &value) > 0 && value == true);