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 |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 10 | ginkgo_args= |
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#*=}" |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 17 | if [ "$persist" = "true" ]; then |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 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#*=}" |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 24 | if [ "$debug" = "true" ]; then |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 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#*=}" |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 31 | if [ "$verbose" = "true" ]; then |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 32 | args="$args -verbose" |
| 33 | fi |
| 34 | ;; |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame] | 35 | --unconfigure=*) |
| 36 | unconfigure="${i#*=}" |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 37 | if [ "$unconfigure" = "true" ]; then |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame] | 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#*=}" |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 50 | if [ "$tc_name" != "all" ]; then |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 51 | single_test=1 |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 52 | ginkgo_args="$ginkgo_args --focus $tc_name -vv" |
| 53 | args="$args -verbose" |
| 54 | else |
| 55 | ginkgo_args="$ginkgo_args -v" |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 56 | fi |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 57 | ;; |
| 58 | --parallel=*) |
| 59 | ginkgo_args="$ginkgo_args -procs=${i#*=}" |
Matus Fabian | bbee45c | 2024-04-22 19:47:27 +0200 | [diff] [blame] | 60 | ;; |
| 61 | --repeat=*) |
| 62 | ginkgo_args="$ginkgo_args --repeat=${i#*=}" |
| 63 | ;; |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 64 | esac |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 65 | done |
| 66 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 67 | if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame] | 68 | echo "persist flag is not supported while running all tests!" |
| 69 | exit 1 |
| 70 | fi |
| 71 | |
| 72 | if [ $unconfigure_set -eq 1 ] && [ $single_test -eq 0 ]; then |
| 73 | echo "a single test has to be specified when unconfigure is set" |
| 74 | exit 1 |
| 75 | fi |
| 76 | |
| 77 | if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then |
| 78 | echo "setting persist flag and unconfigure flag is not allowed" |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 79 | exit 1 |
| 80 | fi |
| 81 | |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 82 | if [ $single_test -eq 0 ] && [ $debug_set -eq 1 ]; then |
| 83 | echo "VPP debug flag is not supperted while running all tests!" |
| 84 | exit 1 |
| 85 | fi |
| 86 | |
Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 87 | mkdir -p summary |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 88 | # shellcheck disable=SC2086 |
Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 89 | sudo -E go run github.com/onsi/ginkgo/v2/ginkgo --no-color --trace --json-report=summary/report.json $ginkgo_args -- $args |
Adrian Villin | 688ac5a | 2024-05-10 04:19:35 -0400 | [diff] [blame] | 90 | |
| 91 | jq -r '.[0] | .SpecReports[] | select((.State == "failed") or (.State == "timedout") or (.State == "panicked")) | select(.Failure != null) | "TestName: \(.LeafNodeText)\nSuite:\n\(.Failure.Location.FileName)\nMessage:\n\(.Failure.Message)\n Full Stack Trace:\n\(.Failure.Location.FullStackTrace)\n"' summary/report.json > summary/failed-summary.log \ |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 92 | && echo "Summary generated -> summary/failed-summary.log" |