Split logs into test cases to prevent overwriting

refs #2907

Change-Id: Ia7ca07fe0d7cd7428dbba5db443e87983aaaca3f
diff --git a/test_interest_loop/interest-loop-test.sh b/test_interest_loop/interest-loop-test.sh
index a4bae83..93c5b94 100755
--- a/test_interest_loop/interest-loop-test.sh
+++ b/test_interest_loop/interest-loop-test.sh
@@ -4,6 +4,7 @@
 b_ipaddr=$IP4_B1
 c_ipaddr=$IP4_C1
 strategy=$1
+logprefix=$2
 echo "host A IP address $a_ipaddr"
 echo "host B IP address $b_ipaddr"
 echo "host C IP address $c_ipaddr"
@@ -31,12 +32,12 @@
 # start NFD on three nodes and set nexthop to create loop
 echo "start NFD on three nodes and set nexthop to create loop..."
 ssh $CTRL_B "mkdir -p $workdir/logs;\
-    sudo nfd --config $workdir/nfd.conf &> $workdir/logs/nfd.log &\
+    sudo nfd --config $workdir/nfd.conf &> $workdir/logs/${logprefix}_nfd.log &\
     sleep 2"
 ssh $CTRL_C "mkdir -p $workdir/logs;\
-    sudo nfd --config $workdir/nfd.conf &> $workdir/logs/nfd.log &\
+    sudo nfd --config $workdir/nfd.conf &> $workdir/logs/${logprefix}_nfd.log &\
     sleep 2"
-sudo nfd --config $workdir/nfd.conf &> $workdir/logs/nfd.log &
+sudo nfd --config $workdir/nfd.conf &> $workdir/logs/${logprefix}_nfd.log &
 sleep 5
 ssh $CTRL_B "$workdir/add-nexthop.sh $c_ipaddr $strategy"
 ssh $CTRL_C "$workdir/add-nexthop.sh $a_ipaddr $strategy"
@@ -44,22 +45,22 @@
 
 # use ndn-traffic client to send 100 interests
 echo "using ndn-traffic client to send 100 interests..."
-ndn-traffic -c 100 -i 200 NDNTrafficClient.conf > $workdir/logs/client.log 2>&1
+ndn-traffic -c 100 -i 200 NDNTrafficClient.conf > $workdir/logs/${logprefix}_client.log 2>&1
 
 # collect nfd-status from B and C
 echo "collecting nfd-status from B and C..."
-ssh $CTRL_B "nfd-status -f > $workdir/logs/nfd-status-B.log 2>&1"
-scp $CTRL_B:$workdir/logs/nfd-status-B.log  $workdir/logs/nfd-status-B.log
-ssh $CTRL_C "nfd-status -f > $workdir/logs/nfd-status-C.log 2>&1"
-scp $CTRL_C:$workdir/logs/nfd-status-C.log  $workdir/logs/nfd-status-C.log
-nfd-status -f > $workdir/logs/nfd-status-A.log 2>&1
+ssh $CTRL_B "nfd-status -f > $workdir/logs/${logprefix}_nfd-status-B.log 2>&1"
+scp $CTRL_B:$workdir/logs/${logprefix}_nfd-status-B.log  $workdir/logs/${logprefix}_nfd-status-B.log
+ssh $CTRL_C "nfd-status -f > $workdir/logs/${logprefix}_nfd-status-C.log 2>&1"
+scp $CTRL_C:$workdir/logs/${logprefix}_nfd-status-C.log  $workdir/logs/${logprefix}_nfd-status-C.log
+nfd-status -f > $workdir/logs/${logprefix}_nfd-status-A.log 2>&1
 
 # analyze results
 echo "analyzing results..."
 for host in {A..C}
 do
     echo "Host $host:"
-    cat $workdir/logs/nfd-status-$host.log | grep udp4 | while read line
+    cat $workdir/logs/${logprefix}_nfd-status-$host.log | grep udp4 | while read line
     do
         ini=$(echo "$line" | grep -Po "in={.*?i" | sed 's/in={//g' | sed 's/i//g')
         outi=$(echo "$line" | grep -Po "out={.*?i" | sed 's/out={//g' | sed 's/i//g')
diff --git a/test_interest_loop/test_interest_loop.py b/test_interest_loop/test_interest_loop.py
index 595d037..e08b733 100644
--- a/test_interest_loop/test_interest_loop.py
+++ b/test_interest_loop/test_interest_loop.py
@@ -29,28 +29,28 @@
 
     def test_broadcast(self):
         print ">>> Testing with Broadcast Strategy <<<"
-        ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/broadcast"], shell=True)
+        ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/broadcast broadcast"], shell=True)
         print "Test script return value:", ret
         if ret != 0:
             self.fail(self.errormsg[ret])
 
     def test_best_route(self):
         print ">>> Testing with Best-route Strategy <<<"
-        ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/best-route"], shell=True)
+        ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/best-route best-route"], shell=True)
         print "Test script return value:", ret
         if ret != 0:
             self.fail(self.errormsg[ret])
 
     def test_client_control(self):
         print ">>> Testing with Client Control Strategy <<<"
-        ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/client-control"], shell=True)
+        ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/client-control client-control"], shell=True)
         print "Test script return value:", ret
         if ret != 0:
             self.fail(self.errormsg[ret])
 
     def test_ncc(self):
         print ">>> Testing with NCC Strategy <<<"
-        ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/ncc"], shell=True)
+        ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/ncc ncc"], shell=True)
         print "Test script return value:", ret
         if ret != 0:
             self.fail(self.errormsg[ret])