From 75d0ddf72e2cbc79f51b8963b1b60573f19b1776 Mon Sep 17 00:00:00 2001 From: WATANABE Yuki Date: Sun, 1 Sep 2024 14:26:14 +0900 Subject: [PATCH] Elaborate job-y.tst test case This commit syncs the test file with: https://github.com/magicant/yash-rs/blob/a54b86bd943910e18916943983fa93e8738a27ac/yash-cli/tests/scripted_test/job-y.sh --- tests/job-y.tst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/job-y.tst b/tests/job-y.tst index 879aaf26..e4479e51 100644 --- a/tests/job-y.tst +++ b/tests/job-y.tst @@ -1,6 +1,21 @@ # job-y.tst: yash-specific test of job control ../checkfg || skip="true" # %REQUIRETTY% +# This test case first creates a background job that immediately exits, then +# waits for the job to finish, sending a null signal to the job to poll if the +# job is still running. A subshell starts another job and waits for it to finish +# to make sure the main shell process receives the SIGCHLD signal and examines +# the latest job status. The test case checks if the job is reported as done +# before the prompt for the next line is displayed. +test_e 'interactive shell reports job status before prompt' -im +echo >&2; sleep 0& while kill -0 $! 2>/dev/null; do :; done; (sleep 0& wait) +echo done >&2; exit +__IN__ +$ +[1] + Done sleep 0 +$ done +__ERR__ + mkfifo sync # According to POSIX, a shell may, but is not required to, forget the job