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])
diff --git a/test_linkfail/ping.sh b/test_linkfail/ping.sh
index 99954f3..17a7af3 100755
--- a/test_linkfail/ping.sh
+++ b/test_linkfail/ping.sh
@@ -3,6 +3,7 @@
source ../multi-host.conf
LOGPREFIX=$1
+STRATEGY=$2
ndnping -c 25 /B &> logs/${LOGPREFIX}_ping_A.log
diff --git a/test_linkfail/pingserver.sh b/test_linkfail/pingserver.sh
index 2ce10cd..bf0e10e 100755
--- a/test_linkfail/pingserver.sh
+++ b/test_linkfail/pingserver.sh
@@ -3,6 +3,7 @@
source ../multi-host.conf
LOGPREFIX=$1
+STRATEGY=$2
ssh $CTRL_B "cd $DIR; ndnpingserver /B &> logs/${LOGPREFIX}_pingserver_B.log"
diff --git a/test_linkfail/test_linkfail.py b/test_linkfail/test_linkfail.py
index 2d8afa9..0e1ea02 100644
--- a/test_linkfail/test_linkfail.py
+++ b/test_linkfail/test_linkfail.py
@@ -20,9 +20,9 @@
print "[linkfail] testing", key
self.startProcess("start", ["./start.sh", key, strategy], "-> Starting NFD and creating faces")
self.waitForProcessCompletion("start", None)
- self.startProcess("pingserver", ["./pingserver.sh", key], "-> Starting ping server on B")
+ self.startProcess("pingserver", ["./pingserver.sh", key, strategy], "-> Starting ping server on B")
time.sleep(1)
- self.startProcess("ping", ["./ping.sh", key], "-> Starting ping client on A")
+ self.startProcess("ping", ["./ping.sh", key, strategy], "-> Starting ping client on A")
time.sleep(5)
self.startProcess("ABfail", ["./linkfail.sh", "fail", "A1", "B1"], "-> Failing link A-B")
diff --git a/test_localhop/localhop-test.sh b/test_localhop/localhop-test.sh
index 4c6d3d3..796fb95 100755
--- a/test_localhop/localhop-test.sh
+++ b/test_localhop/localhop-test.sh
@@ -77,7 +77,7 @@
# analyze server log
echo "analyzing server log..."
output=$(grep "Total Interests Received" $workdir/logs/server.log | head -2 | tail -1 | cut -d= -f2 | cut -d' ' -f2)
-if [ $output != 0?(.+(0)) ]
+if [[ $output != 0?(.+(0)) ]]
then
echo "Expected no interests with name ndn:/localhop/test-localhop/A/1 received on host C. Actual: $output"
echo "For more information, please examine the log at \"$(pwd)/logs\""
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."
diff --git a/test_multicast/multicast-test.sh b/test_multicast/multicast-test.sh
index 4c39bf3..11295ee 100755
--- a/test_multicast/multicast-test.sh
+++ b/test_multicast/multicast-test.sh
@@ -6,7 +6,7 @@
else
a_ipaddr=$(ip addr show to $IP4_A1 | head -1 | cut -d: -f2 | cut -d' ' -f2)
fi
-mkdir -p logs
+mkdir -p logs/$1
workdir=$(pwd)
clean_up() {
@@ -16,17 +16,17 @@
}
# start nfd and ndn-traffic-server on B and C
-ssh $CTRL_B "mkdir -p $workdir/logs;\
- sudo nfd &> $workdir/logs/nfd.log &\
+ssh $CTRL_B "mkdir -p $workdir/logs/$1;\
+ sudo nfd &> $workdir/logs/$1/nfd.log &\
sleep 3;\
- ndn-traffic-server $workdir/NDNTrafficServerB.conf &> $workdir/logs/server.log &"
-ssh $CTRL_C "mkdir -p $workdir/logs;\
- sudo nfd &> $workdir/logs/nfd.log &\
+ ndn-traffic-server $workdir/NDNTrafficServerB.conf &> $workdir/logs/$1/server.log &"
+ssh $CTRL_C "mkdir -p $workdir/logs/$1;\
+ sudo nfd &> $workdir/logs/$1/nfd.log &\
sleep 3;\
- ndn-traffic-server $workdir/NDNTrafficServerC.conf &> $workdir/logs/server.log &"
+ ndn-traffic-server $workdir/NDNTrafficServerC.conf &> $workdir/logs/$1/server.log &"
# start nfd and add nexthop of ndn:/test-mcast to UDP multicast face
-sudo nfd &> $workdir/logs/nfd.log &
+sudo nfd &> $workdir/logs/$1/nfd.log &
sleep 3
faceid=$(nfd-status -f | grep $a_ipaddr | grep -Po 'faceid=.*? ' | sed 's/faceid=//' | sed 's/ //')
nfdc add-nexthop ndn:/test-mcast $faceid
diff --git a/test_nfdc/include.sh b/test_nfdc/include.sh
index 4e92a89..4319e9f 100755
--- a/test_nfdc/include.sh
+++ b/test_nfdc/include.sh
@@ -9,10 +9,10 @@
start_nfd() {
# start nfd on localhost
- sudo nfd &> $workdir/logs/nfd.log &
+ sudo nfd &> $workdir/logs/$1/nfd.log &
# start nfd on hostB
- ssh $CTRL_B "mkdir -p $workdir/logs ; sudo nfd &> $workdir/logs/nfd.log &\
+ ssh $CTRL_B "mkdir -p $workdir/logs/$1 ; sudo nfd &> $workdir/logs/$1/nfd.log &\
sleep 2"
sleep 2
}
diff --git a/test_nfdc/nfdc-test.sh b/test_nfdc/nfdc-test.sh
index c3c246d..daa76da 100755
--- a/test_nfdc/nfdc-test.sh
+++ b/test_nfdc/nfdc-test.sh
@@ -2,13 +2,13 @@
source ../multi-host.conf
source include.sh
workdir=$(pwd)
-mkdir -p $workdir/logs
+mkdir -p $workdir/logs/$1
testCase=$1
-testLog=$workdir/logs/nfdc_test_$testCase.log
+testLog=$workdir/logs/$testCase/nfdc_test.log
echo "TEST START" > $testLog
-start_nfd
+start_nfd $testCase
# run test case A: test nfdc create / add-nexthop / destroy test case
if [[ $testCase == 'A' ]]; then
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"