blob: 4ae2624d335f0a29165ffb9be4e8add37170db2c [file] [log] [blame]
Lev Walkincb523912017-09-30 19:33:23 -07001#!/bin/sh
2
3#
4# Create an ASN.1 source code project for each line in each of the
5# bundles/*.txt files, compile and run that it can be encoded, decoded,
6# and fuzzed (if fuzzing is available).
7#
8
9set -e
10
Lev Walkincb523912017-09-30 19:33:23 -070011usage() {
12 echo "Usage:"
13 echo " $0 -h"
Lev Walkin93f372b2017-10-03 16:39:38 -070014 echo " $0 [--dirty] -t \"<ASN.1 text defining type T, in string form>\""
15 echo " $0 [--dirty] bundles/<bundle-name.txt> [<line>]"
Lev Walkin8cec5232017-10-03 15:05:54 -070016 echo "Where options are:"
Lev Walkin43292722017-10-05 00:33:32 -070017 echo " -h Show this help screen"
18 echo " -e <syntax> Verify a given encoding explicitly (default is ALL)"
19 echo " --asn1c <flag> Add this flag to asn1c"
20 echo " --dirty Reuse compile results from the previous run(s)"
21 echo " -t <ASN.1> Run this particular typel"
Lev Walkincb523912017-09-30 19:33:23 -070022 echo "Examples:"
23 echo " $0 -t UTF8String"
24 echo " $0 -t \"T ::= INTEGER (0..1)\""
25 echo " $0 bundles/01-INTEGER-bundle.txt 3"
26 exit 1
27}
28
Lev Walkin40b8a7a2017-10-08 22:36:29 -070029RNDTEMP="${RNDTEMP:-.tmp.random}"
Lev Walkind3cce462017-10-01 13:43:36 -070030
31srcdir="${srcdir:-.}"
Lev Walkin39936ce2017-10-05 23:56:39 -070032abs_top_srcdir="${abs_top_srcdir:-`pwd`/../../}"
33abs_top_builddir="${abs_top_builddir:-`pwd`/../../}"
Lev Walkind0d63922017-10-10 01:27:37 -070034MAKE="${MAKE:-make}"
35FUZZ_TIME="${FUZZ_TIME:-10}"
Lev Walkind3cce462017-10-01 13:43:36 -070036
Lev Walkincb523912017-09-30 19:33:23 -070037tests_succeeded=0
38tests_failed=0
Lev Walkind3cce462017-10-01 13:43:36 -070039stop_after_failed=1 # We stop after 3 failures.
Lev Walkin8cec5232017-10-03 15:05:54 -070040need_clean_before_bundle=1 # Clean before testing a bundle file
Lev Walkin7c470c72017-10-08 04:01:45 -070041need_clean_before_test=0 # Before each line in a bundle file
Lev Walkin68619bf2017-10-03 18:40:36 -070042encodings="" # Default is to verify all supported ASN.1 transfer syntaxes
Lev Walkin40b8a7a2017-10-08 22:36:29 -070043parallelism=1
Lev Walkin43292722017-10-05 00:33:32 -070044asn1c_flags=""
Lev Walkin8cec5232017-10-03 15:05:54 -070045
46make_clean_before_bundle() {
Lev Walkinab25f192017-10-08 12:50:43 -070047 if [ "${need_clean_before_bundle}" = "1" ] ; then
Lev Walkinac6db172017-10-10 00:31:06 -070048 (cd "${RNDTEMP}" && Make clean) || :
Lev Walkinab25f192017-10-08 12:50:43 -070049 fi
Lev Walkin8cec5232017-10-03 15:05:54 -070050}
51
52make_clean_before_test() {
Lev Walkin60d62672017-10-08 03:16:10 -070053 if [ "${need_clean_before_test}" = "1" ] ; then
54 Make clean
55 fi
Lev Walkin8cec5232017-10-03 15:05:54 -070056}
Lev Walkincb523912017-09-30 19:33:23 -070057
58# Get all the type-bearding lines in file and process them individually
59verify_asn_types_in_file() {
Lev Walkin39936ce2017-10-05 23:56:39 -070060 filename="$1"
61 need_line="$2"
Lev Walkincb523912017-09-30 19:33:23 -070062 test "x$filename" != "x" || usage
Lev Walkin8cec5232017-10-03 15:05:54 -070063
64 make_clean_before_bundle
65
Lev Walkincb523912017-09-30 19:33:23 -070066 echo "Open [$filename]"
Lev Walkina460cbd2017-10-20 02:18:04 -070067 for mode in syntax full; do
68 if [ "x${mode}" = "xsyntax" ]; then
69 max_failures=1
70 else
71 max_failures="${stop_after_failed}"
72 fi
73
74 line=0
75 while read asn; do
Lev Walkin61b4be02017-10-18 16:37:51 -070076 line=`expr ${line} + 1`
Lev Walkin39936ce2017-10-05 23:56:39 -070077 if echo "$asn" | sed -e 's/--.*//;' | grep -vi "[A-Z]" > /dev/null; then
Lev Walkincb523912017-09-30 19:33:23 -070078 # Ignore lines consisting of just comments.
79 continue;
80 fi
Lev Walkind28b45f2017-10-05 22:09:19 -070081 if [ "x$need_line" != "x" ] && [ "$need_line" != "$line" ]; then
Lev Walkincb523912017-09-30 19:33:23 -070082 # We need a different line.
83 continue;
84 fi
Lev Walkina460cbd2017-10-20 02:18:04 -070085 verify_asn_type "$mode" "$asn" "in $filename $line"
86 if [ "${tests_failed}" = "${max_failures}" ]; then
Lev Walkind3cce462017-10-01 13:43:36 -070087 echo "STOP after ${tests_failed} failures, OK ${tests_succeeded}"
88 exit 1
89 fi
Lev Walkina460cbd2017-10-20 02:18:04 -070090 done < "$filename"
91 done
Lev Walkincb523912017-09-30 19:33:23 -070092}
93
94verify_asn_type() {
Lev Walkina460cbd2017-10-20 02:18:04 -070095 mode="$1"
96 asn="$2"
97 where="$3"
98 shift 3
Lev Walkincb523912017-09-30 19:33:23 -070099 test "x$asn" != "x" || usage
Lev Walkin8cec5232017-10-03 15:05:54 -0700100
Lev Walkin39936ce2017-10-05 23:56:39 -0700101 if echo "$asn" | grep -v "::=" > /dev/null; then
Lev Walkincb523912017-09-30 19:33:23 -0700102 asn="T ::= $asn"
103 fi
104 echo "Testing [$asn] ${where}"
105
Lev Walkind3cce462017-10-01 13:43:36 -0700106 mkdir -p ${RNDTEMP}
Lev Walkina460cbd2017-10-20 02:18:04 -0700107
108 if [ "x${mode}" = "xsyntax" ]; then
109 if asn1c_invoke "${RNDTEMP}/test.asn1" "$asn" "$where" -P 2>&1 >/dev/null; then
110 return 0
111 else
112 tests_failed=`expr ${tests_failed} + 1`
113 echo "FAIL: ASN.1 ERROR ${where}"
114 return 1
115 fi
116 fi
117
Lev Walkinac6db172017-10-10 00:31:06 -0700118 if (set -e && cd "${RNDTEMP}" && compile_and_test "$asn" "${where}"); then
Lev Walkincb523912017-09-30 19:33:23 -0700119 echo "OK [$asn] ${where}"
Lev Walkin61b4be02017-10-18 16:37:51 -0700120 tests_succeeded=`expr ${tests_succeeded} + 1`
Lev Walkincb523912017-09-30 19:33:23 -0700121 else
Lev Walkin61b4be02017-10-18 16:37:51 -0700122 tests_failed=`expr ${tests_failed} + 1`
Lev Walkincb523912017-09-30 19:33:23 -0700123 echo "FAIL [$asn] ${where}"
124 fi
125}
126
Lev Walkin39936ce2017-10-05 23:56:39 -0700127Make() {
Lev Walkind0d63922017-10-10 01:27:37 -0700128 ${MAKE} -j "${parallelism}" "$@" || return $?
Lev Walkin39936ce2017-10-05 23:56:39 -0700129}
130
131get_param() {
132 param="$1"
133 default="$2"
Lev Walkinebeb4012017-10-09 19:51:26 -0700134 asn="$3"
Lev Walkin39936ce2017-10-05 23:56:39 -0700135
Lev Walkinebeb4012017-10-09 19:51:26 -0700136 if nawk '' >/dev/null 2>&1 ; then
137 AWK=nawk
138 else
139 AWK=awk
140 fi
Lev Walkin39936ce2017-10-05 23:56:39 -0700141
Lev Walkinebeb4012017-10-09 19:51:26 -0700142 echo "$asn" | ${AWK} "BEGIN{FS=\"[^${param}=0-9]+\"};/$param=/{for(i=1;i<=NF;i++)if(substr(\$i,0,length(\"${param}=\"))==\"${param}=\")PARAM=substr(\$i,length(\"${param}=\")+1)}END{if(PARAM)print PARAM;else print \"${default}\";}"
Lev Walkin39936ce2017-10-05 23:56:39 -0700143}
144
Lev Walkin7c470c72017-10-08 04:01:45 -0700145# compile_and_test "<text>" "<where found>"
Lev Walkinac6db172017-10-10 00:31:06 -0700146# This function is executed in the temporary test directory ${RNDTEMP}.
Lev Walkin7c470c72017-10-08 04:01:45 -0700147compile_and_test() {
Lev Walkin39936ce2017-10-05 23:56:39 -0700148 asn="$1"
149 where="$2"
Lev Walkin43292722017-10-05 00:33:32 -0700150
Lev Walkinac6db172017-10-10 00:31:06 -0700151 if [ "x$CC" = "x" ]; then CCSTR=""; else CCSTR="CC=${CC} "; fi
Lev Walkind0d63922017-10-10 01:27:37 -0700152 reproduce_make="cd \"${RNDTEMP}\" && ${CCSTR}CFLAGS=\"${CFLAGS}\" ${MAKE}"
Lev Walkinac6db172017-10-10 00:31:06 -0700153
154 env > .test-environment
155 set > .test-set
156
Lev Walkin43292722017-10-05 00:33:32 -0700157 make_clean_before_test
158
Lev Walkin7c470c72017-10-08 04:01:45 -0700159 asn_compile "$asn" "$where"
Lev Walkin39936ce2017-10-05 23:56:39 -0700160 if [ $? -ne 0 ]; then
Lev Walkincb523912017-09-30 19:33:23 -0700161 echo "Cannot compile ASN.1 $asn"
162 return 1
163 fi
164
165 rm -f random-test-driver.o
166 rm -f random-test-driver
Lev Walkin60d62672017-10-08 03:16:10 -0700167 CFLAGS="${CFLAGS}" Make
Lev Walkin39936ce2017-10-05 23:56:39 -0700168 if [ $? -ne 0 ] ; then
Lev Walkind3cce462017-10-01 13:43:36 -0700169 echo "Cannot compile C for $asn in ${RNDTEMP}"
Lev Walkincb523912017-09-30 19:33:23 -0700170 return 2
171 fi
172
Lev Walkin791d3b72017-10-02 16:24:28 -0700173 # Maximum size of the random data
Lev Walkin39936ce2017-10-05 23:56:39 -0700174 rmax=`get_param RMAX 128 "$asn"`
Lev Walkin791d3b72017-10-02 16:24:28 -0700175 if [ "0${rmax}" -lt 1 ]; then rmax=128; fi
176
Lev Walkincb523912017-09-30 19:33:23 -0700177 echo "Checking random data encode-decode"
Lev Walkin39936ce2017-10-05 23:56:39 -0700178 round_trip_check_cmd="${ASAN_ENV_FLAGS} ./random-test-driver -s ${rmax} ${encodings} -c"
Lev Walkinac6db172017-10-10 00:31:06 -0700179 echo "(${reproduce_make} && ${round_trip_check_cmd})" > .test-reproduce
Lev Walkin39936ce2017-10-05 23:56:39 -0700180 if eval "$round_trip_check_cmd"; then
181 echo "Random test OK"
182 else
Lev Walkinac6db172017-10-10 00:31:06 -0700183 { echo "RETRY:"; cat .test-reproduce ; }
Lev Walkincb523912017-09-30 19:33:23 -0700184 return 3
185 fi
186
Lev Walkind3cce462017-10-01 13:43:36 -0700187 echo "Generating new random data"
188 rm -rf random-data
189 cmd="${ASAN_ENV_FLAGS} UBSAN_OPTIONS=print_stacktrace=1"
Lev Walkind28b45f2017-10-05 22:09:19 -0700190 cmd="${cmd} ./random-test-driver -s ${rmax} ${encodings} -g random-data"
Lev Walkinac6db172017-10-10 00:31:06 -0700191 echo "(${reproduce_make} && ${cmd})" > .test-reproduce
Lev Walkin39936ce2017-10-05 23:56:39 -0700192 if eval "$cmd" ; then
193 echo "Random data generated OK"
194 else
Lev Walkinac6db172017-10-10 00:31:06 -0700195 { echo "RETRY:"; cat .test-reproduce ; }
Lev Walkind3cce462017-10-01 13:43:36 -0700196 return 4
197 fi
198
Lev Walkin233d14d2017-10-02 01:09:01 -0700199 # Do a LibFuzzer based testing
Lev Walkin39936ce2017-10-05 23:56:39 -0700200 fuzz_cmd="${ASAN_ENV_FLAGS} UBSAN_OPTIONS=print_stacktrace=1"
Lev Walkind28b45f2017-10-05 22:09:19 -0700201 fuzz_cmd="${fuzz_cmd} ./random-test-driver"
Lev Walkind0d63922017-10-10 01:27:37 -0700202 fuzz_cmd="${fuzz_cmd} -timeout=3 -max_total_time=${FUZZ_TIME} -max_len=128"
Lev Walkin233d14d2017-10-02 01:09:01 -0700203
Lev Walkin39936ce2017-10-05 23:56:39 -0700204 if grep "^fuzz:" Makefile >/dev/null ; then
205 echo "No fuzzer defined, skipping fuzzing"
206 else
207 fuzz_targets=`echo random-data/* | sed -e 's/random-data./fuzz-/g'`
Lev Walkind28b45f2017-10-05 22:09:19 -0700208 {
209 echo "fuzz: $fuzz_targets"
210 echo "fuzz-%: random-data/% random-test-driver"
211 echo " ASN1_DATA_DIR=\$< ${fuzz_cmd} \$<"
212 } >> Makefile
Lev Walkin233d14d2017-10-02 01:09:01 -0700213 fi
214
Lev Walkincb523912017-09-30 19:33:23 -0700215 # If LIBFUZZER_CFLAGS are properly defined, do the fuzz test as well
Lev Walkin39936ce2017-10-05 23:56:39 -0700216 if echo "${LIBFUZZER_CFLAGS}" | grep -i "[a-z]" > /dev/null; then
Lev Walkincb523912017-09-30 19:33:23 -0700217
218 echo "Recompiling for fuzzing..."
219 rm -f random-test-driver.o
220 rm -f random-test-driver
Lev Walkind0d63922017-10-10 01:27:37 -0700221 reproduce_make="cd \"${RNDTEMP}\" && ${CCSTR}CFLAGS=\"${LIBFUZZER_CFLAGS} ${CFLAGS}\" ${MAKE}"
Lev Walkinac6db172017-10-10 00:31:06 -0700222 echo "(${reproduce_make})" > .test-reproduce
Lev Walkin39936ce2017-10-05 23:56:39 -0700223 CFLAGS="${LIBFUZZER_CFLAGS} ${CFLAGS}" Make
224 if [ $? -ne 0 ]; then
225 echo "Recompile failed"
226 return 4
227 fi
Lev Walkincb523912017-09-30 19:33:23 -0700228
Lev Walkind0d63922017-10-10 01:27:37 -0700229 echo "Fuzzing will take a multiple of ${FUZZ_TIME} seconds..."
Lev Walkinac6db172017-10-10 00:31:06 -0700230 echo "(${reproduce_make} fuzz)" > .test-reproduce
231 CFLAGS="${LIBFUZZER_CFLAGS} ${CFLAGS}" Make fuzz
Lev Walkin39936ce2017-10-05 23:56:39 -0700232 if [ $? -ne 0 ]; then
Lev Walkinac6db172017-10-10 00:31:06 -0700233 { echo "RETRY:"; cat .test-reproduce ; }
Lev Walkin233d14d2017-10-02 01:09:01 -0700234 return 5
235 fi
Lev Walkincb523912017-09-30 19:33:23 -0700236 fi
237
Lev Walkina5b02882017-10-01 22:48:44 -0700238 return 0
Lev Walkincb523912017-09-30 19:33:23 -0700239}
240
Lev Walkina460cbd2017-10-20 02:18:04 -0700241asn1c_invoke() {
242 tmpfile="$1"
243 asn="$2"
244 where="$3"
245 shift 3
246
247 {
248 echo "Test DEFINITIONS ::= BEGIN $asn"
249 echo "-- ${where}"
250 echo "END"
251 } > ${tmpfile}
252 echo "${abs_top_builddir}/asn1c/asn1c -S ${abs_top_srcdir}/skeletons"
253 if "${abs_top_builddir}/asn1c/asn1c" -S "${abs_top_srcdir}/skeletons" \
254 -gen-OER -gen-PER ${asn1c_flags} $@ ${tmpfile}
255 then
256 echo "ASN.1 compiled OK"
257 else
258 return 1
259 fi
260}
261
Lev Walkincb523912017-09-30 19:33:23 -0700262asn_compile() {
Lev Walkin39936ce2017-10-05 23:56:39 -0700263 asn="$1"
264 where="$2"
Lev Walkind3cce462017-10-01 13:43:36 -0700265
Lev Walkin5d947a82017-10-03 01:04:03 -0700266 # Create "INTEGER (1..2)" from "T ::= INTEGER (1..2) -- RMAX=5"
Lev Walkinebeb4012017-10-09 19:51:26 -0700267 short_asn=`echo "$asn" | sed -e 's/ *--.*//;s/RMAX=[0-9]//;'`
Lev Walkin39936ce2017-10-05 23:56:39 -0700268 if [ `echo "$short_asn" | grep -c "::="` = 1 ]; then
269 short_asn=`echo "$short_asn" | sed -e 's/.*::= *//'`
Lev Walkind3cce462017-10-01 13:43:36 -0700270 fi
271
Lev Walkincb523912017-09-30 19:33:23 -0700272 test ! -f Makefile.am # Protection from accidental clobbering
Lev Walkina460cbd2017-10-20 02:18:04 -0700273
274 asn1c_invoke "test.asn1" "$asn" "$where" "-flink-skeletons"
275 if [ $? != 0 ]; then
Lev Walkina5b02882017-10-01 22:48:44 -0700276 return 1
277 fi
Lev Walkina460cbd2017-10-20 02:18:04 -0700278
Lev Walkincb523912017-09-30 19:33:23 -0700279 rm -f converter-example.c
Lev Walkin09be69c2017-10-08 16:28:11 -0700280 ln -sf "../${srcdir}/random-test-driver.c" || cp "../${srcdir}/random-test-driver.c" .
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700281 {
282 echo "CFLAGS+= -DASN1_TEXT='$short_asn'";
283 echo "ASN_PROGRAM = random-test-driver"
284 echo "ASN_PROGRAM_SOURCES = random-test-driver.c"
Lev Walkinac6db172017-10-10 00:31:06 -0700285 echo
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700286 echo "include Makefile.am.example"
Lev Walkinac6db172017-10-10 00:31:06 -0700287 echo
288 echo "all-tests-succeeded: ${abs_top_builddir}/asn1c/asn1c \$(ASN_PROGRAM_SOURCES) \$(ASN_MODULE_SOURCES) \$(ASN_MODULE_HEADERS)"
289 echo " @rm -f \$@"
290 echo " @echo Previous try did not go correctly. To reproduce:"
291 echo " @cat .test-reproduce"
292 echo " @exit 1"
293 echo
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700294 } > Makefile
Lev Walkincb523912017-09-30 19:33:23 -0700295 echo "Makefile.am.example -> Makefile"
296}
297
Lev Walkin7c470c72017-10-08 04:01:45 -0700298# Make up to four different passes:
299# CFLAGS: | asn1c_flags:
300# -m64 | -fnative-types
301# -m32 | -fnative-types
302# -m64 | -fwide-types
303# -m32 | -fwide-types
304# *) Of course, -m64 and -fnative-types are just implied.
305test_drive() {
306 func="$1"
307 shift
308
309 if [ "x${asn1c_flags}" = "x" ] ; then
310 # Test for native types and wide types
311 asn1c_flags=" " test_drive "${func}" "$@"
312 asn1c_flags="-fnative-types" test_drive "${func}" "$@"
313 return 0
314 fi
315
Lev Walkinac6db172017-10-10 00:31:06 -0700316 # Can't reuse object code.
317 rm -rf ${RNDTEMP}
318
Lev Walkin7c470c72017-10-08 04:01:45 -0700319 echo "MODE: default"
320 # Default (likely 64-bit) mode
321 ${func} "$@"
322
323 # 32-bit mode, if available
324 if echo "${CFLAGS_M32}" | grep -i '[a-z]' > /dev/null ; then
325 echo "MODE: 32-bit"
Lev Walkinac6db172017-10-10 00:31:06 -0700326
327 # Can't reuse object code between modes.
328 rm -rf ${RNDTEMP}
329
Lev Walkin7c470c72017-10-08 04:01:45 -0700330 # -m32 doesn't support fuzzing (no such library), so we remove fuzzer.
331 # -m32 doesn't support leak sanitizing (it hangs), so we remove
Lev Walkinac6db172017-10-10 00:31:06 -0700332 # ASAN_ENV_FLAGS which enable leak check in runtime.
Lev Walkin7c470c72017-10-08 04:01:45 -0700333 CFLAGS="${CFLAGS} ${CFLAGS_M32}" CFLAGS_M32="" \
334 LIBFUZZER_CFLAGS="" ASAN_ENV_FLAGS="" \
335 ${func} "$@"
336 fi
337}
338
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700339if echo "$*" | grep ' -- ' > /dev/null; then
340 TEST_DRIVER=`echo "$*" | sed -e 's/ -- .*/ -- /g'`
341 args=`echo "$*" | sed -e 's/.* //g'`
342 set "${args}"
343else
344 TEST_DRIVER=""
345fi
346
Lev Walkincb523912017-09-30 19:33:23 -0700347# Command line parsing
Lev Walkin68619bf2017-10-03 18:40:36 -0700348while :; do
349 case "$1" in
350 -h) usage ;;
Lev Walkind28b45f2017-10-05 22:09:19 -0700351 --asn1c) asn1c_flags="${asn1c_flags} $2"; shift 2; continue ;;
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700352 --bundle)
353 shift
Lev Walkinac6db172017-10-10 00:31:06 -0700354
355 # Look for the transcript in bundles/NN-*-bundles.txt.log
356 set -x
357
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700358 base=`basename "$1" | sed -e 's/.txt$//'`
359 RNDTEMP=".tmp.${base}"
Lev Walkinac6db172017-10-10 00:31:06 -0700360
361 if Make -C "${RNDTEMP}" all-tests-succeeded >/dev/null 2>&1 ; then
362 echo "Test succeeded before. Not rechecking."
363 tests_succeeded=1
364 break
365 fi
366
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700367 test_drive verify_asn_types_in_file "$@"
Lev Walkinac6db172017-10-10 00:31:06 -0700368
369 touch "${RNDTEMP}/all-tests-succeeded"
370
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700371 break
372 ;;
Lev Walkin68619bf2017-10-03 18:40:36 -0700373 --dirty)
374 need_clean_before_bundle=0
375 need_clean_before_test=0
376 shift
377 continue
378 ;;
Lev Walkind28b45f2017-10-05 22:09:19 -0700379 -e) encodings="${encodings} -e $2"; shift 2; continue;;
Lev Walkin68619bf2017-10-03 18:40:36 -0700380 -j) parallelism="$1"; shift 2; continue;;
381 -t)
Lev Walkina460cbd2017-10-20 02:18:04 -0700382 test_drive verify_asn_type "full" "$2" "(command line)" || exit 1 ;;
Lev Walkin68619bf2017-10-03 18:40:36 -0700383 "")
Lev Walkin09be69c2017-10-08 16:28:11 -0700384 for bundle in `ls -1 ${srcdir}/bundles/*.txt | sort -nr`; do
Lev Walkin7c470c72017-10-08 04:01:45 -0700385 test_drive verify_asn_types_in_file "$bundle"
Lev Walkin68619bf2017-10-03 18:40:36 -0700386 done
387 ;;
388 *)
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700389 exec ${TEST_DRIVER} $0 --bundle "$@"
Lev Walkin68619bf2017-10-03 18:40:36 -0700390 ;;
391 esac
392 break
393done
Lev Walkincb523912017-09-30 19:33:23 -0700394
Lev Walkind28b45f2017-10-05 22:09:19 -0700395if [ "$tests_succeeded" != "0" ] && [ "$tests_failed" = "0" ]; then
Lev Walkincb523912017-09-30 19:33:23 -0700396 echo "OK $tests_succeeded tests"
397else
398 echo "FAILED $tests_failed tests, OK $tests_succeeded tests"
399 exit 1
400fi