1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
#!/bin/bash
# Bug 0015 tcpclo and bpcp signal handling and semaphore signal interruptions
# Samuel Jero
# March 5, 2013
# The issue-358-cfdp-inactivity and issue-352-bpcp tests are sufficient
# to validate that the tcpclo and bpcp/bpcpd signal handlers work correctly.
# This test ensures that ION correctly handles semaphore operations that
# get interrupted by a signal. We do a simple loopback tcp transfer and
# run a simple program that constantly attempts to perform a transaction.
# We then fire a bunch of signals at this simple program. We then check
# ion.log for failed assertions which would indicate a hijacked transaction.
# documentation boilerplate
CONFIGFILES=" \
./loopback.ionrc \
./loopback.ionconfig \
./loopback.bprc \
./loopback.ionsecrc \
./loopback.ipnrc \
"
echo "########################################"
echo
pwd | sed "s/\/.*\///" | xargs echo "NAME: "
echo
echo "PURPOSE: To ensure that ION correctly handles semaphore operations that"
echo " get interrupted by a signal. We do a simple loopback tcp transfer"
echo " and run a simple program that constantly attempts to perform a"
echo " transaction. We then fire a bunch of signals at this simple"
echo " program. We then check ion.log for failed assertions which would"
echo " indicate a hijacked transaction."
echo
echo "CONFIG: The standard configuration loopback-tcp:"
echo
for N in $CONFIGFILES
do
echo "$N:"
cat $N
echo "# EOF"
echo
done
echo "OUTPUT: Terminal messages will relay results."
echo
echo "########################################"
echo "Starting ION..."
./cleanup
#Check for test program
if ! [ -e ./test ]; then
echo ""
echo "Test program not available! Make sure to run make test to build it."
echo "Skipping this test"
echo ""
exit 2
fi
# Start node
ionstart \
-i ./loopback.ionrc \
-b ./loopback.bprc \
-s ./loopback.ionsecrc \
-p ./loopback.ipnrc
#Starting bprecvfile
echo "Starting bpcounter..."
bpcounter ipn:1.2 &
BPRCV=$!
sleep 5
#Starting bpsendfile
echo "Starting bpdriver..."
bpdriver 100000 ipn:1.1 ipn:1.2 -1000 &
BPSND=$!
#Starting test program
echo "Starting test program..."
./test &
TST=$!
#Fire signals
echo "Fire signals at test program..."
for i in {1..20}
do
kill -SIGINT $TST
kill -SIGINT $TST
kill -SIGINT $TST
kill -SIGINT $TST
sleep 1
done
#Test
test=`grep "Assertion failed" ion.log`
echo $test
if [ -z "$test" ]; then
echo "OK: ION worked correctly when bombarded by signals. SUCCESS!!"
RETVAL=0
else
echo "ERROR: ION crashed as a result of a signal. FAILED!!"
RETVAL=1
fi
sleep 2
#End ION
echo "Killing ION..."
kill -SIGTERM $TST
killm
exit $RETVAL
|