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 | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 9 | debug_set=0 |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 10 | |
| 11 | for i in "$@" |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 12 | do |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 13 | case "${i}" in |
| 14 | --persist=*) |
| 15 | persist="${i#*=}" |
| 16 | if [ $persist = "true" ]; then |
| 17 | args="$args -persist" |
| 18 | persist_set=1 |
| 19 | fi |
| 20 | ;; |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 21 | --debug=*) |
| 22 | debug="${i#*=}" |
| 23 | if [ $debug = "true" ]; then |
| 24 | args="$args -debug" |
| 25 | debug_set=1 |
| 26 | fi |
| 27 | ;; |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 28 | --verbose=*) |
| 29 | verbose="${i#*=}" |
| 30 | if [ $verbose = "true" ]; then |
| 31 | args="$args -verbose" |
| 32 | fi |
| 33 | ;; |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame] | 34 | --unconfigure=*) |
| 35 | unconfigure="${i#*=}" |
| 36 | if [ $unconfigure = "true" ]; then |
| 37 | args="$args -unconfigure" |
| 38 | unconfigure_set=1 |
| 39 | fi |
| 40 | ;; |
Filip Tehlar | 608d006 | 2023-04-28 10:29:47 +0200 | [diff] [blame] | 41 | --cpus=*) |
| 42 | args="$args -cpus ${i#*=}" |
| 43 | ;; |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 44 | --test=*) |
| 45 | tc_name="${i#*=}" |
| 46 | if [ $tc_name != "all" ]; then |
| 47 | single_test=1 |
| 48 | args="$args -run $tc_name" |
| 49 | fi |
| 50 | esac |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 51 | done |
| 52 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 53 | if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame] | 54 | echo "persist flag is not supported while running all tests!" |
| 55 | exit 1 |
| 56 | fi |
| 57 | |
| 58 | if [ $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 |
| 61 | fi |
| 62 | |
| 63 | if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then |
| 64 | echo "setting persist flag and unconfigure flag is not allowed" |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 65 | exit 1 |
| 66 | fi |
| 67 | |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 68 | if [ $single_test -eq 0 ] && [ $debug_set -eq 1 ]; then |
| 69 | echo "VPP debug flag is not supperted while running all tests!" |
| 70 | exit 1 |
| 71 | fi |
| 72 | |
Filip Tehlar | 5aa59c7 | 2023-06-08 18:30:37 +0200 | [diff] [blame] | 73 | sudo -E go test -timeout=20m -buildvcs=false -v $args |