sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | |
| 3 | # simulate control_c by sending SIGUSR1 to the vgdb using prefix $1 in $2 seconds |
sewardj | 7629180 | 2011-05-31 07:09:06 +0000 | [diff] [blame] | 4 | # If there are some args after $2, the rest of these args is a command and its arg |
| 5 | # which is run every second. When this command is succesful, then the sleep and |
| 6 | # the control c simul is done. |
| 7 | PREFIX=$1 |
| 8 | shift |
| 9 | SLEEP=$1 |
| 10 | shift |
| 11 | GUARDCMD="$@" |
| 12 | if [ "$GUARDCMD" = "" ] |
| 13 | then |
| 14 | GUARDCMD="true" |
| 15 | fi |
| 16 | VGDBPID=`./vgdb -D $PREFIX 2>&1 | awk '/vgdb pid/ {print $3}'` |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 17 | if [ "$VGDBPID" = "" ] |
| 18 | then |
sewardj | 7629180 | 2011-05-31 07:09:06 +0000 | [diff] [blame] | 19 | echo "simulate_control_c could not determine the vgdb pid with " $PREFIX |
sewardj | 3b29048 | 2011-05-06 21:02:55 +0000 | [diff] [blame] | 20 | exit 1 |
| 21 | fi |
sewardj | 7629180 | 2011-05-31 07:09:06 +0000 | [diff] [blame] | 22 | (while ! $GUARDCMD >> garbage.filtered.out 2>&1 |
| 23 | do |
| 24 | sleep 1 |
| 25 | done |
| 26 | sleep $SLEEP |
philippe | 789d414 | 2012-08-15 13:27:23 +0000 | [diff] [blame] | 27 | kill -s USR1 $VGDBPID) & |