| #!/usr/bin/env bash |
| mkdir -p logs |
| clean_up() { |
| r=$(sudo killall ndn-traffic-server 2>&1) |
| r=$(sudo killall nfd 2>&1) |
| } |
| sudo nfd &> logs/nfd.log & |
| sleep 2 |
| nrd &> logs/nrd.log & |
| sleep 2 |
| ndn-traffic-server NDNTrafficServer.conf > logs/server.log 2>&1 & |
| sleep 2 |
| echo "Sending interests..." |
| ndn-traffic -i 100 -c 100 NDNTrafficClient.conf > logs/client.log 2>&1 |
| clean_up |
| output=$(grep "Total Interest Loss" logs/client.log | head -1 | cut -d= -f2 | cut -d' ' -f2 | cut -d% -f1) |
| if [[ -z $output ]] |
| then |
| echo "ndn-traffic client does not end normally. See logs/client.log" |
| exit 1 |
| fi |
| if [[ $output != 0?(.+(0)) ]] |
| then |
| echo "Expected no interest Loss. Actual: $output%" |
| echo "For more information, please examine the log at \"$(pwd)/logs\"" |
| exit 2 |
| fi |
| echo "Unix Face Test PASSED" |