git: 5922e9d7e72b - main - pwait: Don't use init as a target
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 25 Jul 2026 12:44:43 UTC
The branch main has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=5922e9d7e72bfa8a85b0f37bcfd1a8b5d866ec3b
commit 5922e9d7e72bfa8a85b0f37bcfd1a8b5d866ec3b
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-07-25 12:44:35 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-07-25 12:44:35 +0000
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
---
bin/pwait/tests/pwait_test.sh | 32 +++++++++++++++-----------------
1 file 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