Skip to content

Commit 34dbff2

Browse files
committed
Minor fixes to automation script
1 parent 639837d commit 34dbff2

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

run-tests

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@ if [ -z $packetdrill ]; then
2727
exit 1
2828
fi
2929

30+
if [ ! -e $directory ]; then
31+
echo "File not found!"
32+
exit 1
33+
fi
34+
3035
if [ ! -e $file ]; then
31-
sh update-test-list
36+
sh update-test-list tests_list
3237
fi
3338

3439
# Check if the argument is a ".pkt" file
@@ -38,7 +43,7 @@ fi
3843

3944
# Check if the argument is a directory
4045
if [ ! -z $directory ] && [ $pkt_file_flag == 0 ]; then
41-
sh update-test-list
46+
sh update-test-list temp_list $directory
4247
file=temp_list
4348
fi
4449

@@ -86,11 +91,11 @@ if [ $pkt_file_flag == 1 ]; then
8691
else
8792
while IFS= read test
8893
do
89-
printf "%-55.55s " .$test
94+
printf "%-55.55s " $test
9095
sleep $delay
91-
if [ -e .${test}.pkt ]; then
96+
if [ -e ${test}.pkt ]; then
9297
rm -f temp.log
93-
$packetdrill -v --tolerance_usecs=1000000 .${test}.pkt >> temp.log 2>&1
98+
$packetdrill -v --tolerance_usecs=1000000 ${test}.pkt >> temp.log 2>&1
9499
result="`echo $?`"
95100
check_status
96101
else

update-test-list

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,15 @@
22
# Script for updating local list of tests.
33
# Please run this script timely, especially after adding new tests.
44

5-
rm -f tests_list
6-
find . -type f -iname '*.pkt' | cut -f 2 -d '.' > tests_list
5+
if [ -z $1 ] && [ -z $2 ]; then
6+
echo "Usage ./update-test-list <test-file> <directory>"
7+
exit 1
8+
9+
else
10+
rm -f $1
11+
if [ -z $2 ]; then
12+
find . -type f -iname '*.pkt' | cut -f 2 -d '.' | cut -c 2- > $1
13+
else
14+
find $2 -type f -iname '*.pkt' | cut -f 1 -d '.' > $1
15+
fi
16+
fi

0 commit comments

Comments
 (0)