blob: db53d5a447efd003d441e4824c236afe7330216d [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 Tehlar608d0062023-04-28 10:29:47 +020041 --cpus=*)
42 args="$args -cpus ${i#*=}"
43 ;;
Filip Tehlar671cf512023-01-31 10:34:18 +010044 --test=*)
45 tc_name="${i#*=}"
46 if [ $tc_name != "all" ]; then
47 single_test=1
48 args="$args -run $tc_name"
49 fi
50esac
Maros Ondrejicka87531802022-12-19 20:35:27 +010051done
52
Filip Tehlar671cf512023-01-31 10:34:18 +010053if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +010054 echo "persist flag is not supported while running all tests!"
55 exit 1
56fi
57
58if [ $unconfigure_set -eq 1 ] && [ $single_test -eq 0 ]; then
59 echo "a single test has to be specified when unconfigure is set"
60 exit 1
61fi
62
63if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then
64 echo "setting persist flag and unconfigure flag is not allowed"
Filip Tehlar671cf512023-01-31 10:34:18 +010065 exit 1
66fi
67
Filip Tehlarec5c40b2023-02-28 18:59:15 +010068if [ $single_test -eq 0 ] && [ $debug_set -eq 1 ]; then
69 echo "VPP debug flag is not supperted while running all tests!"
70 exit 1
71fi
72
Filip Tehlar671cf512023-01-31 10:34:18 +010073sudo -E go test -buildvcs=false -v $args