summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-10-27 16:16:19 +0200
committerLennart Poettering <lennart@poettering.net>2017-11-17 11:13:44 +0100
commit666d787787b7f7168478b73865adb7928b50cb88 (patch)
treeea191a97a9be9b0dd9c2601e1f43db6cc7a7b8f0
parentbefc4a800e9dc212c4f51bb9b20052b25d808590 (diff)
downloadsystemd-666d787787b7f7168478b73865adb7928b50cb88.tar.gz
test: add basic test for StandardInput=file:
-rw-r--r--src/test/test-execute.c5
-rw-r--r--test/meson.build1
-rw-r--r--test/test-execute/exec-stdin-data.service2
-rw-r--r--test/test-execute/exec-stdio-file.service7
4 files changed, 14 insertions, 1 deletions
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
index 34a93fb3eb..f831654b0a 100644
--- a/src/test/test-execute.c
+++ b/src/test/test-execute.c
@@ -482,6 +482,10 @@ static void test_exec_stdin_data(Manager *m) {
test(m, "exec-stdin-data.service", 0, CLD_EXITED);
}
+static void test_exec_stdio_file(Manager *m) {
+ test(m, "exec-stdio-file.service", 0, CLD_EXITED);
+}
+
static int run_tests(UnitFileScope scope, const test_function_t *tests) {
const test_function_t *test = NULL;
Manager *m = NULL;
@@ -539,6 +543,7 @@ int main(int argc, char *argv[]) {
test_exec_read_only_path_suceed,
test_exec_unset_environment,
test_exec_stdin_data,
+ test_exec_stdio_file,
NULL,
};
static const test_function_t system_tests[] = {
diff --git a/test/meson.build b/test/meson.build
index c5e45f1958..3292c778ac 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -95,6 +95,7 @@ test_data_files = '''
test-execute/exec-spec-interpolation.service
test-execute/exec-specifier.service
test-execute/exec-stdin-data.service
+ test-execute/exec-stdio-file.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
index 00693d5a43..1ca536ffc5 100644
--- a/test/test-execute/exec-stdin-data.service
+++ b/test/test-execute/exec-stdin-data.service
@@ -2,7 +2,7 @@
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'
+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 ; rm -rf $d'
Type=oneshot
StandardInput=data
StandardInputText=this is a test
diff --git a/test/test-execute/exec-stdio-file.service b/test/test-execute/exec-stdio-file.service
new file mode 100644
index 0000000000..8fd11caf8e
--- /dev/null
+++ b/test/test-execute/exec-stdio-file.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Test for StandardInput=file:
+
+[Service]
+ExecStart=/usr/bin/cmp /usr/bin/cmp
+Type=oneshot
+StandardInput=file:/usr/bin/cmp