bf680707ac
Currently we run all tests via Valgrind. This patch adds 2nd batch of tests which are compiled with Clang AddressSanitizer[1], LeakSanitizer[2] and UndefinedBehaviorSanitizer[3] in order to catch more issues during QA on CI. AddressSanitizer is a fast memory error detector. The tool can detect the following types of bugs: * Out-of-bounds accesses to heap, stack and globals * Use-after-free, use-after-return, use-after-scope * Double-free, invalid free LeakSanitizer is a run-time memory leak detector. It can be combined with AddressSanitizer to get both memory error and leak detection, or used in a stand-alone mode. UndefinedBehaviorSanitizer (UBSan) is a fast undefined behavior detector. UBSan modifies the program at compile-time to catch various kinds of undefined behavior during program execution, for example: * Using misaligned or null pointer * Signed integer overflow * Conversion to, from, or between floating-point types which would overflow the destination 1. http://clang.llvm.org/docs/AddressSanitizer.html 2. http://http://clang.llvm.org/docs/LeakSanitizer.html 3. http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html Signed-off-by: Petr Štetiar <ynezz@true.cz>
57 lines
1.1 KiB
Perl
57 lines
1.1 KiB
Perl
set test bin path:
|
|
|
|
$ [ -n "$TEST_BIN_DIR" ] && export PATH="$TEST_BIN_DIR:$PATH"
|
|
|
|
check that base64 is producing expected results:
|
|
|
|
$ valgrind --quiet --leak-check=full test-b64
|
|
0
|
|
4 Zg==
|
|
4 Zm8=
|
|
4 Zm9v
|
|
8 Zm9vYg==
|
|
8 Zm9vYmE=
|
|
8 Zm9vYmFy
|
|
0
|
|
1 f
|
|
2 fo
|
|
3 foo
|
|
4 foob
|
|
5 fooba
|
|
6 foobar
|
|
|
|
$ test-b64-san
|
|
0
|
|
4 Zg==
|
|
4 Zm8=
|
|
4 Zm9v
|
|
8 Zm9vYg==
|
|
8 Zm9vYmE=
|
|
8 Zm9vYmFy
|
|
0
|
|
1 f
|
|
2 fo
|
|
3 foo
|
|
4 foob
|
|
5 fooba
|
|
6 foobar
|
|
|
|
check that b64_encode and b64_decode assert invalid input
|
|
|
|
$ alias check="egrep '(dumped|Assertion)' output.log | sed 's;.*\(b64_.*code\).*\(Assertion.*$\);\1: \2;' | LC_ALL=C sort"
|
|
|
|
$ test-b64_decode 2> output.log; check
|
|
Aborted (core dumped)
|
|
b64_decode: Assertion `dest && targsize > 0' failed.
|
|
|
|
$ test-b64_encode 2> output.log; check
|
|
Aborted (core dumped)
|
|
b64_encode: Assertion `dest && targsize > 0' failed.
|
|
|
|
$ test-b64_decode-san 2> output.log; check
|
|
Aborted (core dumped)
|
|
b64_decode: Assertion `dest && targsize > 0' failed.
|
|
|
|
$ test-b64_encode-san 2> output.log; check
|
|
Aborted (core dumped)
|
|
b64_encode: Assertion `dest && targsize > 0' failed.
|