blob: 5cf892fc625dcb1bea414eca23c8fed0ef685e88 [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 Walkince2068a2017-11-05 21:08:57 -080034abs_builddir="${abs_builddir:-`pwd`}"
35export abs_builddir
Lev Walkind0d63922017-10-10 01:27:37 -070036MAKE="${MAKE:-make}"
37FUZZ_TIME="${FUZZ_TIME:-10}"
Lev Walkind3cce462017-10-01 13:43:36 -070038
Lev Walkincb523912017-09-30 19:33:23 -070039tests_succeeded=0
40tests_failed=0
Lev Walkind3cce462017-10-01 13:43:36 -070041stop_after_failed=1 # We stop after 3 failures.
Lev Walkin8cec5232017-10-03 15:05:54 -070042need_clean_before_bundle=1 # Clean before testing a bundle file
Lev Walkin7c470c72017-10-08 04:01:45 -070043need_clean_before_test=0 # Before each line in a bundle file
Lev Walkin68619bf2017-10-03 18:40:36 -070044encodings="" # Default is to verify all supported ASN.1 transfer syntaxes
Lev Walkin40b8a7a2017-10-08 22:36:29 -070045parallelism=1
Lev Walkin43292722017-10-05 00:33:32 -070046asn1c_flags=""
Lev Walkin8cec5232017-10-03 15:05:54 -070047
48make_clean_before_bundle() {
Lev Walkinab25f192017-10-08 12:50:43 -070049 if [ "${need_clean_before_bundle}" = "1" ] ; then
Lev Walkinac6db172017-10-10 00:31:06 -070050 (cd "${RNDTEMP}" && Make clean) || :
Lev Walkinab25f192017-10-08 12:50:43 -070051 fi
Lev Walkin8cec5232017-10-03 15:05:54 -070052}
53
54make_clean_before_test() {
Lev Walkin60d62672017-10-08 03:16:10 -070055 if [ "${need_clean_before_test}" = "1" ] ; then
56 Make clean
Lev Walkinf22184d2017-10-27 18:40:32 -070057 else
58 # Low resolution file system mtime prevents rapid testing
59 # without recompilation. We have to clean at least the most
60 # critical portion of the objects. This will reach our objective
61 # of fast compile times (since most of skeletons are not recompiled),
62 # but won't yield a stale T.o object where newer T.c source exists.
63 rm -f T.o || :
Lev Walkin60d62672017-10-08 03:16:10 -070064 fi
Lev Walkin8cec5232017-10-03 15:05:54 -070065}
Lev Walkincb523912017-09-30 19:33:23 -070066
67# Get all the type-bearding lines in file and process them individually
68verify_asn_types_in_file() {
Lev Walkin39936ce2017-10-05 23:56:39 -070069 filename="$1"
70 need_line="$2"
Lev Walkincb523912017-09-30 19:33:23 -070071 test "x$filename" != "x" || usage
Lev Walkin8cec5232017-10-03 15:05:54 -070072
73 make_clean_before_bundle
74
Lev Walkincb523912017-09-30 19:33:23 -070075 echo "Open [$filename]"
Lev Walkina460cbd2017-10-20 02:18:04 -070076 for mode in syntax full; do
77 if [ "x${mode}" = "xsyntax" ]; then
78 max_failures=1
79 else
80 max_failures="${stop_after_failed}"
81 fi
82
83 line=0
84 while read asn; do
Lev Walkin61b4be02017-10-18 16:37:51 -070085 line=`expr ${line} + 1`
Lev Walkin39936ce2017-10-05 23:56:39 -070086 if echo "$asn" | sed -e 's/--.*//;' | grep -vi "[A-Z]" > /dev/null; then
Lev Walkincb523912017-09-30 19:33:23 -070087 # Ignore lines consisting of just comments.
88 continue;
89 fi
Lev Walkind28b45f2017-10-05 22:09:19 -070090 if [ "x$need_line" != "x" ] && [ "$need_line" != "$line" ]; then
Lev Walkincb523912017-09-30 19:33:23 -070091 # We need a different line.
92 continue;
93 fi
Lev Walkina460cbd2017-10-20 02:18:04 -070094 verify_asn_type "$mode" "$asn" "in $filename $line"
95 if [ "${tests_failed}" = "${max_failures}" ]; then
Lev Walkind3cce462017-10-01 13:43:36 -070096 echo "STOP after ${tests_failed} failures, OK ${tests_succeeded}"
97 exit 1
98 fi
Lev Walkina460cbd2017-10-20 02:18:04 -070099 done < "$filename"
100 done
Lev Walkincb523912017-09-30 19:33:23 -0700101}
102
103verify_asn_type() {
Lev Walkina460cbd2017-10-20 02:18:04 -0700104 mode="$1"
105 asn="$2"
106 where="$3"
107 shift 3
Lev Walkincb523912017-09-30 19:33:23 -0700108 test "x$asn" != "x" || usage
Lev Walkin8cec5232017-10-03 15:05:54 -0700109
Lev Walkin39936ce2017-10-05 23:56:39 -0700110 if echo "$asn" | grep -v "::=" > /dev/null; then
Lev Walkincb523912017-09-30 19:33:23 -0700111 asn="T ::= $asn"
112 fi
113 echo "Testing [$asn] ${where}"
114
Lev Walkind3cce462017-10-01 13:43:36 -0700115 mkdir -p ${RNDTEMP}
Lev Walkina460cbd2017-10-20 02:18:04 -0700116
117 if [ "x${mode}" = "xsyntax" ]; then
118 if asn1c_invoke "${RNDTEMP}/test.asn1" "$asn" "$where" -P 2>&1 >/dev/null; then
119 return 0
120 else
121 tests_failed=`expr ${tests_failed} + 1`
122 echo "FAIL: ASN.1 ERROR ${where}"
123 return 1
124 fi
125 fi
126
Lev Walkinac6db172017-10-10 00:31:06 -0700127 if (set -e && cd "${RNDTEMP}" && compile_and_test "$asn" "${where}"); then
Lev Walkincb523912017-09-30 19:33:23 -0700128 echo "OK [$asn] ${where}"
Lev Walkin61b4be02017-10-18 16:37:51 -0700129 tests_succeeded=`expr ${tests_succeeded} + 1`
Lev Walkincb523912017-09-30 19:33:23 -0700130 else
Lev Walkin61b4be02017-10-18 16:37:51 -0700131 tests_failed=`expr ${tests_failed} + 1`
Lev Walkincb523912017-09-30 19:33:23 -0700132 echo "FAIL [$asn] ${where}"
133 fi
134}
135
Lev Walkin39936ce2017-10-05 23:56:39 -0700136Make() {
Lev Walkind0d63922017-10-10 01:27:37 -0700137 ${MAKE} -j "${parallelism}" "$@" || return $?
Lev Walkin39936ce2017-10-05 23:56:39 -0700138}
139
140get_param() {
141 param="$1"
142 default="$2"
Lev Walkinebeb4012017-10-09 19:51:26 -0700143 asn="$3"
Lev Walkin39936ce2017-10-05 23:56:39 -0700144
Lev Walkince2068a2017-11-05 21:08:57 -0800145 "${abs_builddir}/test-param-helper" "${param}" "${default}" "${asn}"
Lev Walkin39936ce2017-10-05 23:56:39 -0700146}
147
Lev Walkin7c470c72017-10-08 04:01:45 -0700148# compile_and_test "<text>" "<where found>"
Lev Walkinac6db172017-10-10 00:31:06 -0700149# This function is executed in the temporary test directory ${RNDTEMP}.
Lev Walkin7c470c72017-10-08 04:01:45 -0700150compile_and_test() {
Lev Walkin39936ce2017-10-05 23:56:39 -0700151 asn="$1"
152 where="$2"
Lev Walkin43292722017-10-05 00:33:32 -0700153
Lev Walkinac6db172017-10-10 00:31:06 -0700154 if [ "x$CC" = "x" ]; then CCSTR=""; else CCSTR="CC=${CC} "; fi
Lev Walkind0d63922017-10-10 01:27:37 -0700155 reproduce_make="cd \"${RNDTEMP}\" && ${CCSTR}CFLAGS=\"${CFLAGS}\" ${MAKE}"
Lev Walkinac6db172017-10-10 00:31:06 -0700156
157 env > .test-environment
158 set > .test-set
159
Lev Walkin43292722017-10-05 00:33:32 -0700160 make_clean_before_test
161
Lev Walkin7c470c72017-10-08 04:01:45 -0700162 asn_compile "$asn" "$where"
Lev Walkin39936ce2017-10-05 23:56:39 -0700163 if [ $? -ne 0 ]; then
Lev Walkincb523912017-09-30 19:33:23 -0700164 echo "Cannot compile ASN.1 $asn"
165 return 1
166 fi
167
168 rm -f random-test-driver.o
169 rm -f random-test-driver
Lev Walkin60d62672017-10-08 03:16:10 -0700170 CFLAGS="${CFLAGS}" Make
Lev Walkin39936ce2017-10-05 23:56:39 -0700171 if [ $? -ne 0 ] ; then
Lev Walkind3cce462017-10-01 13:43:36 -0700172 echo "Cannot compile C for $asn in ${RNDTEMP}"
Lev Walkincb523912017-09-30 19:33:23 -0700173 return 2
174 fi
175
Lev Walkin791d3b72017-10-02 16:24:28 -0700176 # Maximum size of the random data
Lev Walkin39936ce2017-10-05 23:56:39 -0700177 rmax=`get_param RMAX 128 "$asn"`
Lev Walkin791d3b72017-10-02 16:24:28 -0700178 if [ "0${rmax}" -lt 1 ]; then rmax=128; fi
179
Lev Walkincb523912017-09-30 19:33:23 -0700180 echo "Checking random data encode-decode"
Lev Walkin39936ce2017-10-05 23:56:39 -0700181 round_trip_check_cmd="${ASAN_ENV_FLAGS} ./random-test-driver -s ${rmax} ${encodings} -c"
Lev Walkinac6db172017-10-10 00:31:06 -0700182 echo "(${reproduce_make} && ${round_trip_check_cmd})" > .test-reproduce
Lev Walkin39936ce2017-10-05 23:56:39 -0700183 if eval "$round_trip_check_cmd"; then
184 echo "Random test OK"
185 else
Lev Walkinac6db172017-10-10 00:31:06 -0700186 { echo "RETRY:"; cat .test-reproduce ; }
Lev Walkincb523912017-09-30 19:33:23 -0700187 return 3
188 fi
189
Lev Walkind3cce462017-10-01 13:43:36 -0700190 echo "Generating new random data"
191 rm -rf random-data
192 cmd="${ASAN_ENV_FLAGS} UBSAN_OPTIONS=print_stacktrace=1"
Lev Walkind28b45f2017-10-05 22:09:19 -0700193 cmd="${cmd} ./random-test-driver -s ${rmax} ${encodings} -g random-data"
Lev Walkinac6db172017-10-10 00:31:06 -0700194 echo "(${reproduce_make} && ${cmd})" > .test-reproduce
Lev Walkin39936ce2017-10-05 23:56:39 -0700195 if eval "$cmd" ; then
196 echo "Random data generated OK"
197 else
Lev Walkinac6db172017-10-10 00:31:06 -0700198 { echo "RETRY:"; cat .test-reproduce ; }
Lev Walkind3cce462017-10-01 13:43:36 -0700199 return 4
200 fi
201
Lev Walkin233d14d2017-10-02 01:09:01 -0700202 # Do a LibFuzzer based testing
Lev Walkin39936ce2017-10-05 23:56:39 -0700203 fuzz_cmd="${ASAN_ENV_FLAGS} UBSAN_OPTIONS=print_stacktrace=1"
Lev Walkind28b45f2017-10-05 22:09:19 -0700204 fuzz_cmd="${fuzz_cmd} ./random-test-driver"
Lev Walkine5f0d942017-10-24 00:59:32 -0700205 fuzz_cmd="${fuzz_cmd} -timeout=3 -max_total_time=${FUZZ_TIME} -max_len=${rmax}"
Lev Walkin233d14d2017-10-02 01:09:01 -0700206
Lev Walkin39936ce2017-10-05 23:56:39 -0700207 if grep "^fuzz:" Makefile >/dev/null ; then
208 echo "No fuzzer defined, skipping fuzzing"
209 else
210 fuzz_targets=`echo random-data/* | sed -e 's/random-data./fuzz-/g'`
Lev Walkind28b45f2017-10-05 22:09:19 -0700211 {
212 echo "fuzz: $fuzz_targets"
213 echo "fuzz-%: random-data/% random-test-driver"
214 echo " ASN1_DATA_DIR=\$< ${fuzz_cmd} \$<"
215 } >> Makefile
Lev Walkin233d14d2017-10-02 01:09:01 -0700216 fi
217
Lev Walkincb523912017-09-30 19:33:23 -0700218 # If LIBFUZZER_CFLAGS are properly defined, do the fuzz test as well
Lev Walkin39936ce2017-10-05 23:56:39 -0700219 if echo "${LIBFUZZER_CFLAGS}" | grep -i "[a-z]" > /dev/null; then
Lev Walkincb523912017-09-30 19:33:23 -0700220
221 echo "Recompiling for fuzzing..."
222 rm -f random-test-driver.o
223 rm -f random-test-driver
Lev Walkind0d63922017-10-10 01:27:37 -0700224 reproduce_make="cd \"${RNDTEMP}\" && ${CCSTR}CFLAGS=\"${LIBFUZZER_CFLAGS} ${CFLAGS}\" ${MAKE}"
Lev Walkinac6db172017-10-10 00:31:06 -0700225 echo "(${reproduce_make})" > .test-reproduce
Lev Walkin39936ce2017-10-05 23:56:39 -0700226 CFLAGS="${LIBFUZZER_CFLAGS} ${CFLAGS}" Make
227 if [ $? -ne 0 ]; then
228 echo "Recompile failed"
229 return 4
230 fi
Lev Walkincb523912017-09-30 19:33:23 -0700231
Lev Walkind0d63922017-10-10 01:27:37 -0700232 echo "Fuzzing will take a multiple of ${FUZZ_TIME} seconds..."
Lev Walkinac6db172017-10-10 00:31:06 -0700233 echo "(${reproduce_make} fuzz)" > .test-reproduce
234 CFLAGS="${LIBFUZZER_CFLAGS} ${CFLAGS}" Make fuzz
Lev Walkin39936ce2017-10-05 23:56:39 -0700235 if [ $? -ne 0 ]; then
Lev Walkinac6db172017-10-10 00:31:06 -0700236 { echo "RETRY:"; cat .test-reproduce ; }
Lev Walkin233d14d2017-10-02 01:09:01 -0700237 return 5
238 fi
Lev Walkincb523912017-09-30 19:33:23 -0700239 fi
240
Lev Walkina5b02882017-10-01 22:48:44 -0700241 return 0
Lev Walkincb523912017-09-30 19:33:23 -0700242}
243
Lev Walkina460cbd2017-10-20 02:18:04 -0700244asn1c_invoke() {
245 tmpfile="$1"
246 asn="$2"
247 where="$3"
248 shift 3
249
250 {
251 echo "Test DEFINITIONS ::= BEGIN $asn"
252 echo "-- ${where}"
253 echo "END"
254 } > ${tmpfile}
255 echo "${abs_top_builddir}/asn1c/asn1c -S ${abs_top_srcdir}/skeletons"
256 if "${abs_top_builddir}/asn1c/asn1c" -S "${abs_top_srcdir}/skeletons" \
257 -gen-OER -gen-PER ${asn1c_flags} $@ ${tmpfile}
258 then
259 echo "ASN.1 compiled OK"
260 else
261 return 1
262 fi
263}
264
Lev Walkincb523912017-09-30 19:33:23 -0700265asn_compile() {
Lev Walkin39936ce2017-10-05 23:56:39 -0700266 asn="$1"
267 where="$2"
Lev Walkind3cce462017-10-01 13:43:36 -0700268
Lev Walkin5d947a82017-10-03 01:04:03 -0700269 # Create "INTEGER (1..2)" from "T ::= INTEGER (1..2) -- RMAX=5"
Lev Walkinebeb4012017-10-09 19:51:26 -0700270 short_asn=`echo "$asn" | sed -e 's/ *--.*//;s/RMAX=[0-9]//;'`
Lev Walkin39936ce2017-10-05 23:56:39 -0700271 if [ `echo "$short_asn" | grep -c "::="` = 1 ]; then
272 short_asn=`echo "$short_asn" | sed -e 's/.*::= *//'`
Lev Walkind3cce462017-10-01 13:43:36 -0700273 fi
274
Lev Walkincb523912017-09-30 19:33:23 -0700275 test ! -f Makefile.am # Protection from accidental clobbering
Lev Walkina460cbd2017-10-20 02:18:04 -0700276
277 asn1c_invoke "test.asn1" "$asn" "$where" "-flink-skeletons"
278 if [ $? != 0 ]; then
Lev Walkina5b02882017-10-01 22:48:44 -0700279 return 1
280 fi
Lev Walkina460cbd2017-10-20 02:18:04 -0700281
Lev Walkincb523912017-09-30 19:33:23 -0700282 rm -f converter-example.c
Lev Walkin09be69c2017-10-08 16:28:11 -0700283 ln -sf "../${srcdir}/random-test-driver.c" || cp "../${srcdir}/random-test-driver.c" .
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700284 {
285 echo "CFLAGS+= -DASN1_TEXT='$short_asn'";
286 echo "ASN_PROGRAM = random-test-driver"
287 echo "ASN_PROGRAM_SOURCES = random-test-driver.c"
Lev Walkinac6db172017-10-10 00:31:06 -0700288 echo
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700289 echo "include Makefile.am.example"
Lev Walkinac6db172017-10-10 00:31:06 -0700290 echo
291 echo "all-tests-succeeded: ${abs_top_builddir}/asn1c/asn1c \$(ASN_PROGRAM_SOURCES) \$(ASN_MODULE_SOURCES) \$(ASN_MODULE_HEADERS)"
292 echo " @rm -f \$@"
293 echo " @echo Previous try did not go correctly. To reproduce:"
294 echo " @cat .test-reproduce"
295 echo " @exit 1"
296 echo
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700297 } > Makefile
Lev Walkincb523912017-09-30 19:33:23 -0700298 echo "Makefile.am.example -> Makefile"
299}
300
Lev Walkin7c470c72017-10-08 04:01:45 -0700301# Make up to four different passes:
302# CFLAGS: | asn1c_flags:
303# -m64 | -fnative-types
304# -m32 | -fnative-types
305# -m64 | -fwide-types
306# -m32 | -fwide-types
307# *) Of course, -m64 and -fnative-types are just implied.
308test_drive() {
309 func="$1"
310 shift
311
312 if [ "x${asn1c_flags}" = "x" ] ; then
313 # Test for native types and wide types
314 asn1c_flags=" " test_drive "${func}" "$@"
315 asn1c_flags="-fnative-types" test_drive "${func}" "$@"
316 return 0
317 fi
318
Lev Walkinac6db172017-10-10 00:31:06 -0700319 # Can't reuse object code.
320 rm -rf ${RNDTEMP}
321
Lev Walkin7c470c72017-10-08 04:01:45 -0700322 echo "MODE: default"
323 # Default (likely 64-bit) mode
324 ${func} "$@"
325
326 # 32-bit mode, if available
327 if echo "${CFLAGS_M32}" | grep -i '[a-z]' > /dev/null ; then
328 echo "MODE: 32-bit"
Lev Walkinac6db172017-10-10 00:31:06 -0700329
330 # Can't reuse object code between modes.
331 rm -rf ${RNDTEMP}
332
Lev Walkin7c470c72017-10-08 04:01:45 -0700333 # -m32 doesn't support fuzzing (no such library), so we remove fuzzer.
334 # -m32 doesn't support leak sanitizing (it hangs), so we remove
Lev Walkinac6db172017-10-10 00:31:06 -0700335 # ASAN_ENV_FLAGS which enable leak check in runtime.
Lev Walkin7c470c72017-10-08 04:01:45 -0700336 CFLAGS="${CFLAGS} ${CFLAGS_M32}" CFLAGS_M32="" \
337 LIBFUZZER_CFLAGS="" ASAN_ENV_FLAGS="" \
338 ${func} "$@"
339 fi
340}
341
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700342if echo "$*" | grep ' -- ' > /dev/null; then
343 TEST_DRIVER=`echo "$*" | sed -e 's/ -- .*/ -- /g'`
344 args=`echo "$*" | sed -e 's/.* //g'`
345 set "${args}"
346else
347 TEST_DRIVER=""
348fi
349
Lev Walkincb523912017-09-30 19:33:23 -0700350# Command line parsing
Lev Walkin68619bf2017-10-03 18:40:36 -0700351while :; do
352 case "$1" in
353 -h) usage ;;
Lev Walkind28b45f2017-10-05 22:09:19 -0700354 --asn1c) asn1c_flags="${asn1c_flags} $2"; shift 2; continue ;;
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700355 --bundle)
356 shift
Lev Walkinac6db172017-10-10 00:31:06 -0700357
358 # Look for the transcript in bundles/NN-*-bundles.txt.log
359 set -x
360
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700361 base=`basename "$1" | sed -e 's/.txt$//'`
362 RNDTEMP=".tmp.${base}"
Lev Walkinac6db172017-10-10 00:31:06 -0700363
364 if Make -C "${RNDTEMP}" all-tests-succeeded >/dev/null 2>&1 ; then
365 echo "Test succeeded before. Not rechecking."
366 tests_succeeded=1
367 break
368 fi
369
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700370 test_drive verify_asn_types_in_file "$@"
Lev Walkinac6db172017-10-10 00:31:06 -0700371
372 touch "${RNDTEMP}/all-tests-succeeded"
373
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700374 break
375 ;;
Lev Walkin68619bf2017-10-03 18:40:36 -0700376 --dirty)
377 need_clean_before_bundle=0
378 need_clean_before_test=0
379 shift
380 continue
381 ;;
Lev Walkind28b45f2017-10-05 22:09:19 -0700382 -e) encodings="${encodings} -e $2"; shift 2; continue;;
Lev Walkin68619bf2017-10-03 18:40:36 -0700383 -j) parallelism="$1"; shift 2; continue;;
384 -t)
Lev Walkina460cbd2017-10-20 02:18:04 -0700385 test_drive verify_asn_type "full" "$2" "(command line)" || exit 1 ;;
Lev Walkin68619bf2017-10-03 18:40:36 -0700386 "")
Lev Walkin09be69c2017-10-08 16:28:11 -0700387 for bundle in `ls -1 ${srcdir}/bundles/*.txt | sort -nr`; do
Lev Walkin7c470c72017-10-08 04:01:45 -0700388 test_drive verify_asn_types_in_file "$bundle"
Lev Walkin68619bf2017-10-03 18:40:36 -0700389 done
390 ;;
391 *)
Lev Walkin40b8a7a2017-10-08 22:36:29 -0700392 exec ${TEST_DRIVER} $0 --bundle "$@"
Lev Walkin68619bf2017-10-03 18:40:36 -0700393 ;;
394 esac
395 break
396done
Lev Walkincb523912017-09-30 19:33:23 -0700397
Lev Walkind28b45f2017-10-05 22:09:19 -0700398if [ "$tests_succeeded" != "0" ] && [ "$tests_failed" = "0" ]; then
Lev Walkincb523912017-09-30 19:33:23 -0700399 echo "OK $tests_succeeded tests"
400else
401 echo "FAILED $tests_failed tests, OK $tests_succeeded tests"
402 exit 1
403fi