test: Wait for output to flush out in enable_pid
PATCH 1/1 test: Wait for output to flush out in enable_pid
From: Eugene Loh <[email protected]>
Our luck with this test has been quite good, but it sometimes fails to show its last lines of output. That is, we send a USR1 to the trigger processes to set off the final output and we immediately cat the output files. If there is any delay, the last output will be missing.
Add a short delay so that the last output will be seen.
--- test/unittest/usdt/tst.enable_pid.sh | 3 +++ 1 file changed, 3 insertions(+)
test/unittest/usdt/tst.enable_pid.sh +3 -0
@@ -172,6 +172,9 @@ for pid in 1 $pid1 $pid2 '*'; do kill -USR1 $pid2 done +# wait for last of the output to flush out +sleep 2 + echo done echo "========== out 1"; cat out.1 echo "========== out 2"; cat out.2
Signature · 1 line
2.43.5
On 8 Jun 2025, eugene loh told this:
Quoted 9 lines
From: Eugene Loh <[email protected]>
Our luck with this test has been quite good, but it sometimes fails to show its last lines of output. That is, we send a USR1 to the trigger processes to set off the final output and we immediately cat the output files. If there is any delay, the last output will be missing.
Add a short delay so that the last output will be seen.
Unavoidable if it's structured this way, but if you hit them with a USR2 and caught USR2 and had that do the same output as USR1 and then exit(), and did a wait(1) for both of them, you could avoid this delay.
Signature · 1 line
NULL && (void)