blob: f02c15966814f5780a2823271fe0398219be9960 [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 Tehlar671cf512023-01-31 10:34:18 +01009
10for i in "$@"
Maros Ondrejicka87531802022-12-19 20:35:27 +010011do
Filip Tehlar671cf512023-01-31 10:34:18 +010012case "${i}" in
13 --persist=*)
14 persist="${i#*=}"
15 if [ $persist = "true" ]; then
16 args="$args -persist"
17 persist_set=1
18 fi
19 ;;
20 --verbose=*)
21 verbose="${i#*=}"
22 if [ $verbose = "true" ]; then
23 args="$args -verbose"
24 fi
25 ;;
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +010026 --unconfigure=*)
27 unconfigure="${i#*=}"
28 if [ $unconfigure = "true" ]; then
29 args="$args -unconfigure"
30 unconfigure_set=1
31 fi
32 ;;
Filip Tehlar671cf512023-01-31 10:34:18 +010033 --test=*)
34 tc_name="${i#*=}"
35 if [ $tc_name != "all" ]; then
36 single_test=1
37 args="$args -run $tc_name"
38 fi
39esac
Maros Ondrejicka87531802022-12-19 20:35:27 +010040done
41
Filip Tehlar671cf512023-01-31 10:34:18 +010042if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +010043 echo "persist flag is not supported while running all tests!"
44 exit 1
45fi
46
47if [ $unconfigure_set -eq 1 ] && [ $single_test -eq 0 ]; then
48 echo "a single test has to be specified when unconfigure is set"
49 exit 1
50fi
51
52if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then
53 echo "setting persist flag and unconfigure flag is not allowed"
Filip Tehlar671cf512023-01-31 10:34:18 +010054 exit 1
55fi
56
57sudo -E go test -buildvcs=false -v $args