blob: f5435f6fc3d1c1b19dc8e9281740c9b40f76a8d8 [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)
Davide Pesavento15af8b52019-01-27 14:06:54 -05006 r=$(sudo killall ndn-traffic-client 2>&1)
Eric Newberryc22afde2018-06-19 01:28:31 -07007 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
Davide Pesavento15af8b52019-01-27 14:06:54 -050023echo "Running ndn-traffic-client on A..."
24ndn-traffic-client -c 1 $workdir/test-traffic-client.conf &> $workdir/logs/ndn-traffic-client.log
Eric Newberryc22afde2018-06-19 01:28:31 -070025exitcode=$?
26
27if [[ $exitcode -ne 0 ]]; then
Davide Pesavento15af8b52019-01-27 14:06:54 -050028 echo "Received non-zero exit code from ndn-traffic-client - actual: $exitcode"
Eric Newberryc22afde2018-06-19 01:28:31 -070029 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