mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
Add support for compile-flags in coverage tests
This commit is contained in:
parent
ad8f9af7cb
commit
4b6cc0c204
@ -82,13 +82,13 @@ endif
|
||||
%: $(SOURCEDIR)/lib/%.rs
|
||||
# Compile the test library with coverage instrumentation
|
||||
$(RUSTC) $(SOURCEDIR)/lib/$@.rs \
|
||||
$$( grep -q '^\/\/ require-rust-edition-2018' $(SOURCEDIR)/lib/$@.rs && echo "--edition=2018" ) \
|
||||
$$( sed -nE 's#^// compile-flags:(.*)#\1# p' $(SOURCEDIR)/lib/$@.rs) \
|
||||
--crate-type rlib -Zinstrument-coverage
|
||||
|
||||
%: $(SOURCEDIR)/%.rs
|
||||
# Compile the test program with coverage instrumentation
|
||||
$(RUSTC) $(SOURCEDIR)/$@.rs \
|
||||
$$( grep -q '^\/\/ require-rust-edition-2018' $(SOURCEDIR)/$@.rs && echo "--edition=2018" ) \
|
||||
$$( sed -nE 's#^// compile-flags:(.*)#\1# p' $(SOURCEDIR)/$@.rs) \
|
||||
-L "$(TMPDIR)" -Zinstrument-coverage
|
||||
|
||||
# Run it in order to generate some profiling data,
|
||||
@ -107,7 +107,7 @@ endif
|
||||
# Run it through rustdoc as well to cover doctests
|
||||
LLVM_PROFILE_FILE="$(TMPDIR)"/$@-%p.profraw \
|
||||
$(RUSTDOC) --crate-name workaround_for_79771 --test $(SOURCEDIR)/$@.rs \
|
||||
$$( grep -q '^\/\/ require-rust-edition-2018' $(SOURCEDIR)/$@.rs && echo "--edition=2018" ) \
|
||||
$$( sed -nE 's#^// compile-flags:(.*)#\1# p' $(SOURCEDIR)/$@.rs) \
|
||||
-L "$(TMPDIR)" -Zinstrument-coverage \
|
||||
-Z unstable-options --persist-doctests=$(TMPDIR)/rustdoc-$@
|
||||
|
||||
|
@ -38,9 +38,7 @@ endif
|
||||
%: $(SOURCEDIR)/lib/%.rs
|
||||
# Compile the test library with coverage instrumentation
|
||||
$(RUSTC) $(SOURCEDIR)/lib/$@.rs \
|
||||
$$( grep -q '^\/\/ require-rust-edition-2018' $(SOURCEDIR)/lib/$@.rs && \
|
||||
echo "--edition=2018" \
|
||||
) \
|
||||
$$( sed -nE 's#^// compile-flags:(.*)#\1# p' $(SOURCEDIR)/lib/$@.rs) \
|
||||
--crate-type rlib \
|
||||
-Ztrim-diagnostic-paths=no \
|
||||
-Zinstrument-coverage \
|
||||
@ -70,9 +68,7 @@ endif
|
||||
%: $(SOURCEDIR)/%.rs
|
||||
# Compile the test program with coverage instrumentation
|
||||
$(RUSTC) $(SOURCEDIR)/$@.rs \
|
||||
$$( grep -q '^\/\/ require-rust-edition-2018' $(SOURCEDIR)/$@.rs && \
|
||||
echo "--edition=2018" \
|
||||
) \
|
||||
$$( sed -nE 's#^// compile-flags:(.*)#\1# p' $(SOURCEDIR)/$@.rs) \
|
||||
-L "$(TMPDIR)" \
|
||||
-Ztrim-diagnostic-paths=no \
|
||||
-Zinstrument-coverage \
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![allow(unused_assignments, dead_code)]
|
||||
|
||||
// require-rust-edition-2018
|
||||
// compile-flags: --edition=2018
|
||||
|
||||
async fn c(x: u8) -> u8 {
|
||||
if x == 8 {
|
||||
|
Loading…
Reference in New Issue
Block a user