Author: ngie
Date: Thu Apr 16 03:35:47 2015
New Revision: 281584
URL: https://svnweb.freebsd.org/changeset/base/281584

Log:
  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

Modified:
  head/contrib/pjdfstest/tests/open/20.t
  head/contrib/pjdfstest/tests/truncate/11.t

Modified: head/contrib/pjdfstest/tests/open/20.t
==============================================================================
--- head/contrib/pjdfstest/tests/open/20.t      Thu Apr 16 02:44:37 2015        
(r281583)
+++ head/contrib/pjdfstest/tests/open/20.t      Thu Apr 16 03:35:47 2015        
(r281584)
@@ -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}

Modified: head/contrib/pjdfstest/tests/truncate/11.t
==============================================================================
--- head/contrib/pjdfstest/tests/truncate/11.t  Thu Apr 16 02:44:37 2015        
(r281583)
+++ head/contrib/pjdfstest/tests/truncate/11.t  Thu Apr 16 03:35:47 2015        
(r281584)
@@ -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}
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to