|
From: <sv...@va...> - 2014-04-26 20:23:55
|
Author: philippe
Date: Sat Apr 26 20:23:47 2014
New Revision: 13912
Log:
Make the test (more) deterministic by having send_signal using
a guardcmd before sending the signal.
This allows to be sure that the signal are emitted when vgdb
is attached.
We still have one 'sleep' in the test.
Modified:
trunk/gdbserver_tests/nlvgdbsigqueue.stdinB.gdb
trunk/gdbserver_tests/nlvgdbsigqueue.stdoutB.exp
trunk/gdbserver_tests/send_signal
Modified: trunk/gdbserver_tests/nlvgdbsigqueue.stdinB.gdb
==============================================================================
--- trunk/gdbserver_tests/nlvgdbsigqueue.stdinB.gdb (original)
+++ trunk/gdbserver_tests/nlvgdbsigqueue.stdinB.gdb Sat Apr 26 20:23:47 2014
@@ -9,8 +9,8 @@
#
# send SIGUSR1/SIGUSR1 in a few seconds, after vgdb has attached
# vgdb will attach when it will receive the control-c
-shell ./send_signal USR1 --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 4
-shell ./send_signal USR1 --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 4
+shell ./send_signal USR1 --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 0 grep attachedwaitingforsigusr1 nlvgdbsigqueue.stdoutB.out
+shell ./send_signal USR1 --vgdb-prefix=./vgdb-prefix-nlvgdbsigqueue 0 grep attachedwaitingforsigusr1 nlvgdbsigqueue.stdoutB.out
#
echo continuing to have vgdb interrupted by simulate_control_c\n
continue
@@ -18,7 +18,10 @@
# Now vgdb should have received the interrupt, and so has
# attached to the sleeping process.
# wait for the USR sig to be sent, that will be queued by vgdb.
-shell sleep 8
+echo attachedwaitingforsigusr1\n
+# send_signal tries every second the guardcmd
+# so we must now wait to be (somewhat) sure the 2 SIGUSR1 are emitted
+shell sleep 3
# continue, so as to have vgdb sending queued signals when PTRACE_DETACHing
echo continuing to receive first SIGUSR1\n
continue
Modified: trunk/gdbserver_tests/nlvgdbsigqueue.stdoutB.exp
==============================================================================
--- trunk/gdbserver_tests/nlvgdbsigqueue.stdoutB.exp (original)
+++ trunk/gdbserver_tests/nlvgdbsigqueue.stdoutB.exp Sat Apr 26 20:23:47 2014
@@ -2,6 +2,7 @@
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
0x........ in syscall ...
+attachedwaitingforsigusr1
sending signal
sending signal
continuing to receive first SIGUSR1
Modified: trunk/gdbserver_tests/send_signal
==============================================================================
--- trunk/gdbserver_tests/send_signal (original)
+++ trunk/gdbserver_tests/send_signal Sat Apr 26 20:23:47 2014
@@ -1,18 +1,30 @@
#! /bin/sh
# send_signal sends signal $1 to the Valgrind process using prefix $2 in $3 seconds
+# If there are some args after $3, the rest of these args is a command and its arg
+# which is run every second. When this command is succesful, then the sleep and
+# the signal sending is done
SIG=$1
shift
PREFIX=$1
shift
SLEEP=$1
shift
+GUARDCMD="$@"
+if [ "$GUARDCMD" = "" ]
+then
+ GUARDCMD="true"
+fi
VPID=`./vgdb -l $PREFIX 2>&1 | awk '{print $2}' | sed -e 's/--pid=//'`
if [ "$VPID" = "" ]
then
echo "send_signal could not determine the valgrind pid with " $PREFIX
exit 1
fi
-(sleep $SLEEP
+(while ! $GUARDCMD >> garbage.filtered.out 2>&1
+ do
+ sleep 1
+ done
+ sleep $SLEEP
echo sending signal
kill -s $SIG $VPID) &
|