blob: 3f494cd49bd8e26b2ba21fdf70dde131a4cd20eb [file] [log] [blame]
#!/bin/bash
source ../multi-host.conf
clean_up() {
r=$(sudo killall ndn-traffic-server 2>&1)
r=$(sudo killall ndn-traffic 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 ndn-traffic-server
echo "starting ndn-traffic-server on A..."
ndn-traffic-server -c 1 $workdir/test-traffic-server.conf &> $workdir/logs/ndn-traffic-server.log &
serverpid=$!
sleep 1
# A: Run ndn-traffic
echo "Running ndn-traffic on A..."
ndn-traffic -c 1 $workdir/test-traffic-client.conf &> $workdir/logs/ndn-traffic.log
exitcode=$?
if [[ $exitcode -ne 0 ]]; then
echo "Received non-zero exit code from ndn-traffic - actual: $exitcode"
clean_up
exit 1
fi
sleep 1
# Verify that ndn-traffic-server has exited
# ps -p returns 1 if no matching process is found
ps -p $serverpid > /dev/null
if [[ $? -ne 1 ]]; then
echo "ndn-traffic-server did not exit"
clean_up
exit 2
fi
clean_up