aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/test
blob: 9b18e1b79492840f701393166e88eb4f020dba9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env bash

source vars

args=
single_test=0
persist_set=0
unconfigure_set=0
debug_set=0
vppsrc=
ginkgo_args=
parallel=

for i in "$@"
do
case "${i}" in
    --persist=*)
        persist="${i#*=}"
        if [ $persist = "true" ]; then
            args="$args -persist"
            persist_set=1
        fi
        ;;
    --debug=*)
        debug="${i#*=}"
        if [ $debug = "true" ]; then
            args="$args -debug"
            debug_set=1
        fi
        ;;
    --verbose=*)
        verbose="${i#*=}"
        if [ $verbose = "true" ]; then
            args="$args -verbose"
        fi
        ;;
    --unconfigure=*)
        unconfigure="${i#*=}"
        if [ $unconfigure = "true" ]; then
            args="$args -unconfigure"
            unconfigure_set=1
        fi
        ;;
    --cpus=*)
        args="$args -cpus ${i#*=}"
        ;;
    --vppsrc=*)
        args="$args -vppsrc ${i#*=}"
        ;;
    --test=*)
        tc_name="${i#*=}"
        if [ $tc_name != "all" ]; then
            single_test=1
            ginkgo_args="$ginkgo_args --focus $tc_name -vv"
            args="$args -verbose"
        else
            ginkgo_args="$ginkgo_args -v"
        fi
        ;;
    --parallel=*)
        ginkgo_args="$ginkgo_args -procs=${i#*=}"
esac
done

if [ $single_test -eq 0 ] && [ $persist_set -eq 1 ]; then
    echo "persist flag is not supported while running all tests!"
    exit 1
fi

if [ $unconfigure_set -eq 1 ] && [ $single_test -eq 0 ]; then
    echo "a single test has to be specified when unconfigure is set"
    exit 1
fi

if [ $persist_set -eq 1 ] && [ $unconfigure_set -eq 1 ]; then
    echo "setting persist flag and unconfigure flag is not allowed"
    exit 1
fi

if [ $single_test -eq 0 ] && [ $debug_set -eq 1 ]; then
    echo "VPP debug flag is not supperted while running all tests!"
    exit 1
fi

sudo -E go run github.com/onsi/ginkgo/v2/ginkgo --trace $ginkgo_args -- $args