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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
#!/bin/bash
#
# Samuel Jero
# Ohio University
# October 10, 2011
#
# This test pertains to issue #313 "Overlapping memcpy in BP bundle acquisition system".
# This test sends multiple several bundles inside an LTP segment to ensure that
# they are correctly separated out without corruption. The first part checks
# for error messages in the log file indicitive of corruption. The second part uses
# cfdptest to send a file as a sequence of many bundles and verifies that
# the file was received correctly.
function end(){
# Shut down ION processes.
echo "Stopping ION..."
./ionstop &
sleep 5
killm
echo "Overlapping memcpy() test complete"
cd ..
exit $RETVAL
}
CONFIGFILES=" \
./1.ipn.bp.ltp.udp/config.ionrc \
./1.ipn.bp.ltp.udp/config.ltprc \
./1.ipn.bp.ltp.udp/config.bprc \
./1.ipn.bp.ltp.udp/config.ipnrc \
./1.ipn.bp.ltp.udp/config.cfdprc"
echo "########################################"
echo
pwd | sed "s/\/.*\///" | xargs echo "NAME: "
echo
echo "PURPOSE: Testing the functionality of issue 313.
Confirms that multiple bundles sent to BP at the same time
are correctly processed without corruption"
echo
echo "CONFIG: 1 node custom:"
echo
for N in $CONFIGFILES
do
echo "$N:"
cat $N
echo "# EOF"
echo
done
echo "OUTPUT: Terminal messages will relay results."
echo
echo "########################################"
./cleanup
RETVAL=1
#Start ION
echo "Starting ion node..."
export ION_NODE_LIST_DIR=$PWD
rm -f ./ion_nodes
cd 1.ipn.bp.ltp.udp
./ionstart > node.stdout
sleep 10
echo ""
echo "Test 1---Use bpdriver and bpcounter to send a bunch of bundles and check log for error messages"
echo "Starting bpcounter..."
bpcounter ipn:1.1 &
BPR_PID=$!
echo "Sending bundles..."
bpdriver 100 ipn:1.2 ipn:1.1 -100
echo "Waiting 5 seconds for bpcounter to receive bundles..."
sleep 5
echo "Stopping bprecvfile..."
kill -2 $BPR_PID >/dev/null 2>&1
sleep 1
kill -9 $BPR_PID >/dev/null 2>&1
#Compare files
GREP=`grep "Wrong bundle version (should be 6)" ion.log`
if [ -n "$GREP" ]; then
#We have a problem. The Bundles were corrupted in transit.
echo "The Bundles were corrupted in transit. FAILURE!"
echo ""
RETVAL=1
end
else
# Success.
echo "ION Successfully transmitted the bundles SUCCESS!"
echo ""
RETVAL=0
fi
echo "Test 2---if cfdptest is installed, send and verify a file"
# Check if CFDP is available on this system
PROGRAMTEST="cfdptest"
RESULTS=`which ${PROGRAMTEST}`
WHICHRETURN=$?
echo "${RESULTS}" | grep "^no ${PROGRAMTEST} in"
WHICHFAILMESSAGE=$?
# which could return the proper fail condition, or the results could be
# empty, or you're on solaris and your results will be "no netcat in $PATH".
if [ $WHICHRETURN -ne 0 -o -z "${RESULTS}" -o $WHICHFAILMESSAGE -eq 0 ] ; then
echo "${PROGRAMTEST} is not present in this system; skipping Test 2"
end
fi
sleep 1
echo "Starting CFDP..."
cfdpadmin config.cfdprc
echo "Sending file..."
CMD_FILE="cfdpcmds"
echo "d 1" > $CMD_FILE
echo "f ../dotest" >> $CMD_FILE
echo "t test" >> $CMD_FILE
echo "&" >> $CMD_FILE
cfdptest < $CMD_FILE
echo "Waiting 5 seconds for file to be received..."
sleep 5
DIFF=`diff ../dotest test`
if [ -n "$DIFF" ] && [ -e "test" ]; then
#we have a problem
echo "The file was corrupted in transit. FAILURE!"
echo ""
RETVAL=1
else
#Success
echo "The file was transfered successfully. SUCCESS!"
echo ""
RETVAL=0
fi
#Stopping CFDP
cfdpadmin .
sleep 1
end
|