Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Apr 2015 03:35:48 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r281584 - in head/contrib/pjdfstest/tests: open truncate
Message-ID:  <201504160335.t3G3ZmSM082269@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504160335.t3G3ZmSM082269>