about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPietro Albini <pietro.albini@ferrous-systems.com>2022-09-27 10:11:43 +0200
committerPietro Albini <pietro.albini@ferrous-systems.com>2022-10-18 09:38:02 +0200
commit399e5cc8db64f06c2d2d57894fc066d289e3eeae (patch)
tree2645bc7a7e8c42731f5ca280c69aaa146332807a /src
parentdd8c3a80dd2e5a0b62c3ef77511f3296070f78e2 (diff)
downloadrust-399e5cc8db64f06c2d2d57894fc066d289e3eeae.tar.gz
rust-399e5cc8db64f06c2d2d57894fc066d289e3eeae.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/test/run-make/coverage-reports/Makefile9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/test/run-make/coverage-reports/Makefile b/src/test/run-make/coverage-reports/Makefile
index 6fc2a6bada9..407992c9f43 100644
--- a/src/test/run-make/coverage-reports/Makefile
+++ b/src/test/run-make/coverage-reports/Makefile
@@ -1,6 +1,11 @@
 # needs-profiler-support
 # ignore-windows-gnu
 
+# FIXME(pietroalbini): this test currently does not work on cross-compiled
+# targets because remote-test is not capable of sending back the *.profraw
+# files generated by the LLVM instrumentation.
+# ignore-cross-compile
+
 # Rust coverage maps support LLVM Coverage Mapping Format versions 5 and 6,
 # corresponding with LLVM versions 12 and 13, respectively.
 # When upgrading LLVM versions, consider whether to enforce a minimum LLVM
@@ -81,13 +86,13 @@ include clear_expected_if_blessed
 	# Compile the test library with coverage instrumentation
 	$(RUSTC) $(SOURCEDIR)/lib/$@.rs \
 			$$( sed -n 's/^\/\/ compile-flags: \([^#]*\).*/\1/p' $(SOURCEDIR)/lib/$@.rs ) \
-			--crate-type rlib -Cinstrument-coverage
+			--crate-type rlib -Cinstrument-coverage --target $(TARGET)
 
 %: $(SOURCEDIR)/%.rs
 	# Compile the test program with coverage instrumentation
 	$(RUSTC) $(SOURCEDIR)/$@.rs \
 			$$( sed -n 's/^\/\/ compile-flags: \([^#]*\).*/\1/p' $(SOURCEDIR)/$@.rs ) \
-			-L "$(TMPDIR)" -Cinstrument-coverage
+			-L "$(TMPDIR)" -Cinstrument-coverage --target $(TARGET)
 
 	# Run it in order to generate some profiling data,
 	# with `LLVM_PROFILE_FILE=<profdata_file>` environment variable set to