]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add tests for StandardInputText= and StandardInputData=
authorLennart Poettering <lennart@poettering.net>
Fri, 27 Oct 2017 09:38:59 +0000 (11:38 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 17 Nov 2017 10:13:44 +0000 (11:13 +0100)
src/test/test-execute.c
test/meson.build
test/test-execute/exec-stdin-data.service [new file with mode: 0644]

index 998724189f71551da04890afb6bcf99514c3576c..34a93fb3eb580c66027232cdf58f06ececd03a3c 100644 (file)
@@ -478,6 +478,10 @@ static void test_exec_specifier(Manager *m) {
         test(m, "exec-specifier.service", 0, CLD_EXITED);
 }
 
+static void test_exec_stdin_data(Manager *m) {
+        test(m, "exec-stdin-data.service", 0, CLD_EXITED);
+}
+
 static int run_tests(UnitFileScope scope, const test_function_t *tests) {
         const test_function_t *test = NULL;
         Manager *m = NULL;
@@ -534,6 +538,7 @@ int main(int argc, char *argv[]) {
                 test_exec_spec_interpolation,
                 test_exec_read_only_path_suceed,
                 test_exec_unset_environment,
+                test_exec_stdin_data,
                 NULL,
         };
         static const test_function_t system_tests[] = {
index 69d6c758b0adb0528532cc363868a316cf262544..c5e45f195887fa8a99376e45f6ad8676df951c3d 100644 (file)
@@ -94,6 +94,7 @@ test_data_files = '''
         test-execute/exec-runtimedirectory.service
         test-execute/exec-spec-interpolation.service
         test-execute/exec-specifier.service
+        test-execute/exec-stdin-data.service
         test-execute/exec-supplementarygroups-multiple-groups-default-group-user.service
         test-execute/exec-supplementarygroups-multiple-groups-withgid.service
         test-execute/exec-supplementarygroups-multiple-groups-withuid.service
diff --git a/test/test-execute/exec-stdin-data.service b/test/test-execute/exec-stdin-data.service
new file mode 100644 (file)
index 0000000..00693d5
--- /dev/null
@@ -0,0 +1,19 @@
+[Unit]
+Description=Test for StandardInputText= and StandardInputData=
+
+[Service]
+ExecStart=/bin/sh -x -c 'd=$$(mktemp -d -p /tmp); echo -e "this is a test\nand this is more\nsomething encoded!\nsomething   in multiple lines\nand some more\nand a more bas64 data\nsomething with strange\nembedded\tcharacters\nand something with a exec-stdin-data.service specifier" > $d/text ; cmp $d/text'
+Type=oneshot
+StandardInput=data
+StandardInputText=this is a test
+StandardInputText=and this is more
+StandardInputData=c29tZXRoaW5nIGVuY29kZWQhCg==
+StandardInputText=something \
+ in multiple lines
+StandardInputText=\
+and some more
+StandardInputData=YW5kIGEgbW9y \
+    ZSBiYXM2NCBk\
+YXRhCg==
+StandardInputText=something with strange\nembedded\tcharacters
+StandardInputText=and something with a %n specifier