blob: 9b18e1b79492840f701393166e88eb4f020dba9b [file] [log] [blame]
Filip Tehlar229f5fc2022-08-09 14:44:47 +00001#!/usr/bin/env bash
2
3source vars
Maros Ondrejicka87531802022-12-19 20:35:27 +01004
Filip Tehlar671cf512023-01-31 10:34:18 +01005args=
6single_test=0
7persist_set=0
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +01008unconfigure_set=0
Filip Tehlarec5c40b2023-02-28 18:59:15 +01009debug_set=0
Filip Tehlar109f3ce2023-09-05 15:36:28 +020010vppsrc=
Adrian Villincee15aa2024-03-14 11:42:55 -040011ginkgo_args=
12parallel=
Filip Tehlar671cf512023-01-31 10:34:18 +010013
14for i in "$@"
Maros Ondrejicka87531802022-12-19 20:35:27 +010015do
Filip Tehlar671cf512023-01-31 10:34:18 +010016case "${i}" in
17 --persist=*)
18 persist="${i#*=}"
19 if [ $persist = "true" ]; then
20 args="$args -persist"
21 persist_set=1
22 fi
23 ;;
Filip Tehlarec5c40b2023-02-28 18:59:15 +010024 --debug=*)
25 debug="${i#*=}"
26 if [ $debug = "true" ]; then
27 args="$args -debug"
28 debug_set=1
29 fi
30 ;;
Filip Tehlar671cf512023-01-31 10:34:18 +010031 --verbose=*)
32 verbose="${i#*=}"
33 if [ $verbose = "true" ]; then
34 args="$args -verbose"
35 fi
36 ;;
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +010037 --unconfigure=*)
38 unconfigure="${i#*=}"
39 if [ $unconfigure = "true" ]; then
40 args="$args -unconfigure"
41 unconfigure_set=1
42 fi
43 ;;
Filip Tehlar608d0062023-04-28 10:29:47 +020044 --cpus=*)
45 args="$args -cpus ${i#*=}"
46 ;;
Filip Tehlar109f3ce2023-09-05 15:36:28 +020047 --vppsrc=*)
48 args="$args -vppsrc ${i#*=}"
49 ;;
Filip Tehlar671cf512023-01-31 10:34:18 +010050 --test=*)
51 tc_name="${i#*=}"
52 if [ $tc_name != "all" ]; then
53 single_test=1
Adrian Villincee15aa2024-03-14 11:42:55 -040054 ginkgo_args="$ginkgo_args --focus $tc_name -vv"
55 args="$args -verbose"
56 else
57 ginkgo_args="$ginkgo_args -v"
Filip Tehlar671cf512023-01-31 10:34:18 +010058 fi
Adrian Villincee15aa2024-03-14 11:42:55 -040059 ;;
60 --parallel=*)
61 ginkgo_args="$ginkgo_args -procs=${i#*=}"
Filip Tehlar671cf512023-01-31 10:34:18 +010062esac
Maros Ondrejicka87531802022-12-19 20:35:27 +010063done
64
Filip Tehlar671cf512023-01-31 10:34:18 +010065if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +010066 echo "persist flag is not supported while running all tests!"
67 exit 1
68fi
69
70if [ $unconfigure_set -eq 1 ] && [ $single_test -eq 0 ]; then
71 echo "a single test has to be specified when unconfigure is set"
72 exit 1
73fi
74
75if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then
76 echo "setting persist flag and unconfigure flag is not allowed"
Filip Tehlar671cf512023-01-31 10:34:18 +010077 exit 1
78fi
79
Filip Tehlarec5c40b2023-02-28 18:59:15 +010080if [ $single_test -eq 0 ] && [ $debug_set -eq 1 ]; then
81 echo "VPP debug flag is not supperted while running all tests!"
82 exit 1
83fi
84
Adrian Villincee15aa2024-03-14 11:42:55 -040085sudo -E go run github.com/onsi/ginkgo/v2/ginkgo --trace $ginkgo_args -- $args