forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use new
needs-(profiler|sanitizer)-support
compiletest directive to…
… clean up some run-make tests.
- Loading branch information
1 parent
e2acaee
commit cc77087
Showing
11 changed files
with
20 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# needs-profiler-support | ||
|
||
-include ../tools.mk | ||
|
||
all: | ||
ifeq ($(RUSTC_PROFILER_SUPPORT),1) | ||
$(RUSTC) -Copt-level=3 -Clto=fat -Z pgo-gen="$(TMPDIR)" test.rs | ||
$(call RUN,test) || exit 1 | ||
[ -e "$(TMPDIR)"/default_*.profraw ] || (echo "No .profraw file"; exit 1) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# needs-profiler-support | ||
|
||
-include ../tools.mk | ||
|
||
all: | ||
ifeq ($(RUSTC_PROFILER_SUPPORT),1) | ||
$(RUSTC) -O -Ccodegen-units=1 -Z pgo-gen="$(TMPDIR)" --emit=llvm-ir test.rs | ||
# We expect symbols starting with "__llvm_profile_". | ||
$(CGREP) "__llvm_profile_" < $(TMPDIR)/test.ll | ||
# We do NOT expect the "__imp_" version of these symbols. | ||
$(CGREP) -v "__imp___llvm_profile_" < $(TMPDIR)/test.ll # 64 bit | ||
$(CGREP) -v "__imp____llvm_profile_" < $(TMPDIR)/test.ll # 32 bit | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# needs-profiler-support | ||
|
||
-include ../tools.mk | ||
|
||
all: | ||
ifeq ($(RUSTC_PROFILER_SUPPORT),1) | ||
$(RUSTC) -g -Z pgo-gen="$(TMPDIR)" test.rs | ||
$(call RUN,test) || exit 1 | ||
[ -e "$(TMPDIR)"/default_*.profraw ] || (echo "No .profraw file"; exit 1) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# needs-profiler-support | ||
|
||
-include ../tools.mk | ||
|
||
all: | ||
ifeq ($(RUSTC_PROFILER_SUPPORT),1) | ||
$(RUSTC) -g -Z profile test.rs | ||
$(call RUN,test) || exit 1 | ||
[ -e "$(TMPDIR)/test.gcno" ] || (echo "No .gcno file"; exit 1) | ||
[ -e "$(TMPDIR)/test.gcda" ] || (echo "No .gcda file"; exit 1) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
src/test/run-make-fulldeps/sanitizer-invalid-cratetype/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
# needs-sanitizer-support | ||
|
||
-include ../tools.mk | ||
|
||
# NOTE the address sanitizer only supports x86_64 linux and macOS | ||
|
||
ifeq ($(TARGET),x86_64-apple-darwin) | ||
ASAN_SUPPORT=$(RUSTC_SANITIZER_SUPPORT) | ||
EXTRA_RUSTFLAG=-C rpath | ||
else | ||
ifeq ($(TARGET),x86_64-unknown-linux-gnu) | ||
ASAN_SUPPORT=$(RUSTC_SANITIZER_SUPPORT) | ||
EXTRA_RUSTFLAG= | ||
endif | ||
endif | ||
|
||
all: | ||
ifeq ($(ASAN_SUPPORT),1) | ||
$(RUSTC) -Z sanitizer=address --crate-type proc-macro --target $(TARGET) hello.rs 2>&1 | $(CGREP) '-Z sanitizer' | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
-include ../tools.mk | ||
|
||
# needs-sanitizer-support | ||
# only-linux | ||
# only-x86_64 | ||
# ignore-test | ||
# FIXME(#46126) ThinLTO for libstd broke this test | ||
|
||
all: | ||
ifdef RUSTC_SANITIZER_SUPPORT | ||
$(RUSTC) -C opt-level=1 -g -Z sanitizer=leak -Z print-link-args leak.rs | $(CGREP) librustc_lsan | ||
$(TMPDIR)/leak 2>&1 | $(CGREP) 'detected memory leaks' | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
-include ../tools.mk | ||
|
||
# needs-sanitizer-support | ||
# only-linux | ||
# only-x86_64 | ||
|
||
all: | ||
ifdef RUSTC_SANITIZER_SUPPORT | ||
$(RUSTC) -g -Z sanitizer=memory -Z print-link-args uninit.rs | $(CGREP) librustc_msan | ||
$(TMPDIR)/uninit 2>&1 | $(CGREP) use-of-uninitialized-value | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
# needs-sanitizer-support | ||
|
||
-include ../tools.mk | ||
|
||
# This test builds a staticlib, then an executable that links to it. | ||
# The staticlib and executable both are compiled with address sanitizer, | ||
# and we assert that a fault in the staticlib is correctly detected. | ||
|
||
ifeq ($(TARGET),x86_64-unknown-linux-gnu) | ||
ASAN_SUPPORT=$(RUSTC_SANITIZER_SUPPORT) | ||
EXTRA_RUSTFLAG= | ||
endif | ||
|
||
all: | ||
ifeq ($(ASAN_SUPPORT),1) | ||
$(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs | ||
$(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS) | ||
LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow | ||
endif | ||
|