summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorIvan Shapovalov <intelfx@intelfx.name>2016-06-13 18:28:42 +0400
committerLennart Poettering <lennart@poettering.net>2016-06-13 16:28:42 +0200
commitdcd61450026c281c916f12c2affa220e0994ba19 (patch)
treec860dab75fc7750b38c4752c87dfd19f82a48b47 /src/test
parent68884a0b8a29ce8a7c2a2671b84e2c7b9c6cb674 (diff)
core: parse `rd.rescue` and `rd.emergency` as initrd-specific shorthands (#3488)
Typing `rd.rescue` is easier than `rd.systemd.unit=rescue.target`.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-proc-cmdline.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/test-proc-cmdline.c b/src/test/test-proc-cmdline.c
index a7a8f621a2..80ad5ed98b 100644
--- a/src/test/test-proc-cmdline.c
+++ b/src/test/test-proc-cmdline.c
@@ -23,6 +23,7 @@
#include "proc-cmdline.h"
#include "special.h"
#include "string-util.h"
+#include "util.h"
static int parse_item(const char *key, const char *value) {
assert_se(key);
@@ -36,9 +37,19 @@ static void test_parse_proc_cmdline(void) {
}
static void test_runlevel_to_target(void) {
+ in_initrd_force(false);
assert_se(streq_ptr(runlevel_to_target(NULL), NULL));
assert_se(streq_ptr(runlevel_to_target("unknown-runlevel"), NULL));
+ assert_se(streq_ptr(runlevel_to_target("rd.unknown-runlevel"), NULL));
assert_se(streq_ptr(runlevel_to_target("3"), SPECIAL_MULTI_USER_TARGET));
+ assert_se(streq_ptr(runlevel_to_target("rd.rescue"), NULL));
+
+ in_initrd_force(true);
+ assert_se(streq_ptr(runlevel_to_target(NULL), NULL));
+ assert_se(streq_ptr(runlevel_to_target("unknown-runlevel"), NULL));
+ assert_se(streq_ptr(runlevel_to_target("rd.unknown-runlevel"), NULL));
+ assert_se(streq_ptr(runlevel_to_target("3"), NULL));
+ assert_se(streq_ptr(runlevel_to_target("rd.rescue"), SPECIAL_RESCUE_TARGET));
}
int main(void) {