Skip to content

Commit 399e5cc

Browse files
committed
partially fix src/test/run-make/coverage-reports when cross-compiling
The test does not work on cross-compiled targets because the --target flag was not passed to rustc inside the test. This commit fixes that by adding the flag to the invocations. Note that the test still fails on cross-compiled targets using remote-test, as remote-test is not capable (yet) of sending back to the host system the *.profraw file generated by the instrumentation. Because of that, this is only a partial fix, and the test has been ignored on cross-compilation.
1 parent dd8c3a8 commit 399e5cc

File tree

1 file changed

+7
-2
lines changed
  • src/test/run-make/coverage-reports

1 file changed

+7
-2
lines changed

Diff for: src/test/run-make/coverage-reports/Makefile

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# needs-profiler-support
22
# ignore-windows-gnu
33

4+
# FIXME(pietroalbini): this test currently does not work on cross-compiled
5+
# targets because remote-test is not capable of sending back the *.profraw
6+
# files generated by the LLVM instrumentation.
7+
# ignore-cross-compile
8+
49
# Rust coverage maps support LLVM Coverage Mapping Format versions 5 and 6,
510
# corresponding with LLVM versions 12 and 13, respectively.
611
# When upgrading LLVM versions, consider whether to enforce a minimum LLVM
@@ -81,13 +86,13 @@ include clear_expected_if_blessed
8186
# Compile the test library with coverage instrumentation
8287
$(RUSTC) $(SOURCEDIR)/lib/$@.rs \
8388
$$( sed -n 's/^\/\/ compile-flags: \([^#]*\).*/\1/p' $(SOURCEDIR)/lib/[email protected] ) \
84-
--crate-type rlib -Cinstrument-coverage
89+
--crate-type rlib -Cinstrument-coverage --target $(TARGET)
8590

8691
%: $(SOURCEDIR)/%.rs
8792
# Compile the test program with coverage instrumentation
8893
$(RUSTC) $(SOURCEDIR)/$@.rs \
8994
$$( sed -n 's/^\/\/ compile-flags: \([^#]*\).*/\1/p' $(SOURCEDIR)/[email protected] ) \
90-
-L "$(TMPDIR)" -Cinstrument-coverage
95+
-L "$(TMPDIR)" -Cinstrument-coverage --target $(TARGET)
9196

9297
# Run it in order to generate some profiling data,
9398
# with `LLVM_PROFILE_FILE=<profdata_file>` environment variable set to

0 commit comments

Comments
 (0)