blob: 9dff5b1818b3a47d3ec1add7b45937ebc402293e [file] [log] [blame]
#!/bin/bash
source ../multi-host.conf
clean_up() {
r=$(sudo killall ndnpeek 2>&1)
r=$(sudo killall ndnpoke 2>&1)
r=$(sudo killall nfd 2>&1)
}
# A: Start NFD
workdir=$(pwd)
echo "Starting nfd on A..."
mkdir -p $workdir/logs; sudo nfd &> $workdir/logs/nfd.log &
sleep 1
# A: Start ndnpoke
echo "Starting ndnpoke on A..."
ndnpoke /test/peekpoke < $workdir/test-poke-input.txt &
pokepid=$!
sleep 1
# A: Run ndnpeek
echo "Running ndnpeek on A..."
ndnpeek /test/peekpoke > $workdir/logs/test-peek-output.txt
exitcode=$?
if [[ $exitcode -ne 0 ]]; then
echo "Received non-zero exit code from ndnpeek - actual: $exitcode"
clean_up
exit 1
fi
sleep 1
# Verify that ndnpoke has exited
# ps -p returns 1 if no matching process is found
ps -p $pokepid > /dev/null
if [[ $? -ne 1 ]]; then
echo "ndnpoke did not exit"
clean_up
exit 2
fi
clean_up