svn commit: r319209 - user/pho/stress2/tools

Peter Holm pho at FreeBSD.org
Tue May 30 13:31:20 UTC 2017


Author: pho
Date: Tue May 30 13:31:18 2017
New Revision: 319209
URL: https://svnweb.freebsd.org/changeset/base/319209

Log:
  Improved error handling.
  
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/tools/killall.sh

Modified: user/pho/stress2/tools/killall.sh
==============================================================================
--- user/pho/stress2/tools/killall.sh	Tue May 30 13:30:26 2017	(r319208)
+++ user/pho/stress2/tools/killall.sh	Tue May 30 13:31:18 2017	(r319209)
@@ -30,11 +30,24 @@
 
 # Kill all running test programs from stress2/testcases
 
-for i in `find ../testcases -type f -perm -1`; do
-	list=`echo $list $(basename $i)`
-done
+list="`find ../testcases -type f -perm -1 | xargs basename`"
+[ -z "$list" ] && exit 1
 
-for i in `jot 20`; do
-	killall -q -9 $list 2>/dev/null || break
-	sleep $i
+i=0
+while pkill -9 $list; do
+	[ $((i += 1)) -lt 3 ] && continue
+	if [ -z "$(ps `pgrep $list` | sed 1d)" ]; then # <defunct>
+		for j in "`pgrep $list`"; do
+			ps auxwwl | awk "\$2 == $j"
+		done
+		echo "$0 FAIL"; exit 2
+	fi
+	if [ $i -eq 30 ]; then
+		pgrep $list | xargs ps -lp
+		echo "$0 FAIL @ $i"
+		exit 3
+	fi
+	sleep 5
 done
+[ $i -gt 2 ] && echo "Note: $0 exit @ $i"
+exit 0


More information about the svn-src-user mailing list