Disable SD tests expected failing
[one.git] / tests / data_plane / vpp_lite_topo / run.sh
1 #!/usr/bin/env bash
2
3 source odl_utils.sh
4
5 TESTS_DIR=tests
6
7 function help
8 {
9   echo "Run all ONE tests"
10   echo
11   echo This must be run with superuser privileges.
12   echo "Usage:"
13   echo " ./run.sh [vhc] [--config-method vat|cli]"
14   echo
15   echo "  -v : verbose output"
16   echo "  -c : clean"
17   echo "  -h : show help"
18   echo "  --config-method : select configuration method. Default is VAT."
19 }
20
21 export CFG_METHOD=vat
22 source config.sh
23
24 verbose=0
25
26 while [ $# -gt 0 ] ; do
27   arg=$1
28   shift
29
30   if [ $arg == "-v" ]; then
31     verbose=1
32   elif [ $arg == "-h" ] ; then
33     help
34     exit 0
35   elif [ $arg == "-c" ] ; then
36     clean_all
37     exit 0
38   elif [ $arg == "--config-method" ] ; then
39     type=$1
40     shift
41     if [ $type != "vat" -a $type != "cli"  ] ; then
42       echo "ERROR: expected one of 'cli' or 'vat' "
43       help
44       exit 1
45     fi
46     export CFG_METHOD=$type
47   else
48     echo "parse error"
49     help
50     exit 1
51   fi
52 done
53
54 ### begin script
55
56 failed_tcs=()
57 count=0
58 failed_num=0
59 passed_num=0
60
61 start_time=`date +%s`
62
63 # sudo?
64 if [[ $(id -u) != 0 ]]; then
65   echo "Superuser privileges needed!"
66   exit 1
67 fi
68
69 # check whether ODL is running
70 check_odl_running
71
72
73 # count tests
74 test_num=`ls -l "$TESTS_DIR"/test_* | wc -l`
75 disabled_num=`ls -l "$TESTS_DIR"/disabled_test_* | wc -l`
76 manual_num=`ls -l "$TESTS_DIR"/manual_test_* | wc -l`
77
78 echo
79 echo "Running VPP lite test suite."
80 echo
81 echo "Config method: $CFG_METHOD"
82 echo
83
84 for test_case in "$TESTS_DIR"/test_*
85 do
86   let "count=$count + 1"
87
88   # run the test case
89   base_name=`basename -a "$test_case"`
90   printf "*** %2d/%d : %-48s" $count $test_num "$base_name"
91
92   if [ $verbose -ne 0 ] ; then
93     "$test_case"
94   else
95     "$test_case" &> /dev/null
96   fi
97   rc=$?
98
99   if [ $rc -ne 0 ] ; then
100     printf "failed!\n"
101     failed_tcs+=("$test_case")
102     let "failed_num=$failed_num + 1"
103   else
104     printf "passed.\n"
105     let "passed_num=$passed_num + 1"
106   fi
107   sleep 1
108 done
109
110 end_time=`date +%s`
111 runtime=$((end_time-start_time))
112
113 echo
114 echo "------------------------------------------------------"
115 echo "Runtime: " `date -u -d @${runtime} +"%M min %S sec"`
116 echo
117
118 if [ $failed_num -eq 0 ]; then
119   echo "All tests have passed."
120 else
121   echo "List of failed test cases:"
122   for tc in "${failed_tcs[@]}"
123   do
124     echo "$tc"
125   done
126 fi
127
128 echo
129 if [ $disabled_num -ne 0 ] ; then
130   echo "Skipped tests: " $disabled_num
131 fi
132
133 if [ $manual_num -ne 0 ] ; then
134   echo "Manual tests: " $manual_num
135 fi
136
137 echo
138 echo "------------------------------------------------------"
139
140 ### end script