Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
68619bf6
Commit
68619bf6
authored
Oct 03, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better debugging support
parent
aa5838cb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
19 deletions
+34
-19
tests/tests-randomized/check-bundles.sh
tests/tests-randomized/check-bundles.sh
+34
-19
No files found.
tests/tests-randomized/check-bundles.sh
View file @
68619bf6
...
...
@@ -15,6 +15,7 @@ usage() {
echo
"
$0
[--dirty] bundles/<bundle-name.txt> [<line>]"
echo
"Where options are:"
echo
" -h Show this help screen"
echo
" -e <syntax> Verify a given encoding explicitly (default is ALL)"
echo
" --dirty Reuse compile results from the previous run(s)"
echo
" -t <ASN.1> Run this particular typel"
echo
"Examples:"
...
...
@@ -35,6 +36,8 @@ tests_failed=0
stop_after_failed
=
1
# We stop after 3 failures.
need_clean_before_bundle
=
1
# Clean before testing a bundle file
need_clean_before_test
=
1
# Before each line in a bundle file
encodings
=
""
# Default is to verify all supported ASN.1 transfer syntaxes
parallelism
=
4
make_clean_before_bundle
()
{
test
"
${
need_clean_before_bundle
}
"
=
"1"
&&
make clean
...
...
@@ -106,7 +109,7 @@ compile_and_test() {
rm
-f
random-test-driver.o
rm
-f
random-test-driver
if
!
make
-j
4
;
then
if
!
make
-j
${
parallelism
}
;
then
echo
"Cannot compile C for
$asn
in
${
RNDTEMP
}
"
return
2
fi
...
...
@@ -116,17 +119,17 @@ compile_and_test() {
if
[
"0
${
rmax
}
"
-lt
1
]
;
then
rmax
=
128
;
fi
echo
"Checking random data encode-decode"
if
!
eval
${
ASAN_ENV_FLAGS
}
./random-test-driver
-s
${
rmax
}
-c
;
then
if
!
eval
${
ASAN_ENV_FLAGS
}
./random-test-driver
-s
${
rmax
}
${
encodings
}
-c
;
then
if
[
"x
$CC
"
=
"x"
]
;
then
CCSTR
=
""
;
else
CCSTR
=
"CC=
${
CC
}
"
;
fi
echo
"RETRY:"
echo
"(cd
${
RNDTEMP
}
&&
${
CCSTR
}
CFLAGS=
\"
${
LIBFUZZER_CFLAGS
}
${
CFLAGS
}
\"
make &&
${
ASAN_ENV_FLAGS
}
./random-test-driver -s
${
rmax
}
-c)"
echo
"(cd
${
RNDTEMP
}
&&
${
CCSTR
}
CFLAGS=
\"
${
LIBFUZZER_CFLAGS
}
${
CFLAGS
}
\"
make &&
${
ASAN_ENV_FLAGS
}
./random-test-driver -s
${
rmax
}
${
encodings
}
-c)"
return
3
fi
echo
"Generating new random data"
rm
-rf
random-data
cmd
=
"
${
ASAN_ENV_FLAGS
}
UBSAN_OPTIONS=print_stacktrace=1"
cmd+
=
" ./random-test-driver -s
${
rmax
}
-g random-data"
cmd+
=
" ./random-test-driver -s
${
rmax
}
${
encodings
}
-g random-data"
if
!
eval
"
$cmd
"
;
then
echo
"RETRY:"
echo
"(cd
${
RNDTEMP
}
&&
$cmd
)"
...
...
@@ -152,10 +155,10 @@ compile_and_test() {
echo
"Recompiling for fuzzing..."
rm
-f
random-test-driver.o
rm
-f
random-test-driver
CFLAGS
=
"
${
LIBFUZZER_CFLAGS
}
${
CFLAGS
}
"
make
-j
4
CFLAGS
=
"
${
LIBFUZZER_CFLAGS
}
${
CFLAGS
}
"
make
-j
${
parallelism
}
echo
"Fuzzing
$data_dir
will take
$fuzz_time
seconds..."
if
!
make
-j
4
fuzz
;
then
if
!
make
-j
${
parallelism
}
fuzz
;
then
echo
"RETRY:"
echo
"(cd
${
RNDTEMP
}
&& CC=
${
CC
}
CFLAGS=
\"
${
LIBFUZZER_CFLAGS
}
${
CFLAGS
}
\"
make fuzz)"
return
5
...
...
@@ -193,10 +196,20 @@ asn_compile() {
}
# Command line parsing
case
"
$1
"
in
while
:
;
do
case
"
$1
"
in
-h
)
usage
;;
--dirty
)
need_clean_before_bundle
=
0
;
need_clean_before_test
=
0
;;
-t
)
verify_asn_type
"
$2
"
||
exit
1
;;
--dirty
)
need_clean_before_bundle
=
0
need_clean_before_test
=
0
shift
continue
;;
-e
)
encodings+
=
" -e
$2
"
;
shift
2
;
continue
;;
-j
)
parallelism
=
"
$1
"
;
shift
2
;
continue
;;
-t
)
parallelism
=
1
# Better for debuggability
verify_asn_type
"
$2
"
||
exit
1
;;
""
)
for
bundle
in
$(
echo
bundles/
*
txt |
sort
-nr
)
;
do
verify_asn_types_in_file
"
$bundle
"
...
...
@@ -205,7 +218,9 @@ case "$1" in
*
)
verify_asn_types_in_file
"
$@
"
;;
esac
esac
break
done
if
[
"
$tests_succeeded
"
!=
"0"
-a
"
$tests_failed
"
=
"0"
]
;
then
echo
"OK
$tests_succeeded
tests"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment