Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Feb 2015 13:18:33 +0000 (UTC)
From:      Peter Holm <pho@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r278353 - user/pho/stress2/misc
Message-ID:  <201502071318.t17DIXGL089146@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pho
Date: Sat Feb  7 13:18:32 2015
New Revision: 278353
URL: https://svnweb.freebsd.org/changeset/base/278353

Log:
  Wait longer for gdb to start and improve error handling.
  
  Sponsored by:	 EMC / Isilon storage division

Modified:
  user/pho/stress2/misc/signal.sh

Modified: user/pho/stress2/misc/signal.sh
==============================================================================
--- user/pho/stress2/misc/signal.sh	Sat Feb  7 13:11:45 2015	(r278352)
+++ user/pho/stress2/misc/signal.sh	Sat Feb  7 13:18:32 2015	(r278353)
@@ -180,7 +180,7 @@ int main(int argc, char *argv[]) {
 
     int sig;
     sscanf(argv[3], "%d", &sig);
-    
+
     if( syscall(SYS_thr_kill2, pid, id, sig) ) {
         perror("syscall");
     }
@@ -200,25 +200,29 @@ sleep 300 > gdbfifo &	# Keep the fifo op
 fifopid=$!
 
 gdb ./waitthread < gdbfifo > gdbout 2>&1 &
+gdbpid=$!
 echo "set args 8" > gdbfifo
 echo "run"        > gdbfifo
-sleep .2
+sleep .5
 
 pid=`ps | grep -v grep | grep "waitthread 8" | sed 's/^ *//;s/ .*//'`
-[ -z "$pid" ] && echo "Could not find pid" && exit 1
-procstat -t $pid > pstat
-
-t1=`grep fifo  pstat | awk '{print $2}'`
-t2=`grep umtxn pstat | awk '{print $2}' | tail -1`
+if [ -n "$pid" ]; then
+	procstat -t $pid > pstat
 
-./tkill $pid $t1 5	# SIGTRAP
-./tkill $pid $t2 2	# SIGINT
+	t1=`grep fifo  pstat | awk '{print $2}'`
+	t2=`grep umtxn pstat | awk '{print $2}' | tail -1`
 
-echo "c"    > gdbfifo
-echo "quit" > gdbfifo
+	./tkill $pid $t1 5	# SIGTRAP
+	./tkill $pid $t2 2	# SIGINT
 
-kill $fifopid
+	echo "c"    > gdbfifo
+	echo "quit" > gdbfifo
+	sleep 1
+	grep -q "signal SIGINT" gdbout || echo FAIL
+else
+	echo "Did not find pid for test program waitthread"
+fi
 
-grep -q "signal SIGINT" gdbout || echo FAIL
+kill $fifopid $gdbpid > /dev/null 2>&1
 rm -f gdbfifo gdbout pstat waitthread tkill /tmp/waitthread
 ps | grep -v grep | grep waitthread | awk '{print $1}' | xargs kill



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