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