Yi Huang | 9a118b3 | 2014-04-22 15:17:51 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Yi Huang | 9906f8e | 2014-04-17 13:28:03 -0700 | [diff] [blame] | 2 | mkdir -p logs |
| 3 | clean_up() { |
| 4 | r=$(sudo killall ndn-traffic-server 2>&1) |
| 5 | r=$(sudo killall nfd 2>&1) |
| 6 | } |
Yi Huang | 53fa871 | 2014-06-10 20:14:26 -0700 | [diff] [blame] | 7 | sudo nfd &> logs/nfd.log & |
| 8 | sleep 2 |
Yi Huang | 9906f8e | 2014-04-17 13:28:03 -0700 | [diff] [blame] | 9 | ndn-traffic-server NDNTrafficServer.conf > logs/server.log 2>&1 & |
| 10 | sleep 2 |
| 11 | echo "Sending interests..." |
| 12 | ndn-traffic -i 100 -c 100 NDNTrafficClient.conf > logs/client.log 2>&1 |
| 13 | clean_up |
| 14 | output=$(grep "Total Interest Loss" logs/client.log | head -1 | cut -d= -f2 | cut -d' ' -f2 | cut -d% -f1) |
| 15 | if [[ -z $output ]] |
| 16 | then |
| 17 | echo "ndn-traffic client does not end normally. See logs/client.log" |
| 18 | exit 1 |
| 19 | fi |
Eric Newberry | afb5c5f | 2015-06-09 08:57:58 -0700 | [diff] [blame] | 20 | if [[ $output != 0?(.+(0)) ]] |
Yi Huang | 9906f8e | 2014-04-17 13:28:03 -0700 | [diff] [blame] | 21 | then |
| 22 | echo "Expected no interest Loss. Actual: $output%" |
| 23 | echo "For more information, please examine the log at \"$(pwd)/logs\"" |
| 24 | exit 2 |
| 25 | fi |
| 26 | echo "Unix Face Test PASSED" |