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 | ;; |
Adrian Villin | 5d171eb | 2024-06-17 08:51:27 +0200 | [diff] [blame] | 71 | --cpu0=*) |
| 72 | cpu0="${i#*=}" |
| 73 | if [ "$cpu0" = "true" ]; then |
| 74 | args="$args -cpu0" |
| 75 | fi |
| 76 | ;; |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 77 | esac |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 78 | done |
| 79 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 80 | if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame] | 81 | echo "persist flag is not supported while running all tests!" |
| 82 | exit 1 |
| 83 | fi |
| 84 | |
| 85 | if [ $unconfigure_set -eq 1 ] && [ $single_test -eq 0 ]; then |
| 86 | echo "a single test has to be specified when unconfigure is set" |
| 87 | exit 1 |
| 88 | fi |
| 89 | |
| 90 | if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then |
| 91 | echo "setting persist flag and unconfigure flag is not allowed" |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 92 | exit 1 |
| 93 | fi |
| 94 | |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 95 | if [ $single_test -eq 0 ] && [ $debug_set -eq 1 ]; then |
Adrian Villin | b4516bb | 2024-06-19 06:20:00 -0400 | [diff] [blame] | 96 | echo "VPP debug flag is not supported while running all tests!" |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 97 | exit 1 |
| 98 | fi |
| 99 | |
Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 100 | mkdir -p summary |
Dave Wallace | bee28af | 2024-06-14 14:59:38 -0400 | [diff] [blame] | 101 | # shellcheck disable=SC2086 |
Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 102 | 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] | 103 | |
Adrian Villin | 6d44aab | 2024-06-26 10:08:47 +0200 | [diff] [blame] | 104 | 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] | 105 | && echo "Summary generated -> summary/failed-summary.log" |