Eric Newberry | c22afde | 2018-06-19 01:28:31 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | source ../multi-host.conf |
| 3 | |
| 4 | clean_up() { |
| 5 | r=$(sudo killall ndn-traffic-server 2>&1) |
Davide Pesavento | 15af8b5 | 2019-01-27 14:06:54 -0500 | [diff] [blame] | 6 | r=$(sudo killall ndn-traffic-client 2>&1) |
Eric Newberry | c22afde | 2018-06-19 01:28:31 -0700 | [diff] [blame] | 7 | r=$(sudo killall nfd 2>&1) |
| 8 | } |
| 9 | |
| 10 | # A: Start NFD |
| 11 | workdir=$(pwd) |
| 12 | echo "starting nfd on A..." |
| 13 | mkdir -p $workdir/logs; sudo nfd &> $workdir/logs/nfd.log & |
| 14 | sleep 1 |
| 15 | |
| 16 | # A: Start ndn-traffic-server |
| 17 | echo "starting ndn-traffic-server on A..." |
| 18 | ndn-traffic-server -c 1 $workdir/test-traffic-server.conf &> $workdir/logs/ndn-traffic-server.log & |
| 19 | serverpid=$! |
| 20 | sleep 1 |
| 21 | |
| 22 | # A: Run ndn-traffic |
Davide Pesavento | 15af8b5 | 2019-01-27 14:06:54 -0500 | [diff] [blame] | 23 | echo "Running ndn-traffic-client on A..." |
| 24 | ndn-traffic-client -c 1 $workdir/test-traffic-client.conf &> $workdir/logs/ndn-traffic-client.log |
Eric Newberry | c22afde | 2018-06-19 01:28:31 -0700 | [diff] [blame] | 25 | exitcode=$? |
| 26 | |
| 27 | if [[ $exitcode -ne 0 ]]; then |
Davide Pesavento | 15af8b5 | 2019-01-27 14:06:54 -0500 | [diff] [blame] | 28 | echo "Received non-zero exit code from ndn-traffic-client - actual: $exitcode" |
Eric Newberry | c22afde | 2018-06-19 01:28:31 -0700 | [diff] [blame] | 29 | clean_up |
| 30 | exit 1 |
| 31 | fi |
| 32 | |
| 33 | sleep 1 |
| 34 | |
| 35 | # Verify that ndn-traffic-server has exited |
| 36 | # ps -p returns 1 if no matching process is found |
| 37 | ps -p $serverpid > /dev/null |
| 38 | if [[ $? -ne 1 ]]; then |
| 39 | echo "ndn-traffic-server did not exit" |
| 40 | clean_up |
| 41 | exit 2 |
| 42 | fi |
| 43 | |
| 44 | clean_up |