Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174239248
D57213.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D57213.diff
View Options
diff --git a/bin/pwd/tests/pwd_test.sh b/bin/pwd/tests/pwd_test.sh
--- a/bin/pwd/tests/pwd_test.sh
+++ b/bin/pwd/tests/pwd_test.sh
@@ -75,14 +75,15 @@
{
pwd=$(which pwd)
[ -f "$pwd" ] || atf_skip "unable to distinguish binary from builtin"
- (
+ mkfifo fifo
+ : <fifo &
+ {
+ wait
trap "" PIPE
- # Give true(1) some time to exit.
- sleep 1
- $pwd 2>stderr
- echo $? >result
- ) | true
- atf_check -o inline:"1\n" cat result
+ "$pwd" 2>stderr
+ result=$?
+ } >fifo
+ atf_check_equal 1 "$result"
atf_check -o match:"stdout" cat stderr
}
diff --git a/usr.bin/asa/tests/asa_test.sh b/usr.bin/asa/tests/asa_test.sh
--- a/usr.bin/asa/tests/asa_test.sh
+++ b/usr.bin/asa/tests/asa_test.sh
@@ -68,13 +68,15 @@
atf_set descr "Failure to write to stdout"
}
stdout_body() {
- (
+ mkfifo fifo
+ : <fifo &
+ {
+ wait
trap "" PIPE
- sleep 1
echo " $a $b" | asa 2>stderr
- echo $? >result
- ) | true
- atf_check -o inline:"1\n" cat result
+ result=$?
+ } >fifo
+ atf_check_equal 1 "$result"
atf_check -o match:"stdout" cat stderr
}
diff --git a/usr.bin/cmp/tests/cmp_test2.sh b/usr.bin/cmp/tests/cmp_test2.sh
--- a/usr.bin/cmp/tests/cmp_test2.sh
+++ b/usr.bin/cmp/tests/cmp_test2.sh
@@ -136,13 +136,15 @@
# Helper for stdout test case
atf_check_stdout()
{
- (
+ mkfifo fifo
+ : <fifo &
+ {
+ wait
trap "" PIPE
- sleep 1
cmp "$@" 2>stderr
- echo $? >result
- ) | true
- atf_check -o inline:"2\n" cat result
+ result=$?
+ } >fifo
+ atf_check_equal 2 "$result"
atf_check -o match:"stdout" cat stderr
}
diff --git a/usr.bin/du/tests/du_test.sh b/usr.bin/du/tests/du_test.sh
--- a/usr.bin/du/tests/du_test.sh
+++ b/usr.bin/du/tests/du_test.sh
@@ -306,13 +306,15 @@
}
stdout_body()
{
- (
+ mkfifo fifo
+ : <fifo &
+ {
+ wait
trap "" PIPE
- sleep 1
du 2>stderr
- echo $? >result
- ) | true
- atf_check -o inline:"1\n" cat result
+ result=$?
+ } >fifo
+ atf_check_equal 1 "$result"
atf_check -o match:"stdout" cat stderr
}
diff --git a/usr.bin/env/tests/env_test.sh b/usr.bin/env/tests/env_test.sh
--- a/usr.bin/env/tests/env_test.sh
+++ b/usr.bin/env/tests/env_test.sh
@@ -137,13 +137,15 @@
}
stdout_body()
{
- (
+ mkfifo fifo
+ : <fifo &
+ {
+ wait
trap "" PIPE
- sleep 1
env 2>stderr
- echo $? >result
- ) | true
- atf_check -o inline:"1\n" cat result
+ result=$?
+ } >fifo
+ atf_check_equal 1 "$result"
atf_check -o match:"stdout" cat stderr
}
diff --git a/usr.bin/ident/tests/ident_test.sh b/usr.bin/ident/tests/ident_test.sh
--- a/usr.bin/ident/tests/ident_test.sh
+++ b/usr.bin/ident/tests/ident_test.sh
@@ -70,13 +70,15 @@
stdout_body()
{
local dir=$(atf_get_srcdir)
- (
+ mkfifo fifo
+ : <fifo &
+ {
+ wait
trap "" PIPE
- sleep 1
ident "${dir}"/test.in 2>stderr
- echo $? >result
- ) | true
- atf_check -o inline:"1\n" cat result
+ result=$?
+ } >fifo
+ atf_check_equal 1 "$result"
atf_check -o match:"stdout" cat stderr
}
diff --git a/usr.bin/printenv/tests/printenv_test.sh b/usr.bin/printenv/tests/printenv_test.sh
--- a/usr.bin/printenv/tests/printenv_test.sh
+++ b/usr.bin/printenv/tests/printenv_test.sh
@@ -78,14 +78,15 @@
}
stdout_body()
{
- local dir=$(atf_get_srcdir)
- (
+ mkfifo fifo
+ : <fifo &
+ {
+ wait
trap "" PIPE
- sleep 1
printenv 2>stderr
- echo $? >result
- ) | true
- atf_check -o inline:"1\n" cat result
+ result=$?
+ } >fifo
+ atf_check_equal 1 "$result"
atf_check -o match:"stdout" cat stderr
}
diff --git a/usr.bin/uniq/tests/uniq_test.sh b/usr.bin/uniq/tests/uniq_test.sh
--- a/usr.bin/uniq/tests/uniq_test.sh
+++ b/usr.bin/uniq/tests/uniq_test.sh
@@ -197,14 +197,15 @@
atf_set descr "error writing to stdout"
}
stdout_body() {
- (
+ mkfifo fifo
+ : <fifo &
+ {
+ wait
trap "" PIPE
- # Give true(1) some time to exit.
- sleep 1
echo a | uniq 2>stderr
- echo $? >result
- ) | true
- atf_check -o inline:"1\n" cat result
+ result=$?
+ } >fifo
+ atf_check_equal 1 "$result"
atf_check -o match:"stdout" cat stderr
}
diff --git a/usr.bin/yes/tests/yes_test.sh b/usr.bin/yes/tests/yes_test.sh
--- a/usr.bin/yes/tests/yes_test.sh
+++ b/usr.bin/yes/tests/yes_test.sh
@@ -66,14 +66,15 @@
}
stdout_body()
{
- (
+ mkfifo fifo
+ : <fifo &
+ {
+ wait
trap "" PIPE
- # Give true(1) some time to exit.
- sleep 1
yes 2>stderr
- echo $? >result
- ) | true
- atf_check -o inline:"1\n" cat result
+ result=$?
+ } >fifo
+ atf_check_equal 1 "$result"
atf_check -o match:"stdout" cat stderr
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 2, 3:26 PM (1 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40056007
Default Alt Text
D57213.diff (4 KB)
Attached To
Mode
D57213: tests: Avoid sleep when causing a write error
Attached
Detach File
Event Timeline
Log In to Comment