Skip to content

Commit cc77087

Browse files
Use new needs-(profiler|sanitizer)-support compiletest directive to clean up some run-make tests.
1 parent e2acaee commit cc77087

File tree

11 files changed

+20
-30
lines changed

11 files changed

+20
-30
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
# needs-profiler-support
2+
13
-include ../tools.mk
24

35
all:
4-
ifeq ($(RUSTC_PROFILER_SUPPORT),1)
56
$(RUSTC) -Copt-level=3 -Clto=fat -Z pgo-gen="$(TMPDIR)" test.rs
67
$(call RUN,test) || exit 1
78
[ -e "$(TMPDIR)"/default_*.profraw ] || (echo "No .profraw file"; exit 1)
8-
endif
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
# needs-profiler-support
2+
13
-include ../tools.mk
24

35
all:
4-
ifeq ($(RUSTC_PROFILER_SUPPORT),1)
56
$(RUSTC) -O -Ccodegen-units=1 -Z pgo-gen="$(TMPDIR)" --emit=llvm-ir test.rs
67
# We expect symbols starting with "__llvm_profile_".
78
$(CGREP) "__llvm_profile_" < $(TMPDIR)/test.ll
89
# We do NOT expect the "__imp_" version of these symbols.
910
$(CGREP) -v "__imp___llvm_profile_" < $(TMPDIR)/test.ll # 64 bit
1011
$(CGREP) -v "__imp____llvm_profile_" < $(TMPDIR)/test.ll # 32 bit
11-
endif
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
# needs-profiler-support
2+
13
-include ../tools.mk
24

35
all:
4-
ifeq ($(RUSTC_PROFILER_SUPPORT),1)
56
$(RUSTC) -g -Z pgo-gen="$(TMPDIR)" test.rs
67
$(call RUN,test) || exit 1
78
[ -e "$(TMPDIR)"/default_*.profraw ] || (echo "No .profraw file"; exit 1)
8-
endif
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
# needs-profiler-support
2+
13
-include ../tools.mk
24

35
all:
4-
ifeq ($(RUSTC_PROFILER_SUPPORT),1)
56
$(RUSTC) -g -Z profile test.rs
67
$(call RUN,test) || exit 1
78
[ -e "$(TMPDIR)/test.gcno" ] || (echo "No .gcno file"; exit 1)
89
[ -e "$(TMPDIR)/test.gcda" ] || (echo "No .gcda file"; exit 1)
9-
endif

src/test/run-make-fulldeps/sanitizer-address/Makefile

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1+
# needs-sanitizer-support
2+
13
-include ../tools.mk
24

35
LOG := $(TMPDIR)/log.txt
46

57
# NOTE the address sanitizer only supports x86_64 linux and macOS
68

79
ifeq ($(TARGET),x86_64-apple-darwin)
8-
ASAN_SUPPORT=$(RUSTC_SANITIZER_SUPPORT)
910
EXTRA_RUSTFLAG=-C rpath
1011
else
1112
ifeq ($(TARGET),x86_64-unknown-linux-gnu)
12-
ASAN_SUPPORT=$(RUSTC_SANITIZER_SUPPORT)
1313

1414
# Apparently there are very specific Linux kernels, notably the one that's
1515
# currently on Travis CI, which contain a buggy commit that triggers failures in
@@ -23,7 +23,5 @@ endif
2323
endif
2424

2525
all:
26-
ifeq ($(ASAN_SUPPORT),1)
2726
$(RUSTC) -g -Z sanitizer=address -Z print-link-args $(EXTRA_RUSTFLAG) overflow.rs | $(CGREP) librustc_asan
2827
$(TMPDIR)/overflow 2>&1 | $(CGREP) stack-buffer-overflow
29-
endif
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# needs-sanitizer-support
2+
13
-include ../tools.mk
24

35
LOG := $(TMPDIR)/log.txt
@@ -8,15 +10,12 @@ LOG := $(TMPDIR)/log.txt
810
# is correctly detected.
911

1012
ifeq ($(TARGET),x86_64-unknown-linux-gnu)
11-
ASAN_SUPPORT=$(RUSTC_SANITIZER_SUPPORT)
1213

1314
# See comment in sanitizer-address/Makefile for why this is here
1415
EXTRA_RUSTFLAG=-C relocation-model=dynamic-no-pic
1516
endif
1617

1718
all:
18-
ifeq ($(ASAN_SUPPORT),1)
1919
$(RUSTC) -g -Z sanitizer=address --crate-type cdylib --target $(TARGET) $(EXTRA_RUSTFLAG) library.rs
2020
$(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) $(EXTRA_RUSTFLAG) -llibrary program.rs
2121
LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow
22-
endif
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# needs-sanitizer-support
2+
13
-include ../tools.mk
24

35
LOG := $(TMPDIR)/log.txt
@@ -8,15 +10,11 @@ LOG := $(TMPDIR)/log.txt
810
# is correctly detected.
911

1012
ifeq ($(TARGET),x86_64-unknown-linux-gnu)
11-
ASAN_SUPPORT=$(RUSTC_SANITIZER_SUPPORT)
12-
1313
# See comment in sanitizer-address/Makefile for why this is here
1414
EXTRA_RUSTFLAG=-C relocation-model=dynamic-no-pic
1515
endif
1616

1717
all:
18-
ifeq ($(ASAN_SUPPORT),1)
1918
$(RUSTC) -g -Z sanitizer=address --crate-type dylib --target $(TARGET) $(EXTRA_RUSTFLAG) library.rs
2019
$(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) $(EXTRA_RUSTFLAG) -llibrary program.rs
2120
LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow
22-
endif
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1+
# needs-sanitizer-support
2+
13
-include ../tools.mk
24

35
# NOTE the address sanitizer only supports x86_64 linux and macOS
46

57
ifeq ($(TARGET),x86_64-apple-darwin)
6-
ASAN_SUPPORT=$(RUSTC_SANITIZER_SUPPORT)
78
EXTRA_RUSTFLAG=-C rpath
89
else
910
ifeq ($(TARGET),x86_64-unknown-linux-gnu)
10-
ASAN_SUPPORT=$(RUSTC_SANITIZER_SUPPORT)
1111
EXTRA_RUSTFLAG=
1212
endif
1313
endif
1414

1515
all:
16-
ifeq ($(ASAN_SUPPORT),1)
1716
$(RUSTC) -Z sanitizer=address --crate-type proc-macro --target $(TARGET) hello.rs 2>&1 | $(CGREP) '-Z sanitizer'
18-
endif
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
-include ../tools.mk
22

3+
# needs-sanitizer-support
34
# only-linux
45
# only-x86_64
56
# ignore-test
67
# FIXME(#46126) ThinLTO for libstd broke this test
78

89
all:
9-
ifdef RUSTC_SANITIZER_SUPPORT
1010
$(RUSTC) -C opt-level=1 -g -Z sanitizer=leak -Z print-link-args leak.rs | $(CGREP) librustc_lsan
1111
$(TMPDIR)/leak 2>&1 | $(CGREP) 'detected memory leaks'
12-
endif
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
-include ../tools.mk
22

3+
# needs-sanitizer-support
34
# only-linux
45
# only-x86_64
56

67
all:
7-
ifdef RUSTC_SANITIZER_SUPPORT
88
$(RUSTC) -g -Z sanitizer=memory -Z print-link-args uninit.rs | $(CGREP) librustc_msan
99
$(TMPDIR)/uninit 2>&1 | $(CGREP) use-of-uninitialized-value
10-
endif
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1+
# needs-sanitizer-support
2+
13
-include ../tools.mk
24

35
# This test builds a staticlib, then an executable that links to it.
46
# The staticlib and executable both are compiled with address sanitizer,
57
# and we assert that a fault in the staticlib is correctly detected.
68

79
ifeq ($(TARGET),x86_64-unknown-linux-gnu)
8-
ASAN_SUPPORT=$(RUSTC_SANITIZER_SUPPORT)
910
EXTRA_RUSTFLAG=
1011
endif
1112

1213
all:
13-
ifeq ($(ASAN_SUPPORT),1)
1414
$(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs
1515
$(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS)
1616
LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow
17-
endif
1817

0 commit comments

Comments
 (0)