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