diff options
Diffstat (limited to 'src/test/run-make')
22 files changed, 76 insertions, 117 deletions
diff --git a/src/test/run-make/coverage-reports/Makefile b/src/test/run-make/coverage-reports/Makefile index 6fc2a6bad..64b2f75ef 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 @@ -75,19 +80,19 @@ ifdef RUSTC_BLESS_TEST rm -f expected_* endif -include clear_expected_if_blessed +-include clear_expected_if_blessed %: $(SOURCEDIR)/lib/%.rs # 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 diff --git a/src/test/run-make/issue-36710/Makefile b/src/test/run-make/issue-36710/Makefile index b5270ad2b..986a3f4e6 100644 --- a/src/test/run-make/issue-36710/Makefile +++ b/src/test/run-make/issue-36710/Makefile @@ -1,10 +1,6 @@ -# ignore-riscv64 $(call RUN,foo) expects to run the target executable natively +# ignore-cross-compile $(call RUN,foo) expects to run the target executable natively # so it won't work with remote-test-server -# ignore-arm Another build using remote-test-server # ignore-none no-std is not supported -# ignore-wasm32 FIXME: don't attempt to compile C++ to WASM -# ignore-wasm64 FIXME: don't attempt to compile C++ to WASM -# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for `std` # ignore-musl FIXME: this makefile needs teaching how to use a musl toolchain # (see dist-i586-gnu-i586-i686-musl Dockerfile) diff --git a/src/test/run-make/macos-fat-archive/Makefile b/src/test/run-make/macos-fat-archive/Makefile new file mode 100644 index 000000000..cc99375db --- /dev/null +++ b/src/test/run-make/macos-fat-archive/Makefile @@ -0,0 +1,10 @@ +# only-macos + +-include ../../run-make-fulldeps/tools.mk + +"$(TMPDIR)"/libnative-library.a: native-library.c + $(CC) -arch arm64 -arch x86_64 native-library.c -c -o "$(TMPDIR)"/native-library.o + $(AR) crs "$(TMPDIR)"/libnative-library.a "$(TMPDIR)"/native-library.o + +all: "$(TMPDIR)"/libnative-library.a + $(RUSTC) lib.rs --crate-type=lib -L "native=$(TMPDIR)" -l static=native-library diff --git a/src/test/run-make/macos-fat-archive/lib.rs b/src/test/run-make/macos-fat-archive/lib.rs new file mode 100644 index 000000000..9943a266c --- /dev/null +++ b/src/test/run-make/macos-fat-archive/lib.rs @@ -0,0 +1,3 @@ +extern "C" { + pub fn native_func(); +} diff --git a/src/test/run-make/macos-fat-archive/native-library.c b/src/test/run-make/macos-fat-archive/native-library.c new file mode 100644 index 000000000..d300fdf1c --- /dev/null +++ b/src/test/run-make/macos-fat-archive/native-library.c @@ -0,0 +1 @@ +void native_func() {} diff --git a/src/test/run-make/native-link-modifier-verbatim-linker/Makefile b/src/test/run-make/native-link-modifier-verbatim-linker/Makefile new file mode 100644 index 000000000..e56e1e94e --- /dev/null +++ b/src/test/run-make/native-link-modifier-verbatim-linker/Makefile @@ -0,0 +1,15 @@ +# ignore-cross-compile +# ignore-macos + +include ../../run-make-fulldeps/tools.mk + +all: + # Verbatim allows specify precise name. + $(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/local_some_strange_name.ext + $(RUSTC) main.rs -Zunstable-options -l static:+verbatim=local_some_strange_name.ext + + # With verbatim any other name cannot be used (local). + $(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/liblocal_native_dep.a + $(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/local_native_dep.a + $(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/local_native_dep.lib + $(RUSTC) main.rs -Zunstable-options -l static:+verbatim=local_native_dep 2>&1 | $(CGREP) "local_native_dep" diff --git a/src/test/run-make/native-link-modifier-verbatim-linker/local_native_dep.rs b/src/test/run-make/native-link-modifier-verbatim-linker/local_native_dep.rs new file mode 100644 index 000000000..59b6c92d2 --- /dev/null +++ b/src/test/run-make/native-link-modifier-verbatim-linker/local_native_dep.rs @@ -0,0 +1,4 @@ +#[no_mangle] +pub fn local_native_f() -> i32 { + return 0; +} diff --git a/src/test/run-make/native-link-modifier-verbatim-linker/main.rs b/src/test/run-make/native-link-modifier-verbatim-linker/main.rs new file mode 100644 index 000000000..71b73a489 --- /dev/null +++ b/src/test/run-make/native-link-modifier-verbatim-linker/main.rs @@ -0,0 +1,9 @@ +extern "C" { + fn local_native_f() -> i32; +} + +pub fn main() { + unsafe { + assert!(local_native_f() == 0); + }; +} diff --git a/src/test/run-make/native-link-modifier-verbatim-rustc/Makefile b/src/test/run-make/native-link-modifier-verbatim-rustc/Makefile new file mode 100644 index 000000000..1093b1cd3 --- /dev/null +++ b/src/test/run-make/native-link-modifier-verbatim-rustc/Makefile @@ -0,0 +1,12 @@ +include ../../run-make-fulldeps/tools.mk + +all: + # Verbatim allows specify precise name. + $(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_some_strange_name.ext + $(RUSTC) rust_dep.rs -Zunstable-options -l static:+verbatim=upstream_some_strange_name.ext --crate-type rlib + + # With verbatim any other name cannot be used (upstream). + $(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/libupstream_native_dep.a + $(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_native_dep.a + $(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_native_dep.lib + $(RUSTC) rust_dep.rs -Zunstable-options -l static:+verbatim=upstream_native_dep --crate-type rlib 2>&1 | $(CGREP) "upstream_native_dep" diff --git a/src/test/run-make/native-link-modifier-verbatim-rustc/rust_dep.rs b/src/test/run-make/native-link-modifier-verbatim-rustc/rust_dep.rs new file mode 100644 index 000000000..e9517218e --- /dev/null +++ b/src/test/run-make/native-link-modifier-verbatim-rustc/rust_dep.rs @@ -0,0 +1,9 @@ +extern "C" { + fn upstream_native_f() -> i32; +} + +pub fn rust_dep() { + unsafe { + assert!(upstream_native_f() == 0); + } +} diff --git a/src/test/run-make/native-link-modifier-verbatim-rustc/upstream_native_dep.rs b/src/test/run-make/native-link-modifier-verbatim-rustc/upstream_native_dep.rs new file mode 100644 index 000000000..839686233 --- /dev/null +++ b/src/test/run-make/native-link-modifier-verbatim-rustc/upstream_native_dep.rs @@ -0,0 +1,4 @@ +#[no_mangle] +pub fn upstream_native_f() -> i32 { + return 0; +} diff --git a/src/test/run-make/rlib-format-packed-bundled-libs-2/Makefile b/src/test/run-make/rlib-format-packed-bundled-libs-2/Makefile deleted file mode 100644 index 4574cf17f..000000000 --- a/src/test/run-make/rlib-format-packed-bundled-libs-2/Makefile +++ /dev/null @@ -1,22 +0,0 @@ --include ../../run-make-fulldeps/tools.mk - -# ignore-cross-compile - -# Make sure -Zpacked_bundled_libs is compatible with verbatim. - -# We're using the llvm-nm instead of the system nm to ensure it is compatible -# with the LLVM bitcode generated by rustc. -NM = "$(LLVM_BIN_DIR)"/llvm-nm - -all: - # Build strange-named dep. - $(RUSTC) native_dep.rs --crate-type=staticlib -o $(TMPDIR)/native_dep.ext - - $(RUSTC) rust_dep.rs --crate-type=rlib -Zpacked_bundled_libs - $(NM) $(TMPDIR)/librust_dep.rlib | $(CGREP) -e "U.*native_f1" - $(AR) t $(TMPDIR)/librust_dep.rlib | $(CGREP) "native_dep.ext" - - # Make sure compiler doesn't use files, that it shouldn't know about. - rm $(TMPDIR)/native_dep.ext - - $(RUSTC) main.rs --extern rust_dep=$(TMPDIR)/librust_dep.rlib -Zpacked_bundled_libs diff --git a/src/test/run-make/rlib-format-packed-bundled-libs-2/main.rs b/src/test/run-make/rlib-format-packed-bundled-libs-2/main.rs deleted file mode 100644 index 8d2b8a285..000000000 --- a/src/test/run-make/rlib-format-packed-bundled-libs-2/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate rust_dep; - -pub fn main() { - rust_dep::rust_dep(); -} diff --git a/src/test/run-make/rlib-format-packed-bundled-libs-2/native_dep.rs b/src/test/run-make/rlib-format-packed-bundled-libs-2/native_dep.rs deleted file mode 100644 index 321a8237e..000000000 --- a/src/test/run-make/rlib-format-packed-bundled-libs-2/native_dep.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[no_mangle] -pub fn native_f1() -> i32 { - return 1; -} diff --git a/src/test/run-make/rlib-format-packed-bundled-libs-2/rust_dep.rs b/src/test/run-make/rlib-format-packed-bundled-libs-2/rust_dep.rs deleted file mode 100644 index d99dda05c..000000000 --- a/src/test/run-make/rlib-format-packed-bundled-libs-2/rust_dep.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![feature(native_link_modifiers_verbatim)] -#[link(name = "native_dep.ext", kind = "static", modifiers = "+verbatim")] -extern "C" { - fn native_f1() -> i32; -} - -pub fn rust_dep() { - unsafe { - assert!(native_f1() == 1); - } -} diff --git a/src/test/run-make/rlib-format-packed-bundled-libs/Makefile b/src/test/run-make/rlib-format-packed-bundled-libs/Makefile deleted file mode 100644 index 0b991ac42..000000000 --- a/src/test/run-make/rlib-format-packed-bundled-libs/Makefile +++ /dev/null @@ -1,34 +0,0 @@ --include ../../run-make-fulldeps/tools.mk - -# ignore-cross-compile - -# Make sure rlib format with -Zpacked_bundled_libs is correct. - -# We're using the llvm-nm instead of the system nm to ensure it is compatible -# with the LLVM bitcode generated by rustc. -NM = "$(LLVM_BIN_DIR)"/llvm-nm - -all: $(call NATIVE_STATICLIB,native_dep_1) $(call NATIVE_STATICLIB,native_dep_2) $(call NATIVE_STATICLIB,native_dep_3) - $(RUSTC) rust_dep_up.rs --crate-type=rlib -Zpacked_bundled_libs - $(NM) $(TMPDIR)/librust_dep_up.rlib | $(CGREP) -e "U.*native_f2" - $(NM) $(TMPDIR)/librust_dep_up.rlib | $(CGREP) -e "U.*native_f3" - $(NM) $(TMPDIR)/librust_dep_up.rlib | $(CGREP) -e "T.*rust_dep_up" - $(AR) t $(TMPDIR)/librust_dep_up.rlib | $(CGREP) "native_dep_2" - $(AR) t $(TMPDIR)/librust_dep_up.rlib | $(CGREP) "native_dep_3" - $(RUSTC) rust_dep_local.rs --extern rlib=$(TMPDIR)/librust_dep_up.rlib -Zpacked_bundled_libs --crate-type=rlib - $(NM) $(TMPDIR)/librust_dep_local.rlib | $(CGREP) -e "U.*native_f1" - $(NM) $(TMPDIR)/librust_dep_local.rlib | $(CGREP) -e "T.*rust_dep_local" - $(AR) t $(TMPDIR)/librust_dep_local.rlib | $(CGREP) "native_dep_1" - - # Make sure compiler doesn't use files, that it shouldn't know about. - rm $(TMPDIR)/*native_dep_* - - $(RUSTC) main.rs --extern lib=$(TMPDIR)/librust_dep_local.rlib -o $(TMPDIR)/main.exe -Zpacked_bundled_libs --print link-args | $(CGREP) -e "native_dep_1.*native_dep_2.*native_dep_3" - -ifndef IS_MSVC - $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*native_f1" - $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*native_f2" - $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*native_f3" - $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*rust_dep_local" - $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*rust_dep_up" -endif diff --git a/src/test/run-make/rlib-format-packed-bundled-libs/main.rs b/src/test/run-make/rlib-format-packed-bundled-libs/main.rs deleted file mode 100644 index 042a4879f..000000000 --- a/src/test/run-make/rlib-format-packed-bundled-libs/main.rs +++ /dev/null @@ -1,4 +0,0 @@ -extern crate rust_dep_local; -pub fn main() { - rust_dep_local::rust_dep_local(); -} diff --git a/src/test/run-make/rlib-format-packed-bundled-libs/native_dep_1.c b/src/test/run-make/rlib-format-packed-bundled-libs/native_dep_1.c deleted file mode 100644 index 07be8562c..000000000 --- a/src/test/run-make/rlib-format-packed-bundled-libs/native_dep_1.c +++ /dev/null @@ -1 +0,0 @@ -int native_f1() { return 1; } diff --git a/src/test/run-make/rlib-format-packed-bundled-libs/native_dep_2.c b/src/test/run-make/rlib-format-packed-bundled-libs/native_dep_2.c deleted file mode 100644 index a1b94e40d..000000000 --- a/src/test/run-make/rlib-format-packed-bundled-libs/native_dep_2.c +++ /dev/null @@ -1 +0,0 @@ -int native_f2() { return 2; } diff --git a/src/test/run-make/rlib-format-packed-bundled-libs/native_dep_3.c b/src/test/run-make/rlib-format-packed-bundled-libs/native_dep_3.c deleted file mode 100644 index f81f397a4..000000000 --- a/src/test/run-make/rlib-format-packed-bundled-libs/native_dep_3.c +++ /dev/null @@ -1 +0,0 @@ -int native_f3() { return 3; } diff --git a/src/test/run-make/rlib-format-packed-bundled-libs/rust_dep_local.rs b/src/test/run-make/rlib-format-packed-bundled-libs/rust_dep_local.rs deleted file mode 100644 index 8280c7d6c..000000000 --- a/src/test/run-make/rlib-format-packed-bundled-libs/rust_dep_local.rs +++ /dev/null @@ -1,13 +0,0 @@ -#[link(name = "native_dep_1", kind = "static")] -extern "C" { - fn native_f1() -> i32; -} - -extern crate rust_dep_up; - -pub fn rust_dep_local() { - unsafe { - assert!(native_f1() == 1); - } - rust_dep_up::rust_dep_up(); -} diff --git a/src/test/run-make/rlib-format-packed-bundled-libs/rust_dep_up.rs b/src/test/run-make/rlib-format-packed-bundled-libs/rust_dep_up.rs deleted file mode 100644 index edcd7c521..000000000 --- a/src/test/run-make/rlib-format-packed-bundled-libs/rust_dep_up.rs +++ /dev/null @@ -1,13 +0,0 @@ -#[link(name = "native_dep_2", kind = "static")] -#[link(name = "native_dep_3", kind = "static")] -extern "C" { - fn native_f2() -> i32; - fn native_f3() -> i32; -} - -pub fn rust_dep_up() { - unsafe { - assert!(native_f2() == 2); - assert!(native_f3() == 3); - } -} |