Split logs into test cases to prevent overwriting

refs #2907

Change-Id: Ia7ca07fe0d7cd7428dbba5db443e87983aaaca3f
diff --git a/test_localhost_scope/in-master.sh b/test_localhost_scope/in-master.sh
index 7babc24..7149fd6 100755
--- a/test_localhost_scope/in-master.sh
+++ b/test_localhost_scope/in-master.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 source ../multi-host.conf
-mkdir -p logs
+mkdir -p logs/in
 workdir=$(pwd)
 
 clean_up() {
@@ -11,14 +11,14 @@
 }
 
 # start nfd and ndn-traffic-server on hostB
-ssh $CTRL_B "mkdir -p $workdir/logs;\
-    sudo nfd &> $workdir/logs/nfd.log &\
+ssh $CTRL_B "mkdir -p $workdir/logs/in;\
+    sudo nfd &> $workdir/logs/in/nfd.log &\
     sleep 2;\
-    ndn-traffic-server $workdir/NDNTrafficServer.conf &> $workdir/logs/server.log &"
+    ndn-traffic-server $workdir/NDNTrafficServer.conf &> $workdir/logs/in/server.log &"
 sleep 2
 
 # set up socat on A
-socat -v UNIX-LISTEN:/tmp/localhost-test-B.sock,fork TCP:$IP4_B1:6363 &> logs/socat.log &
+socat -v UNIX-LISTEN:/tmp/localhost-test-B.sock,fork TCP:$IP4_B1:6363 &> logs/in/socat.log &
 echo "transport=unix:///tmp/localhost-test-B.sock" > $HOME/.ndn/client.conf
 sleep 1
 
@@ -33,14 +33,14 @@
 
 # copy back the server log
 ssh $CTRL_B "killall ndn-traffic-server"
-scp $CTRL_B:$workdir/logs/server.log $workdir/logs/
+scp $CTRL_B:$workdir/logs/in/server.log $workdir/logs/in
 
 # analyze server log
-output=$(grep "Total Interests Received" $workdir/logs/server.log | head -1 | cut -d= -f2 | cut -d' ' -f2)
+output=$(grep "Total Interests Received" $workdir/logs/in/server.log | head -1 | cut -d= -f2 | cut -d' ' -f2)
 if [[ $output != 0?(.+(0)) ]]
 then
     echo "Expected no Interests received on host B. Actual: $output"
-    echo "For more information, please examine the log at \"$(pwd)/logs\""
+    echo "For more information, please examine the log at \"$(pwd)/logs/in\""
     clean_up
     exit 3
 fi
diff --git a/test_localhost_scope/out-master.sh b/test_localhost_scope/out-master.sh
index 9970eb8..0e345a1 100755
--- a/test_localhost_scope/out-master.sh
+++ b/test_localhost_scope/out-master.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 source ../multi-host.conf
-mkdir -p logs
+mkdir -p logs/out
 workdir=$(pwd)
 
 clean_up() {
@@ -8,12 +8,14 @@
     r=$(ssh $CTRL_B "sudo killall nfd" 2>&1)
 }
 
+ssh $CTRL_B "mkdir -p $workdir/logs/out"
+
 # start NFD on B
-ssh $CTRL_B "sudo nfd > $workdir/logs/nfd.log 2>&1 &\
+ssh $CTRL_B "sudo nfd > $workdir/logs/out/nfd.log 2>&1 &\
     sleep 2"
 
 # start netcat on A
-nc -vul 6363 > $workdir/logs/netcat.log 2>&1 &
+nc -vul 6363 > $workdir/logs/out/netcat.log 2>&1 &
 sleep 1
 
 # add nexthop of ndn:/ and ndn:/localhost/test-out to hostA
@@ -35,14 +37,14 @@
 ssh $CTRL_B "sudo killall nfd"
 output=$(killall nc)
 sleep 1
-output=$(grep "c39b6fed4ce4464ea136062f80002c7c" $workdir/logs/netcat.log)
+output=$(grep "c39b6fed4ce4464ea136062f80002c7c" $workdir/logs/out/netcat.log)
 if [[ -n $output ]]
 then
     echo "FAIL: /localhost Interest reaches remote host."
     clean_up
     exit 7
 fi
-output=$(grep "3b5fe3f184ff48adb3523180dee50555" $workdir/logs/netcat.log)
+output=$(grep "3b5fe3f184ff48adb3523180dee50555" $workdir/logs/out/netcat.log)
 if [[ -z $output ]]
 then
     echo "FAIL: non-/localhost Interest does not reach remote host."