summaryrefslogtreecommitdiffstats
path: root/tests/data_plane/vpp_lite_topo/run.sh
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2016-07-07 08:29:25 +0200
committerFilip Tehlar <ftehlar@cisco.com>2016-07-07 12:26:52 +0200
commit05479d8750d11d46a939c31ca78e99ecc310dc7a (patch)
treed1acfad937839fad93f52cdff4d0b34a69588e77 /tests/data_plane/vpp_lite_topo/run.sh
parent12defda1182a88e98a20d63c32fe897359663ad7 (diff)
Add script which runs all VPP lite tests
Change-Id: I13c8726ac60647201d40249434f3a81085a8f9ff Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'tests/data_plane/vpp_lite_topo/run.sh')
-rwxr-xr-xtests/data_plane/vpp_lite_topo/run.sh93
1 files changed, 93 insertions, 0 deletions
diff --git a/tests/data_plane/vpp_lite_topo/run.sh b/tests/data_plane/vpp_lite_topo/run.sh
new file mode 100755
index 0000000..59bae1c
--- /dev/null
+++ b/tests/data_plane/vpp_lite_topo/run.sh
@@ -0,0 +1,93 @@
+#!/usr/bin/env bash
+
+TESTS_DIR=tests
+
+function help
+{
+ echo "Run all ONE tests"
+ echo
+ echo This must be run with superuser privileges.
+ echo "Usage:"
+ echo " ./run.sh [vh]"
+ echo
+ echo " -v : verbose output"
+ echo " -h : show help"
+}
+
+verbose=0
+
+while [ $# -gt 0 ] ; do
+ arg=$1
+ shift
+
+ if [ $arg == "-v" ]; then
+ verbose=1
+ elif [ $arg == "-h" ] ; then
+ help
+ exit 0
+ fi
+done
+
+### begin script
+
+failed_tcs=()
+count=0
+failed_num=0
+passed_num=0
+
+start_time=`date +%s`
+
+# count tests
+test_num=`ls -l $TESTS_DIR/test_* | wc -l`
+
+echo
+echo "Running VPP lite test suite."
+echo
+
+for test_case in $TESTS_DIR/test_*
+do
+ let "count=$count + 1"
+
+ # run the test case
+ base_name=`basename -a $test_case`
+ printf "*** %d/%d : %-45s" $count $test_num $base_name
+
+ if [ $verbose -ne 0 ] ; then
+ $test_case
+ else
+ $test_case &> /dev/null
+ fi
+ rc=$?
+
+ if [ $rc -ne 0 ] ; then
+ printf "failed!\n"
+ failed_tcs+=("$test_case")
+ let "failed_num=$failed_num + 1"
+ else
+ printf "passed.\n"
+ let "passed_num=$passed_num + 1"
+ fi
+ sleep 1
+done
+
+end_time=`date +%s`
+runtime=$((end_time-start_time))
+
+echo
+echo "------------------------------------------------------"
+echo "Runtime: " `date -u -d @${runtime} +"%M min %S sec"`
+echo
+
+if [ $failed_num -eq 0 ]; then
+ echo "All tests have passed."
+else
+ echo "List of failed test cases:"
+ for tc in "${failed_tcs[@]}"
+ do
+ echo "$tc"
+ done
+fi
+
+echo "------------------------------------------------------"
+
+### end script