blob: c3b9eaef145f9febc9a0811ad508d77c5e34914d [file] [log] [blame]
Filip Tehlar229f5fc2022-08-09 14:44:47 +00001#!/usr/bin/env bash
2
3source vars
Maros Ondrejicka87531802022-12-19 20:35:27 +01004
Filip Tehlar671cf512023-01-31 10:34:18 +01005args=
6single_test=0
7persist_set=0
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +01008unconfigure_set=0
Filip Tehlarec5c40b2023-02-28 18:59:15 +01009debug_set=0
Filip Tehlar109f3ce2023-09-05 15:36:28 +020010vppsrc=
Filip Tehlar671cf512023-01-31 10:34:18 +010011
12for i in "$@"
Maros Ondrejicka87531802022-12-19 20:35:27 +010013do
Filip Tehlar671cf512023-01-31 10:34:18 +010014case "${i}" in
15 --persist=*)
16 persist="${i#*=}"
17 if [ $persist = "true" ]; then
18 args="$args -persist"
19 persist_set=1
20 fi
21 ;;
Filip Tehlarec5c40b2023-02-28 18:59:15 +010022 --debug=*)
23 debug="${i#*=}"
24 if [ $debug = "true" ]; then
25 args="$args -debug"
26 debug_set=1
27 fi
28 ;;
Filip Tehlar671cf512023-01-31 10:34:18 +010029 --verbose=*)
30 verbose="${i#*=}"
31 if [ $verbose = "true" ]; then
32 args="$args -verbose"
33 fi
34 ;;
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +010035 --unconfigure=*)
36 unconfigure="${i#*=}"
37 if [ $unconfigure = "true" ]; then
38 args="$args -unconfigure"
39 unconfigure_set=1
40 fi
41 ;;
Filip Tehlar608d0062023-04-28 10:29:47 +020042 --cpus=*)
43 args="$args -cpus ${i#*=}"
44 ;;
Filip Tehlar109f3ce2023-09-05 15:36:28 +020045 --vppsrc=*)
46 args="$args -vppsrc ${i#*=}"
47 ;;
Filip Tehlar671cf512023-01-31 10:34:18 +010048 --test=*)
49 tc_name="${i#*=}"
50 if [ $tc_name != "all" ]; then
51 single_test=1
Filip Tehlar3b770882023-09-05 15:58:28 +020052 args="$args -run $tc_name -verbose"
Filip Tehlar671cf512023-01-31 10:34:18 +010053 fi
54esac
Maros Ondrejicka87531802022-12-19 20:35:27 +010055done
56
Filip Tehlar671cf512023-01-31 10:34:18 +010057if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +010058 echo "persist flag is not supported while running all tests!"
59 exit 1
60fi
61
62if [ $unconfigure_set -eq 1 ] && [ $single_test -eq 0 ]; then
63 echo "a single test has to be specified when unconfigure is set"
64 exit 1
65fi
66
67if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then
68 echo "setting persist flag and unconfigure flag is not allowed"
Filip Tehlar671cf512023-01-31 10:34:18 +010069 exit 1
70fi
71
Filip Tehlarec5c40b2023-02-28 18:59:15 +010072if [ $single_test -eq 0 ] && [ $debug_set -eq 1 ]; then
73 echo "VPP debug flag is not supperted while running all tests!"
74 exit 1
75fi
76
Filip Tehlar5aa59c72023-06-08 18:30:37 +020077sudo -E go test -timeout=20m -buildvcs=false -v $args