| #!/bin/bash |
| source ../multi-host.conf |
| |
| clean_up() { |
| r=$(sudo killall ndn-traffic-server 2>&1) |
| r=$(sudo killall ndn-traffic-client 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-client on A..." |
| ndn-traffic-client -c 1 $workdir/test-traffic-client.conf &> $workdir/logs/ndn-traffic-client.log |
| exitcode=$? |
| |
| if [[ $exitcode -ne 0 ]]; then |
| echo "Received non-zero exit code from ndn-traffic-client - 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 |