diff options
author | Lucas Werkmeister <mail@lucaswerkmeister.de> | 2021-01-15 20:01:44 +0100 |
---|---|---|
committer | Lucas Werkmeister <mail@lucaswerkmeister.de> | 2021-01-15 20:22:29 +0100 |
commit | 58b65c6d6d4e0363a43c11415028eefd6c592ea8 (patch) | |
tree | 17dbe45185b216f8e0c345c8796f962a5a1fbb20 /test | |
parent | ci: migrate to Semaphore CI 2.0 (diff) | |
download | systemd-58b65c6d6d4e0363a43c11415028eefd6c592ea8.tar.xz systemd-58b65c6d6d4e0363a43c11415028eefd6c592ea8.zip |
test: fix exec-standardoutput-truncate test
The cmp in ExecStartPost= was actually failing – ExecStartPost= has the
same StandardOutput as the rest of the service, so the output file is
truncated before cmp can compare it with the expected output – but the
test still passed because test_exec_standardoutput_truncate() calls
test(), which only checks the main result, rather than test_service(),
which checks the result of the whole service. Fix the test by merging
the ExecStartPost= into the ExecStart= – the cmp has to be part of the
same command line as the cat so that the file is not truncated between
the two processes.
Diffstat (limited to 'test')
-rw-r--r-- | test/test-execute/exec-standardoutput-truncate.service | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/test/test-execute/exec-standardoutput-truncate.service b/test/test-execute/exec-standardoutput-truncate.service index 7a12a06923..4b4bb87b75 100644 --- a/test/test-execute/exec-standardoutput-truncate.service +++ b/test/test-execute/exec-standardoutput-truncate.service @@ -8,6 +8,5 @@ StandardInput=data StandardInputText=hi StandardOutput=truncate:/tmp/test-exec-standardoutput-output StandardError=null -ExecStart=cat -ExecStartPost=cmp /tmp/test-exec-standardoutput-output /tmp/test-exec-standardoutput-expected +ExecStart=sh -c 'cat && cmp /tmp/test-exec-standardoutput-output /tmp/test-exec-standardoutput-expected' Type=oneshot |