Skip to content

Commit 7ae2cab

Browse files
committed
Add logging functionality to the automation script
1 parent 8777ba2 commit 7ae2cab

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# The tests are incomplete
22
havercvdfin/
3+
4+
# Ignore the log files
5+
error.log

run-tests.sh

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/bin/sh
22

3-
packetdrill=/usr/home/zeebsd/packetdrill/gtests/net/packetdrill/packetdrill
3+
packetdrill=
4+
5+
if [ -z "$packetdrill" ]
6+
then
7+
printf "Please set the value of \$packetdrill variable to the path of packetdrill binary on your machine.\n"
8+
exit
9+
fi
410

511
set blocking/blocking-accept \
612
blocking/blocking-read \
@@ -52,25 +58,34 @@ run=0
5258
skipped=0
5359
found=0
5460

55-
printf "\nScript Name Result\n"
56-
printf "====================================================================\n"
61+
`rm -f error.log`
62+
printf "\nScript Name Result\n"
63+
printf "==============================================================\n"
5764
for test
5865
do
59-
printf "%-60.60s " $test
66+
printf "%-55.55s " $test
6067
`sleep $delay`
6168
if [ -e ${test}.pkt ]
6269
then
63-
$packetdrill ${test}.pkt > /dev/null 2>&1
70+
`rm -f temp.log`
71+
`$packetdrill -v ${test}.pkt >> temp.log 2>&1`
6472
result="`echo $?`"
6573
found=1
6674
if [ $found = 1 ]
6775
then
6876
if [ $result = 1 ]
6977
then
78+
`echo Test Name: ${test} >> error.log`
79+
`echo -e "---------------------------------------------------------" >> error.log`
80+
`cat temp.log >> error.log`
81+
`echo -e "" >> error.log`
7082
printf "FAILED\n"
83+
printf "\--------------------------------------------------------------\n"
7184
failed=`expr $failed + 1`
85+
set -- "$@" $test
7286
else
7387
printf "PASSED\n"
88+
printf "\--------------------------------------------------------------\n"
7489
passed=`expr $passed + 1`
7590
fi
7691
run=`expr $run + 1`
@@ -80,6 +95,7 @@ do
8095
skipped=`expr $skipped + 1`
8196
fi
8297
done
98+
`rm -f temp.log`
8399

84100
printf "\nSummary\n"
85101
printf "===========================\n"
@@ -88,3 +104,8 @@ printf "Number of tests run: %6d\n" $run
88104
printf "Number of tests passed: %3d\n" $passed
89105
printf "Number of tests failed: %3d\n" $failed
90106
printf "Number of tests skipped: %2d\n" $skipped
107+
printf "\nView the log file (error.log) for details\n"
108+
109+
# printf "\nList of failed tests\n"
110+
# printf "===========================\n"
111+
# printf '%s\n' "$@"

0 commit comments

Comments
 (0)