Split logs into test cases to prevent overwriting

refs #2907

Change-Id: Ia7ca07fe0d7cd7428dbba5db443e87983aaaca3f
diff --git a/test_tcp_udp_tunnel/tcp-udp-tunnel-test.sh b/test_tcp_udp_tunnel/tcp-udp-tunnel-test.sh
index 6b38177..cd678e6 100755
--- a/test_tcp_udp_tunnel/tcp-udp-tunnel-test.sh
+++ b/test_tcp_udp_tunnel/tcp-udp-tunnel-test.sh
@@ -14,7 +14,7 @@
 fi
 echo "host D IP address $ipaddr"
 
-mkdir -p logs
+mkdir -p logs/$1
 
 clean_up() {
     r=$(ssh $CTRL_D "sudo killall ndn-traffic-server;\
@@ -24,16 +24,16 @@
 }
 
 # start nfd on host A
-sudo nfd &> logs/nfd.log &
+sudo nfd &> logs/$1/nfd.log &
 sleep 2
 
 # start nfd and ndn-traffic-server on host D
 echo "starting nfd and ndn-traffic-server on host D..."
 workdir=$(pwd)
-ssh $CTRL_D "mkdir -p $workdir/logs;\
-    sudo nfd &> $workdir/logs/nfd.log &\
+ssh $CTRL_D "mkdir -p $workdir/logs/$1;\
+    sudo nfd &> $workdir/logs/$1/nfd.log &\
     sleep 3;\
-    ndn-traffic-server $workdir/NDNTrafficServer.conf > $workdir/logs/server.log 2>&1 &"
+    ndn-traffic-server $workdir/NDNTrafficServer.conf > $workdir/logs/$1/server.log 2>&1 &"
 sleep 5
 
 # open a tunnel from host A to host D and set nexthop of ndn:/tunnel-test to D
@@ -42,7 +42,7 @@
 
 # run ndn-traffic client
 echo "running ndn-traffic client..."
-ndn-traffic -c 100 -i 100 NDNTrafficClient.conf > logs/client.log 2>&1
+ndn-traffic -c 100 -i 100 NDNTrafficClient.conf > logs/$1/client.log 2>&1
 
 # stop nfd on hostA
 echo "stopping nfd on host A..."
@@ -54,11 +54,11 @@
 
 # examine client log
 echo "analyzing results..."
-output=$(grep "Total Interest Loss" $workdir/logs/client.log | head -1 | cut -d= -f2 | cut -d' ' -f2 | cut -d% -f1)
+output=$(grep "Total Interest Loss" $workdir/logs/$1/client.log | head -1 | cut -d= -f2 | cut -d' ' -f2 | cut -d% -f1)
 if [[ $output != 0?(.+(0)) ]]
 then
     echo "Expected no Interest Loss. Actual: $output%"
-    echo "For more information, please examine the log at \"$(pwd)/logs\""
+    echo "For more information, please examine the log at \"$(pwd)/logs/$1\""
     exit 2
 fi
 echo "Tunnel Test PASSED"