mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 00:51:24 +03:00
58b65c6d6d
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.
13 lines
455 B
Desktop File
13 lines
455 B
Desktop File
[Unit]
|
|
Description=Test for StandardOutput=truncate:
|
|
|
|
[Service]
|
|
ExecStartPre=sh -c 'printf "hello\n" > /tmp/test-exec-standardoutput-output'
|
|
ExecStartPre=sh -c 'printf "hi\n" > /tmp/test-exec-standardoutput-expected'
|
|
StandardInput=data
|
|
StandardInputText=hi
|
|
StandardOutput=truncate:/tmp/test-exec-standardoutput-output
|
|
StandardError=null
|
|
ExecStart=sh -c 'cat && cmp /tmp/test-exec-standardoutput-output /tmp/test-exec-standardoutput-expected'
|
|
Type=oneshot
|