summaryrefslogtreecommitdiff
path: root/tests/cp/parent-perm-race.sh
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2016-04-20 17:00:47 +0100
committerPádraig Brady <P@draigBrady.com>2016-04-20 17:08:36 +0100
commit163c70d970ca3e216e24970fc5ebb1b48fdb855e (patch)
tree9e42f204c152cba2e6d323d23dc0f24c404dfef0 /tests/cp/parent-perm-race.sh
parent85faa0f4364e20284d19aeddcef5084f436f1aec (diff)
downloadcoreutils-163c70d970ca3e216e24970fc5ebb1b48fdb855e.tar.xz
tests: fix recent false failure due to a race
* tests/cp/parent-perm-race.sh: This new race introduced in commit v8.25-5-g632eda5 is quite hard to hit, but is due to `ls > fifo` doing write()/close()/exit() once `cp` has open() the source fifo. Then the subsequent comparison of the destination file may fail due to the file being missing or empty. Previously `ls` generated output that was independent of `cp`. Now we must wait for `cp` to finish before inspecting the destination file that it wrote.
Diffstat (limited to 'tests/cp/parent-perm-race.sh')
-rwxr-xr-xtests/cp/parent-perm-race.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/cp/parent-perm-race.sh b/tests/cp/parent-perm-race.sh
index 0d0841c2e..8d09329a1 100755
--- a/tests/cp/parent-perm-race.sh
+++ b/tests/cp/parent-perm-race.sh
@@ -43,6 +43,8 @@ do
# $d/attr and has started to read the source file $attr/fifo.
timeout 10 sh -c "ls -ld d/$attr >$attr/fifo" || fail=1
+ wait $pid || fail=1
+
ls_output=$(cat d/$attr/fifo) || fail=1
case $attr,$ls_output in
ownership,d???--[-S]--[-S]* | \
@@ -52,8 +54,6 @@ do
*)
fail=1;;
esac
-
- wait $pid || fail=1
done
Exit $fail