blob: a8866524b585f0a914b9b9a4e30dddbbc78e2b82 [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 Tehlar671cf512023-01-31 10:34:18 +010010
11for i in "$@"
Maros Ondrejicka87531802022-12-19 20:35:27 +010012do
Filip Tehlar671cf512023-01-31 10:34:18 +010013case "${i}" in
14 --persist=*)
15 persist="${i#*=}"
16 if [ $persist = "true" ]; then
17 args="$args -persist"
18 persist_set=1
19 fi
20 ;;
Filip Tehlarec5c40b2023-02-28 18:59:15 +010021 --debug=*)
22 debug="${i#*=}"
23 if [ $debug = "true" ]; then
24 args="$args -debug"
25 debug_set=1
26 fi
27 ;;
Filip Tehlar671cf512023-01-31 10:34:18 +010028 --verbose=*)
29 verbose="${i#*=}"
30 if [ $verbose = "true" ]; then
31 args="$args -verbose"
32 fi
33 ;;
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +010034 --unconfigure=*)
35 unconfigure="${i#*=}"
36 if [ $unconfigure = "true" ]; then
37 args="$args -unconfigure"
38 unconfigure_set=1
39 fi
40 ;;
Filip Tehlar671cf512023-01-31 10:34:18 +010041 --test=*)
42 tc_name="${i#*=}"
43 if [ $tc_name != "all" ]; then
44 single_test=1
45 args="$args -run $tc_name"
46 fi
47esac
Maros Ondrejicka87531802022-12-19 20:35:27 +010048done
49
Filip Tehlar671cf512023-01-31 10:34:18 +010050if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +010051 echo "persist flag is not supported while running all tests!"
52 exit 1
53fi
54
55if [ $unconfigure_set -eq 1 ] && [ $single_test -eq 0 ]; then
56 echo "a single test has to be specified when unconfigure is set"
57 exit 1
58fi
59
60if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then
61 echo "setting persist flag and unconfigure flag is not allowed"
Filip Tehlar671cf512023-01-31 10:34:18 +010062 exit 1
63fi
64
Filip Tehlarec5c40b2023-02-28 18:59:15 +010065if [ $single_test -eq 0 ] && [ $debug_set -eq 1 ]; then
66 echo "VPP debug flag is not supperted while running all tests!"
67 exit 1
68fi
69
Filip Tehlar671cf512023-01-31 10:34:18 +010070sudo -E go test -buildvcs=false -v $args