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
d28b45fd
Commit
d28b45fd
authored
Oct 05, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
run through shellcheck
parent
9cbf6784
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
tests/tests-randomized/check-bundles.sh
tests/tests-randomized/check-bundles.sh
+17
-14
No files found.
tests/tests-randomized/check-bundles.sh
View file @
d28b45fd
...
@@ -59,13 +59,13 @@ verify_asn_types_in_file() {
...
@@ -59,13 +59,13 @@ verify_asn_types_in_file() {
echo
"Open [
$filename
]"
echo
"Open [
$filename
]"
local
line
=
0
local
line
=
0
while
read
asn
;
do
while
read
-r
asn
;
do
line
=
$((
line+1
))
line
=
$((
line+1
))
if
echo
"
$asn
"
|
sed
-e
's/--.*//;'
|
grep
-vqi
"[A-Z]"
;
then
if
echo
"
$asn
"
|
sed
-e
's/--.*//;'
|
grep
-vqi
"[A-Z]"
;
then
# Ignore lines consisting of just comments.
# Ignore lines consisting of just comments.
continue
;
continue
;
fi
fi
if
[
"x
$need_line
"
!=
"x"
-a
"
$need_line
"
!=
"
$line
"
]
;
then
if
[
"x
$need_line
"
!=
"x"
]
&&
[
"
$need_line
"
!=
"
$line
"
]
;
then
# We need a different line.
# We need a different line.
continue
;
continue
;
fi
fi
...
@@ -143,7 +143,8 @@ compile_and_test_with() {
...
@@ -143,7 +143,8 @@ compile_and_test_with() {
if
[
"0
${
rmax
}
"
-lt
1
]
;
then
rmax
=
128
;
fi
if
[
"0
${
rmax
}
"
-lt
1
]
;
then
rmax
=
128
;
fi
echo
"Checking random data encode-decode"
echo
"Checking random data encode-decode"
if
!
eval
${
ASAN_ENV_FLAGS
}
./random-test-driver
-s
${
rmax
}
${
encodings
}
-c
;
then
local
round_trip_check_cmd
=
"
${
ASAN_ENV_FLAGS
}
./random-test-driver -s
${
rmax
}
${
encodings
}
-c"
if
!
eval
"
$round_trip_check_cmd
"
;
then
if
[
"x
$CC
"
=
"x"
]
;
then
CCSTR
=
""
;
else
CCSTR
=
"CC=
${
CC
}
"
;
fi
if
[
"x
$CC
"
=
"x"
]
;
then
CCSTR
=
""
;
else
CCSTR
=
"CC=
${
CC
}
"
;
fi
echo
"RETRY:"
echo
"RETRY:"
echo
"(cd
${
RNDTEMP
}
&&
${
CCSTR
}
CFLAGS=
\"
${
LIBFUZZER_CFLAGS
}
${
CFLAGS
}
\"
make &&
${
ASAN_ENV_FLAGS
}
./random-test-driver -s
${
rmax
}
${
encodings
}
-c)"
echo
"(cd
${
RNDTEMP
}
&&
${
CCSTR
}
CFLAGS=
\"
${
LIBFUZZER_CFLAGS
}
${
CFLAGS
}
\"
make &&
${
ASAN_ENV_FLAGS
}
./random-test-driver -s
${
rmax
}
${
encodings
}
-c)"
...
@@ -153,7 +154,7 @@ compile_and_test_with() {
...
@@ -153,7 +154,7 @@ compile_and_test_with() {
echo
"Generating new random data"
echo
"Generating new random data"
rm
-rf
random-data
rm
-rf
random-data
cmd
=
"
${
ASAN_ENV_FLAGS
}
UBSAN_OPTIONS=print_stacktrace=1"
cmd
=
"
${
ASAN_ENV_FLAGS
}
UBSAN_OPTIONS=print_stacktrace=1"
cmd
+
=
"
./random-test-driver -s
${
rmax
}
${
encodings
}
-g random-data"
cmd
=
"
${
cmd
}
./random-test-driver -s
${
rmax
}
${
encodings
}
-g random-data"
if
!
eval
"
$cmd
"
;
then
if
!
eval
"
$cmd
"
;
then
echo
"RETRY:"
echo
"RETRY:"
echo
"(cd
${
RNDTEMP
}
&&
$cmd
)"
echo
"(cd
${
RNDTEMP
}
&&
$cmd
)"
...
@@ -163,14 +164,16 @@ compile_and_test_with() {
...
@@ -163,14 +164,16 @@ compile_and_test_with() {
# Do a LibFuzzer based testing
# Do a LibFuzzer based testing
local
fuzz_time
=
10
local
fuzz_time
=
10
local
fuzz_cmd
=
"
${
ASAN_ENV_FLAGS
}
UBSAN_OPTIONS=print_stacktrace=1"
local
fuzz_cmd
=
"
${
ASAN_ENV_FLAGS
}
UBSAN_OPTIONS=print_stacktrace=1"
fuzz_cmd
+
=
"
./random-test-driver"
fuzz_cmd
=
"
${
fuzz_cmd
}
./random-test-driver"
fuzz_cmd
+
=
"
-timeout=3 -max_total_time=
${
fuzz_time
}
-max_len=128"
fuzz_cmd
=
"
${
fuzz_cmd
}
-timeout=3 -max_total_time=
${
fuzz_time
}
-max_len=128"
if
!
grep
-q
"^fuzz:"
Makefile
;
then
if
!
grep
-q
"^fuzz:"
Makefile
;
then
local
fuzz_targets
=
$(
echo
random-data/
*
|
sed
-e
's/random-data./fuzz-/g'
)
local
fuzz_targets
=
$(
echo
random-data/
*
|
sed
-e
's/random-data./fuzz-/g'
)
echo
"fuzz:
$fuzz_targets
"
>>
Makefile
{
echo
"fuzz-%: random-data/% random-test-driver"
>>
Makefile
echo
"fuzz:
$fuzz_targets
"
echo
" ASN1_DATA_DIR=
\$
<
${
fuzz_cmd
}
\$
<"
>>
Makefile
echo
"fuzz-%: random-data/% random-test-driver"
echo
" ASN1_DATA_DIR=
\$
<
${
fuzz_cmd
}
\$
<"
}
>>
Makefile
fi
fi
# If LIBFUZZER_CFLAGS are properly defined, do the fuzz test as well
# If LIBFUZZER_CFLAGS are properly defined, do the fuzz test as well
...
@@ -181,7 +184,7 @@ compile_and_test_with() {
...
@@ -181,7 +184,7 @@ compile_and_test_with() {
rm
-f
random-test-driver
rm
-f
random-test-driver
CFLAGS
=
"
${
LIBFUZZER_CFLAGS
}
${
CFLAGS
}
"
make
-j
${
parallelism
}
CFLAGS
=
"
${
LIBFUZZER_CFLAGS
}
${
CFLAGS
}
"
make
-j
${
parallelism
}
echo
"Fuzzing
$data_dir
will take
$fuzz_time
seconds..."
echo
"Fuzzing
will take a multiple of
$fuzz_time
seconds..."
if
!
make
-j
${
parallelism
}
fuzz
;
then
if
!
make
-j
${
parallelism
}
fuzz
;
then
echo
"RETRY:"
echo
"RETRY:"
echo
"(cd
${
RNDTEMP
}
&& CC=
${
CC
}
CFLAGS=
\"
${
LIBFUZZER_CFLAGS
}
${
CFLAGS
}
\"
make fuzz)"
echo
"(cd
${
RNDTEMP
}
&& CC=
${
CC
}
CFLAGS=
\"
${
LIBFUZZER_CFLAGS
}
${
CFLAGS
}
\"
make fuzz)"
...
@@ -207,7 +210,7 @@ asn_compile() {
...
@@ -207,7 +210,7 @@ asn_compile() {
echo
"Test DEFINITIONS ::= BEGIN
$asn
"
>
test.asn1
echo
"Test DEFINITIONS ::= BEGIN
$asn
"
>
test.asn1
echo
"--
${
where
}
"
>>
test.asn1
echo
"--
${
where
}
"
>>
test.asn1
echo
"END"
>>
test.asn1
echo
"END"
>>
test.asn1
if
!
${
abs_top_builddir
}
/asn1c/asn1c
-S
${
abs_top_srcdir
}
/skeletons
\
if
!
"
${
abs_top_builddir
}
/asn1c/asn1c"
-S
"
${
abs_top_srcdir
}
/skeletons"
\
-gen-OER
-gen-PER
"
$@
"
test.asn1
-gen-OER
-gen-PER
"
$@
"
test.asn1
then
then
return
1
return
1
...
@@ -224,14 +227,14 @@ asn_compile() {
...
@@ -224,14 +227,14 @@ asn_compile() {
while
:
;
do
while
:
;
do
case
"
$1
"
in
case
"
$1
"
in
-h
)
usage
;;
-h
)
usage
;;
--asn1c
)
asn1c_flags
+
=
"
$2
"
;
shift
2
;
continue
;;
--asn1c
)
asn1c_flags
=
"
${
asn1c_flags
}
$2
"
;
shift
2
;
continue
;;
--dirty
)
--dirty
)
need_clean_before_bundle
=
0
need_clean_before_bundle
=
0
need_clean_before_test
=
0
need_clean_before_test
=
0
shift
shift
continue
continue
;;
;;
-e
)
encodings
+
=
"
-e
$2
"
;
shift
2
;
continue
;;
-e
)
encodings
=
"
${
encodings
}
-e
$2
"
;
shift
2
;
continue
;;
-j
)
parallelism
=
"
$1
"
;
shift
2
;
continue
;;
-j
)
parallelism
=
"
$1
"
;
shift
2
;
continue
;;
-t
)
-t
)
parallelism
=
1
# Better for debuggability
parallelism
=
1
# Better for debuggability
...
@@ -248,7 +251,7 @@ while :; do
...
@@ -248,7 +251,7 @@ while :; do
break
break
done
done
if
[
"
$tests_succeeded
"
!=
"0"
-a
"
$tests_failed
"
=
"0"
]
;
then
if
[
"
$tests_succeeded
"
!=
"0"
]
&&
[
"
$tests_failed
"
=
"0"
]
;
then
echo
"OK
$tests_succeeded
tests"
echo
"OK
$tests_succeeded
tests"
else
else
echo
"FAILED
$tests_failed
tests, OK
$tests_succeeded
tests"
echo
"FAILED
$tests_failed
tests, 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