diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2026-07-25 12:44:35 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2026-07-25 12:44:35 +0000 |
| commit | 5922e9d7e72bfa8a85b0f37bcfd1a8b5d866ec3b (patch) | |
| tree | 0f9d5afe4469c1c7fe13fbc0b664836969650081 | |
| parent | 2cf2d955635abb546e57296e06815dd71f8c16ad (diff) | |
pwait: Don't use init as a target
The time_unit test case uses PID 1 as a target for pwait. This doesn't
work in a jail. Since all we need is a process that we know won't die
while the test is running, we may as well use ourselves.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D58418
| -rw-r--r-- | bin/pwait/tests/pwait_test.sh | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/bin/pwait/tests/pwait_test.sh b/bin/pwait/tests/pwait_test.sh index d31ca21cff93..0d4f53d2941d 100644 --- a/bin/pwait/tests/pwait_test.sh +++ b/bin/pwait/tests/pwait_test.sh @@ -56,31 +56,29 @@ time_unit_head() time_unit_body() { - init=1 - atf_check \ -o empty \ -e inline:"pwait: timeout unit\n" \ -s exit:65 \ - timeout --preserve-status 2 pwait -t 1d $init + timeout --preserve-status 2 pwait -t 1d $$ atf_check \ -o empty \ -e inline:"pwait: timeout unit\n" \ -s exit:65 \ - timeout --preserve-status 2 pwait -t 1d $init + timeout --preserve-status 2 pwait -t 1d $$ atf_check \ -o empty \ -e inline:"pwait: timeout value\n" \ -s exit:65 \ - timeout --preserve-status 2 pwait -t -1 $init + timeout --preserve-status 2 pwait -t -1 $$ atf_check \ -o empty \ -e inline:"pwait: timeout value\n" \ -s exit:65 \ - timeout --preserve-status 2 pwait -t 100000001 $init + timeout --preserve-status 2 pwait -t 100000001 $$ # These long duration cases are expected to timeout from the # timeout utility rather than pwait -t. @@ -88,37 +86,37 @@ time_unit_body() -o empty \ -e empty \ -s signal:15 \ - timeout --preserve-status 2 pwait -t 100000000 $init + timeout --preserve-status 2 pwait -t 100000000 $$ atf_check \ -o empty \ -e empty \ -s signal:15 \ - timeout --preserve-status 2 pwait -t 1h $init + timeout --preserve-status 2 pwait -t 1h $$ atf_check \ -o empty \ -e empty \ -s signal:15 \ - timeout --preserve-status 2 pwait -t 1.5h $init + timeout --preserve-status 2 pwait -t 1.5h $$ atf_check \ -o empty \ -e empty \ -s signal:15 \ - timeout --preserve-status 2 pwait -t 1m $init + timeout --preserve-status 2 pwait -t 1m $$ atf_check \ -o empty \ -e empty \ -s signal:15 \ - timeout --preserve-status 2 pwait -t 1.5m $init + timeout --preserve-status 2 pwait -t 1.5m $$ atf_check \ -o empty \ -e empty \ -s signal:15 \ - timeout --preserve-status 2 pwait -t 0 $init + timeout --preserve-status 2 pwait -t 0 $$ # The rest are fast enough that pwait -t is expected to trigger # the timeout. @@ -126,31 +124,31 @@ time_unit_body() -o empty \ -e empty \ -s exit:124 \ - timeout --preserve-status 2 pwait -t 1s $init + timeout --preserve-status 2 pwait -t 1s $$ atf_check \ -o empty \ -e empty \ -s exit:124 \ - timeout --preserve-status 2 pwait -t 1.5s $init + timeout --preserve-status 2 pwait -t 1.5s $$ atf_check \ -o empty \ -e empty \ -s exit:124 \ - timeout --preserve-status 2 pwait -t 1 $init + timeout --preserve-status 2 pwait -t 1 $$ atf_check \ -o empty \ -e empty \ -s exit:124 \ - timeout --preserve-status 2 pwait -t 1.5 $init + timeout --preserve-status 2 pwait -t 1.5 $$ atf_check \ -o empty \ -e empty \ -s exit:124 \ - timeout --preserve-status 2 pwait -t 0.5 $init + timeout --preserve-status 2 pwait -t 0.5 $$ } atf_test_case timeout_trigger_timeout |
