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 | b4516bb | 2024-06-19 06:20:00 -0400 | [diff] [blame] | 10 | debug_build= |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 11 | ginkgo_args= |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 12 | |
| 13 | for i in "$@" |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 14 | do |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 15 | case "${i}" in |
| 16 | --persist=*) |
| 17 | persist="${i#*=}" |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 18 | if [ "$persist" = "true" ]; then |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 19 | args="$args -persist" |
| 20 | persist_set=1 |
| 21 | fi |
| 22 | ;; |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 23 | --debug=*) |
| 24 | debug="${i#*=}" |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 25 | if [ "$debug" = "true" ]; then |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 26 | args="$args -debug" |
| 27 | debug_set=1 |
| 28 | fi |
| 29 | ;; |
Adrian Villin | b4516bb | 2024-06-19 06:20:00 -0400 | [diff] [blame] | 30 | --debug_build=*) |
| 31 | debug_build="${i#*=}" |
| 32 | if [ "$debug_build" = "true" ]; then |
| 33 | args="$args -debug_build" |
| 34 | fi |
| 35 | ;; |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 36 | --verbose=*) |
| 37 | verbose="${i#*=}" |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 38 | if [ "$verbose" = "true" ]; then |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 39 | args="$args -verbose" |
| 40 | fi |
| 41 | ;; |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame] | 42 | --unconfigure=*) |
| 43 | unconfigure="${i#*=}" |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 44 | if [ "$unconfigure" = "true" ]; then |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame] | 45 | args="$args -unconfigure" |
| 46 | unconfigure_set=1 |
| 47 | fi |
| 48 | ;; |
Filip Tehlar | 608d006 | 2023-04-28 10:29:47 +0200 | [diff] [blame] | 49 | --cpus=*) |
| 50 | args="$args -cpus ${i#*=}" |
| 51 | ;; |
Filip Tehlar | 109f3ce | 2023-09-05 15:36:28 +0200 | [diff] [blame] | 52 | --vppsrc=*) |
| 53 | args="$args -vppsrc ${i#*=}" |
| 54 | ;; |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 55 | --test=*) |
| 56 | tc_name="${i#*=}" |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 57 | if [ "$tc_name" != "all" ]; then |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 58 | single_test=1 |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 59 | ginkgo_args="$ginkgo_args --focus $tc_name -vv" |
| 60 | args="$args -verbose" |
| 61 | else |
| 62 | ginkgo_args="$ginkgo_args -v" |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 63 | fi |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 64 | ;; |
| 65 | --parallel=*) |
| 66 | ginkgo_args="$ginkgo_args -procs=${i#*=}" |
Matus Fabian | bbee45c | 2024-04-22 19:47:27 +0200 | [diff] [blame] | 67 | ;; |
| 68 | --repeat=*) |
| 69 | ginkgo_args="$ginkgo_args --repeat=${i#*=}" |
| 70 | ;; |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 71 | esac |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 72 | done |
| 73 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 74 | if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame] | 75 | echo "persist flag is not supported while running all tests!" |
| 76 | exit 1 |
| 77 | fi |
| 78 | |
| 79 | if [ $unconfigure_set -eq 1 ] && [ $single_test -eq 0 ]; then |
| 80 | echo "a single test has to be specified when unconfigure is set" |
| 81 | exit 1 |
| 82 | fi |
| 83 | |
| 84 | if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then |
| 85 | echo "setting persist flag and unconfigure flag is not allowed" |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 86 | exit 1 |
| 87 | fi |
| 88 | |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 89 | if [ $single_test -eq 0 ] && [ $debug_set -eq 1 ]; then |
Adrian Villin | b4516bb | 2024-06-19 06:20:00 -0400 | [diff] [blame] | 90 | echo "VPP debug flag is not supported while running all tests!" |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 91 | exit 1 |
| 92 | fi |
| 93 | |
Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 94 | mkdir -p summary |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 95 | # shellcheck disable=SC2086 |
Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 96 | 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] | 97 | |
Adrian Villin | 6d44aab | 2024-06-26 10:08:47 +0200 | [diff] [blame^] | 98 | jq -r '.[0] | .SpecReports[] | select((.State == "failed") or (.State == "timedout") or (.State == "panicked")) | select(.Failure != null) | "TestName: \(.LeafNodeText)\nSuite:\n\(.Failure.FailureNodeLocation.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] | 99 | && echo "Summary generated -> summary/failed-summary.log" |