Skip to content

Commit

Permalink
tests: fix recent false failure due to a race
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
pixelb committed Apr 20, 2016
1 parent 85faa0f commit 163c70d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/cp/parent-perm-race.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]* | \
Expand All @@ -52,8 +54,6 @@ do
*)
fail=1;;
esac

wait $pid || fail=1
done

Exit $fail

0 comments on commit 163c70d

Please sign in to comment.