From f95c930e6701aa675377bc5871ea490dd565eeba Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 16 Apr 2015 03:35:47 +0000 Subject: [PATCH] Fix race when testing for ETXTBSY writing to ${n0} (process image) by making sure the process has been started beforehand with pgrep pkill the process afterwards to make sure it's dead when the unlink is run (not strictly required, but I was being conservative) MFC after: 1 week Reviewed by: Darius O'Conner, mjohnston Sponsored by: EMC / Isilon Storage Division --- contrib/pjdfstest/tests/open/20.t | 4 ++++ contrib/pjdfstest/tests/truncate/11.t | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/contrib/pjdfstest/tests/open/20.t b/contrib/pjdfstest/tests/open/20.t index de80b6122b7..7b94b036ab5 100644 --- a/contrib/pjdfstest/tests/open/20.t +++ b/contrib/pjdfstest/tests/open/20.t @@ -14,7 +14,11 @@ n0=`namegen` cp -pf `which sleep` ${n0} ./${n0} 3 & +while ! pkill -0 -f ./${n0}; do + sleep 0.1 +done expect ETXTBSY open ${n0} O_WRONLY expect ETXTBSY open ${n0} O_RDWR expect ETXTBSY open ${n0} O_RDONLY,O_TRUNC +pkill -9 -f ./${n0} expect 0 unlink ${n0} diff --git a/contrib/pjdfstest/tests/truncate/11.t b/contrib/pjdfstest/tests/truncate/11.t index b00d7b89c16..f4ecb42d2f0 100644 --- a/contrib/pjdfstest/tests/truncate/11.t +++ b/contrib/pjdfstest/tests/truncate/11.t @@ -14,5 +14,9 @@ n0=`namegen` cp -pf `which sleep` ${n0} ./${n0} 3 & +while ! pkill -0 -f ./${n0}; do + sleep 0.1 +done expect ETXTBSY truncate ${n0} 123 +pkill -9 -f ./${n0} expect 0 unlink ${n0}