Rollup merge of #73044 - tmiasko:compiletest-san, r=nikomatsakis

compiletest: Add directives to detect sanitizer support

Add needs-sanitizer-{address,leak,memory,thread} directive indicating
that test requires target with support for specific sanitizer.

This is an addition to the existing needs-sanitizer-support directive
indicating that test requires a sanitizer runtime library.

The existing needs-sanitizer-support directive could be incorporated into the
new ones, but I decided to retain it, since it enables running sanitizer
codegen tests even when building of sanitizer runtime libraries is disabled.
This commit is contained in:
Ralf Jung 2020-06-19 14:29:22 +02:00 committed by GitHub
commit 0851036ae3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 75 additions and 30 deletions

View file

@ -1,9 +1,7 @@
// Verifies that MemorySanitizer track-origins level can be controlled
// with -Zsanitizer-memory-track-origins option.
//
// needs-sanitizer-support
// only-linux
// only-x86_64
// needs-sanitizer-memory
// revisions:MSAN-0 MSAN-1 MSAN-2 MSAN-1-LTO MSAN-2-LTO
//
//[MSAN-0] compile-flags: -Zsanitizer=memory

View file

@ -1,11 +1,9 @@
// Verifies that no_sanitize attribute prevents inlining when
// given sanitizer is enabled, but has no effect on inlining otherwise.
//
// needs-sanitizer-support
// only-x86_64
//
// needs-sanitizer-address
// needs-sanitizer-leak
// revisions: ASAN LSAN
//
//[ASAN] compile-flags: -Zsanitizer=address -C opt-level=3 -Z mir-opt-level=3
//[LSAN] compile-flags: -Zsanitizer=leak -C opt-level=3 -Z mir-opt-level=3

View file

@ -1,7 +1,7 @@
// Verifies that no_sanitze attribute can be used to
// selectively disable sanitizer instrumentation.
//
// needs-sanitizer-support
// needs-sanitizer-address
// compile-flags: -Zsanitizer=address
#![crate_type="lib"]

View file

@ -1,9 +1,8 @@
// Verifies that AddressSanitizer and MemorySanitizer
// recovery mode can be enabled with -Zsanitizer-recover.
//
// needs-sanitizer-support
// only-linux
// only-x86_64
// needs-sanitizer-address
// needs-sanitizer-memory
// revisions:ASAN ASAN-RECOVER MSAN MSAN-RECOVER MSAN-RECOVER-LTO
// no-prefer-dynamic
//

View file

@ -1,5 +1,5 @@
# needs-sanitizer-support
# only-x86_64
# needs-sanitizer-address
# only-linux
-include ../tools.mk

View file

@ -1,5 +1,5 @@
# needs-sanitizer-support
# only-x86_64
# needs-sanitizer-address
# only-linux
-include ../tools.mk

View file

@ -1,5 +1,5 @@
# needs-sanitizer-support
# only-x86_64
# needs-sanitizer-address
# only-linux
-include ../tools.mk

View file

@ -1,4 +1,5 @@
// needs-sanitizer-support
// needs-sanitizer-address
// compile-flags: --test -Z sanitizer=address
//
// #43031: Verify that rustdoc passes `-Z` options to rustc. Use an extern

View file

@ -1,5 +1,5 @@
// needs-sanitizer-support
// only-x86_64
// needs-sanitizer-address
//
// compile-flags: -Z sanitizer=address -O -g
//

View file

@ -1,5 +1,5 @@
// needs-sanitizer-support
// only-x86_64
// needs-sanitizer-address
//
// compile-flags: -Z sanitizer=address -O
//

View file

@ -2,8 +2,10 @@
// the `#[cfg(sanitize = "option")]` attribute is configured.
// needs-sanitizer-support
// only-linux
// only-x86_64
// needs-sanitizer-address
// needs-sanitizer-leak
// needs-sanitizer-memory
// needs-sanitizer-thread
// check-pass
// revisions: address leak memory thread
//[address]compile-flags: -Zsanitizer=address --cfg address

View file

@ -4,7 +4,7 @@
// miscompilation which was subsequently detected by AddressSanitizer as UB.
//
// needs-sanitizer-support
// only-x86_64
// needs-sanitizer-address
//
// compile-flags: -Copt-level=0 -Zsanitizer=address
// run-pass

View file

@ -1,5 +1,5 @@
// needs-sanitizer-support
// only-x86_64
// needs-sanitizer-leak
//
// compile-flags: -Z sanitizer=leak -O
//

View file

@ -1,6 +1,5 @@
// needs-sanitizer-support
// only-linux
// only-x86_64
// needs-sanitizer-memory
//
// compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O
//

View file

@ -4,7 +4,7 @@
//
// min-llvm-version 9.0
// needs-sanitizer-support
// only-x86_64
// needs-sanitizer-address
//
// no-prefer-dynamic
// revisions: opt0 opt1

View file

@ -11,7 +11,7 @@
// would occasionally fail, making test flaky.
//
// needs-sanitizer-support
// only-x86_64
// needs-sanitizer-thread
//
// compile-flags: -Z sanitizer=thread -O
//

View file

@ -1,5 +1,5 @@
// needs-sanitizer-support
// only-x86_64
// needs-sanitizer-address
//
// compile-flags: -Zsanitizer=address
// run-fail