]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add test for https://github.com/systemd/systemd/issues/14560 14595/head
authorLennart Poettering <lennart@poettering.net>
Mon, 20 Jan 2020 13:40:44 +0000 (14:40 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 20 Jan 2020 16:19:51 +0000 (17:19 +0100)
src/test/test-execute.c
test/meson.build
test/test-execute/exec-standardinput-file-cat.service [new file with mode: 0644]

index b3f8cc84345da32dbcb2967ed3902bdc4c3fd825..ff40e0dd43dd4749a239bef701ee216194e81dd0 100644 (file)
@@ -756,6 +756,7 @@ static void test_exec_specifier(Manager *m) {
 static void test_exec_standardinput(Manager *m) {
         test(__func__, m, "exec-standardinput-data.service", 0, CLD_EXITED);
         test(__func__, m, "exec-standardinput-file.service", 0, CLD_EXITED);
+        test(__func__, m, "exec-standardinput-file-cat.service", 0, CLD_EXITED);
 }
 
 static void test_exec_standardoutput(Manager *m) {
@@ -786,6 +787,7 @@ static int run_tests(UnitFileScope scope, const test_entry tests[], char **patte
         assert_se(tests);
 
         r = manager_new(scope, MANAGER_TEST_RUN_BASIC, &m);
+        m->default_std_output = EXEC_OUTPUT_NULL; /* don't rely on host journald */
         if (manager_errno_skip_test(r))
                 return log_tests_skipped_errno(r, "manager_new");
         assert_se(r >= 0);
index 237b4db12c9771271dc720ed34a276e812734574..856e4a434d0365a4320d048d5b06e45f5b67deac 100644 (file)
@@ -138,6 +138,7 @@ test_data_files = '''
         test-execute/exec-specifier@.service
         test-execute/exec-standardinput-data.service
         test-execute/exec-standardinput-file.service
+        test-execute/exec-standardinput-file-cat.service
         test-execute/exec-standardoutput-file.service
         test-execute/exec-standardoutput-append.service
         test-execute/exec-supplementarygroups-multiple-groups-default-group-user.service
diff --git a/test/test-execute/exec-standardinput-file-cat.service b/test/test-execute/exec-standardinput-file-cat.service
new file mode 100644 (file)
index 0000000..a0c786c
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=Test for StandardInput=file:
+
+[Service]
+ExecStart=cat
+Type=oneshot
+StandardInput=file:/etc/os-release
+# We leave StandardOutput= unset here, to verify https://github.com/systemd/systemd/issues/14560 works
+# The "cat" tool is going to write to stdout, which fails if we dup() stdin to stdout