event/cnxk: fix clang build on Arm
[dpdk.git] / examples / ipsec-secgw / test / load_env.sh
1 #! /bin/bash
2 # SPDX-License-Identifier: BSD-3-Clause
3
4 DIR=`dirname $0`
5
6 regular=0
7 inline_on=0
8 fallback_on=0
9 legacy_only=0
10 fallback_val="lookaside-none"
11 crypto_prim=""
12 multi_seg_val=""
13 while getopts ":iflsrc" opt
14 do
15         case $opt in
16                 i)
17                         inline_on=1
18                         ;;
19                 f)
20                         fallback_on=1
21                         ;;
22                 l)
23                         legacy_only=1
24                         ;;
25                 s)
26                         multi_seg_val="SGW_MULTI_SEG=128"
27                         ;;
28                 r)
29                         regular=1
30                         ;;
31                 c)
32                         crypto_prim="CRYPTO_PRIM_TYPE=cpu-crypto"
33                         fallback_val="cpu-crypto"
34                         ;;
35         esac
36 done
37 shift $((OPTIND -1))
38
39 PROTO=$1
40 MODE=$2
41
42 # test scenarios to set up for regular test
43 TEST_MODES_REGULAR="legacy \
44 library \
45 library_esn \
46 library_esn_atom"
47
48 # test scenarios to set up for inline test
49 TEST_MODES_INLINE="legacy_inline \
50 library_inline"
51
52 # test scenarios to set up for fallback test
53 TEST_MODES_FALLBACK="library_fallback"
54
55 # env variables to export for specific test scenarios
56 default="SGW_MODE=legacy SGW_ESN=esn-off SGW_ATOM=atom-off SGW_CRYPTO=regular \
57 SGW_CRYPTO_FLBK= ${multi_seg_val}"
58 legacy="${default} CRYPTO_PRIM_TYPE="
59 library="${default} SGW_MODE=library ${crypto_prim}"
60 library_esn="${default} SGW_MODE=library SGW_ESN=esn-on ${crypto_prim}"
61 library_esn_atom="${default} SGW_MODE=library SGW_ESN=esn-on SGW_ATOM=atom-on \
62 ${crypto_prim}"
63 legacy_inline="${default} SGW_CRYPTO=inline CRYPTO_PRIM_TYPE="
64 library_inline="${default} SGW_MODE=library SGW_CRYPTO=inline CRYPTO_PRIM_TYPE="
65 library_fallback="${default} SGW_MODE=library SGW_CRYPTO=inline \
66 SGW_CRYPTO_FLBK=${fallback_val} SGW_MULTI_SEG=128 CRYPTO_PRIM_TYPE="
67
68 # export needed env variables and run tests
69 if [[ ${regular} -eq 1 ]]; then
70         for i in ${TEST_MODES_REGULAR}; do
71                 if [[ ${legacy_only} -eq 1 && "${i}" != *legacy* ]]; then
72                         continue
73                 elif [[ ${legacy_only} -eq 0 && "${i}" == *legacy* ]]; then
74                         continue
75                 fi
76                 for x in ${!i}; do
77                         export ${x}
78                 done
79
80                 /bin/bash ${DIR}/linux_test.sh ${PROTO} ${MODE}
81                 st=$?
82                 if [[ ${st} -ne 0 ]]; then
83                         exit ${st}
84                 fi
85         done
86 elif [[ ${inline_on} -eq 1 || ${fallback_on} -eq 1 ]]; then
87         if [[ ${inline_on} -eq 1 ]]; then
88                 for i in ${TEST_MODES_INLINE}; do
89                         if [[ ${legacy_only} -eq 1 && "${i}" != *legacy* ]]
90                         then
91                                 continue
92                         elif [[ ${legacy_only} -eq 0 && "${i}" == *legacy* ]]
93                         then
94                                 continue
95                         fi
96                         for x in ${!i}; do
97                                 export ${x}
98                         done
99
100                         /bin/bash ${DIR}/linux_test.sh ${PROTO} ${MODE}
101                         st=$?
102                         if [[ ${st} -ne 0 ]]; then
103                                 exit ${st}
104                         fi
105                 done
106         fi
107         if [[ ${fallback_on} -eq 1 ]]; then
108                 for i in ${TEST_MODES_FALLBACK}; do
109                         for x in ${!i}; do
110                                 export ${x}
111                         done
112
113                         /bin/bash ${DIR}/linux_test.sh ${PROTO} ${MODE}
114                         st=$?
115                         if [[ ${st} -ne 0 ]]; then
116                                 exit ${st}
117                         fi
118                 done
119         fi
120 fi
121 exit 0