Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | source vars |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 4 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 5 | args= |
| 6 | single_test=0 |
| 7 | persist_set=0 |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame^] | 8 | unconfigure_set=0 |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 9 | |
| 10 | for i in "$@" |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 11 | do |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 12 | case "${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 Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame^] | 26 | --unconfigure=*) |
| 27 | unconfigure="${i#*=}" |
| 28 | if [ $unconfigure = "true" ]; then |
| 29 | args="$args -unconfigure" |
| 30 | unconfigure_set=1 |
| 31 | fi |
| 32 | ;; |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 33 | --test=*) |
| 34 | tc_name="${i#*=}" |
| 35 | if [ $tc_name != "all" ]; then |
| 36 | single_test=1 |
| 37 | args="$args -run $tc_name" |
| 38 | fi |
| 39 | esac |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 40 | done |
| 41 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 42 | if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame^] | 43 | echo "persist flag is not supported while running all tests!" |
| 44 | exit 1 |
| 45 | fi |
| 46 | |
| 47 | if [ $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 |
| 50 | fi |
| 51 | |
| 52 | if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then |
| 53 | echo "setting persist flag and unconfigure flag is not allowed" |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 54 | exit 1 |
| 55 | fi |
| 56 | |
| 57 | sudo -E go test -buildvcs=false -v $args |