13b290486cd4cd601b20e04340e593c9ed9717e5fsewardj#! /bin/sh 23b290486cd4cd601b20e04340e593c9ed9717e5fsewardj 33b290486cd4cd601b20e04340e593c9ed9717e5fsewardj# simulate control_c by sending SIGUSR1 to the vgdb using prefix $1 in $2 seconds 4762918075005524a8398870b4bae71787f1a4007sewardj# If there are some args after $2, the rest of these args is a command and its arg 5ed39800a83baf5bffbe391f3974eb2af0f415f80Elliott Hughes# which is run every second. When this command is successful, then the sleep and 6762918075005524a8398870b4bae71787f1a4007sewardj# the control c simul is done. 7762918075005524a8398870b4bae71787f1a4007sewardjPREFIX=$1 8762918075005524a8398870b4bae71787f1a4007sewardjshift 9762918075005524a8398870b4bae71787f1a4007sewardjSLEEP=$1 10762918075005524a8398870b4bae71787f1a4007sewardjshift 11762918075005524a8398870b4bae71787f1a4007sewardjGUARDCMD="$@" 12762918075005524a8398870b4bae71787f1a4007sewardjif [ "$GUARDCMD" = "" ] 13762918075005524a8398870b4bae71787f1a4007sewardjthen 14762918075005524a8398870b4bae71787f1a4007sewardj GUARDCMD="true" 15762918075005524a8398870b4bae71787f1a4007sewardjfi 16762918075005524a8398870b4bae71787f1a4007sewardjVGDBPID=`./vgdb -D $PREFIX 2>&1 | awk '/vgdb pid/ {print $3}'` 173b290486cd4cd601b20e04340e593c9ed9717e5fsewardjif [ "$VGDBPID" = "" ] 183b290486cd4cd601b20e04340e593c9ed9717e5fsewardjthen 19762918075005524a8398870b4bae71787f1a4007sewardj echo "simulate_control_c could not determine the vgdb pid with " $PREFIX 203b290486cd4cd601b20e04340e593c9ed9717e5fsewardj exit 1 213b290486cd4cd601b20e04340e593c9ed9717e5fsewardjfi 22762918075005524a8398870b4bae71787f1a4007sewardj(while ! $GUARDCMD >> garbage.filtered.out 2>&1 23762918075005524a8398870b4bae71787f1a4007sewardj do 24762918075005524a8398870b4bae71787f1a4007sewardj sleep 1 25762918075005524a8398870b4bae71787f1a4007sewardj done 26762918075005524a8398870b4bae71787f1a4007sewardj sleep $SLEEP 27789d41438a22e9bd4b2f02a8c8fe944e24a37b99philippe kill -s USR1 $VGDBPID) & 28