diff options
Diffstat (limited to 'src/test/run-make')
37 files changed, 278 insertions, 21 deletions
diff --git a/src/test/run-make/coverage-reports/Makefile b/src/test/run-make/coverage-reports/Makefile index 64b2f75ef..d06cd9c6a 100644 --- a/src/test/run-make/coverage-reports/Makefile +++ b/src/test/run-make/coverage-reports/Makefile @@ -132,7 +132,7 @@ endif --instr-profile="$(TMPDIR)"/$@.profdata \ $(call BIN,"$(TMPDIR)"/$@) \ $$( \ - for file in $(TMPDIR)/rustdoc-$@/*/rust_out; do \ + for file in $(TMPDIR)/rustdoc-$@/*/rust_out*; do \ [ -x "$$file" ] && printf "%s %s " -object $$file; \ done \ ) \ diff --git a/src/test/run-make/coverage-reports/expected_show_coverage.async2.txt b/src/test/run-make/coverage-reports/expected_show_coverage.async2.txt index dc06a485a..500dde1f2 100644 --- a/src/test/run-make/coverage-reports/expected_show_coverage.async2.txt +++ b/src/test/run-make/coverage-reports/expected_show_coverage.async2.txt @@ -72,7 +72,7 @@ 67| | } 68| 2| } ------------------ - | async2::executor::block_on::<core::future::from_generator::GenFuture<async2::async_func::{closure#0}>>: + | async2::executor::block_on::<async2::async_func::{closure#0}>: | 51| 1| pub fn block_on<F: Future>(mut future: F) -> F::Output { | 52| 1| let mut future = unsafe { Pin::new_unchecked(&mut future) }; | 53| 1| use std::hint::unreachable_unchecked; @@ -92,7 +92,7 @@ | 67| | } | 68| 1| } ------------------ - | async2::executor::block_on::<core::future::from_generator::GenFuture<async2::async_func_just_println::{closure#0}>>: + | async2::executor::block_on::<async2::async_func_just_println::{closure#0}>: | 51| 1| pub fn block_on<F: Future>(mut future: F) -> F::Output { | 52| 1| let mut future = unsafe { Pin::new_unchecked(&mut future) }; | 53| 1| use std::hint::unreachable_unchecked; diff --git a/src/test/run-make/emit-shared-files/Makefile b/src/test/run-make/emit-shared-files/Makefile index 09b4c29c1..cad0c9e5b 100644 --- a/src/test/run-make/emit-shared-files/Makefile +++ b/src/test/run-make/emit-shared-files/Makefile @@ -23,24 +23,24 @@ invocation-only: toolchain-only: $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources --output $(TOOLCHAIN_ONLY) --resource-suffix=-xxx --extend-css z.css x.rs - [ -e $(TOOLCHAIN_ONLY)/storage-xxx.js ] - ! [ -e $(TOOLCHAIN_ONLY)/SourceSerif4-It.ttf.woff2 ] + [ -e $(TOOLCHAIN_ONLY)/static.files/storage-*.js ] + [ -e $(TOOLCHAIN_ONLY)/static.files/SourceSerif4-It-*.ttf.woff2 ] ! [ -e $(TOOLCHAIN_ONLY)/search-index-xxx.js ] ! [ -e $(TOOLCHAIN_ONLY)/x/index.html ] ! [ -e $(TOOLCHAIN_ONLY)/theme.css ] - [ -e $(TOOLCHAIN_ONLY)/main-xxx.js ] + [ -e $(TOOLCHAIN_ONLY)/static.files/main-*.js ] ! [ -e $(TOOLCHAIN_ONLY)/y-xxx.css ] all-shared: $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources,unversioned-shared-resources --output $(ALL_SHARED) --resource-suffix=-xxx --extend-css z.css x.rs - [ -e $(ALL_SHARED)/storage-xxx.js ] - [ -e $(ALL_SHARED)/SourceSerif4-It.ttf.woff2 ] + [ -e $(ALL_SHARED)/static.files/storage-*.js ] + [ -e $(ALL_SHARED)/static.files/SourceSerif4-It-*.ttf.woff2 ] ! [ -e $(ALL_SHARED)/search-index-xxx.js ] ! [ -e $(ALL_SHARED)/settings.html ] ! [ -e $(ALL_SHARED)/x ] ! [ -e $(ALL_SHARED)/src ] ! [ -e $(ALL_SHARED)/theme.css ] - [ -e $(ALL_SHARED)/main-xxx.js ] + [ -e $(ALL_SHARED)/static.files/main-*.js ] ! [ -e $(ALL_SHARED)/y-xxx.css ] diff --git a/src/test/run-make/issue-36710/Makefile b/src/test/run-make/issue-36710/Makefile index 986a3f4e6..d6145c071 100644 --- a/src/test/run-make/issue-36710/Makefile +++ b/src/test/run-make/issue-36710/Makefile @@ -1,6 +1,7 @@ -# ignore-cross-compile $(call RUN,foo) expects to run the target executable natively -# so it won't work with 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/issue-88756-default-output/output-default.stdout b/src/test/run-make/issue-88756-default-output/output-default.stdout index 80cd08ee1..b28069823 100644 --- a/src/test/run-make/issue-88756-default-output/output-default.stdout +++ b/src/test/run-make/issue-88756-default-output/output-default.stdout @@ -115,8 +115,6 @@ Options: Provide width of the output for truncated error messages --json CONFIG Configure the structure of JSON diagnostics - --disable-minification - Disable minification applied on JS files -A, --allow LINT Set lint allowed -W, --warn LINT Set lint warnings --force-warn LINT @@ -173,6 +171,8 @@ Options: --scrape-tests Include test code when scraping examples --with-examples path to function call information (for displaying examples in the documentation) + --disable-minification + removed --plugin-path DIR removed, see issue #44136 <https://github.com/rust-lang/rust/issues/44136> for diff --git a/src/test/run-make/macos-deployment-target/Makefile b/src/test/run-make/macos-deployment-target/Makefile new file mode 100644 index 000000000..70fca0436 --- /dev/null +++ b/src/test/run-make/macos-deployment-target/Makefile @@ -0,0 +1,21 @@ +# only-macos +# +# Check that a set deployment target actually makes it to the linker. +# This is important since its a compatibility hazard. The linker will +# generate load commands differently based on what minimum OS it can assume. + +include ../../run-make-fulldeps/tools.mk + +ifeq ($(strip $(shell uname -m)),arm64) + GREP_PATTERN = "minos 11.0" +else + GREP_PATTERN = "version 10.9" +endif + +OUT_FILE=$(TMPDIR)/with_deployment_target.dylib +all: + env MACOSX_DEPLOYMENT_TARGET=10.9 $(RUSTC) with_deployment_target.rs -o $(OUT_FILE) +# XXX: The check is for either the x86_64 minimum OR the aarch64 minimum (M1 starts at macOS 11). +# They also use different load commands, so we let that change with each too. The aarch64 check +# isn't as robust as the x86 one, but testing both seems unneeded. + vtool -show-build $(OUT_FILE) | $(CGREP) -e $(GREP_PATTERN) diff --git a/src/test/run-make/macos-deployment-target/with_deployment_target.rs b/src/test/run-make/macos-deployment-target/with_deployment_target.rs new file mode 100644 index 000000000..342fe0ecb --- /dev/null +++ b/src/test/run-make/macos-deployment-target/with_deployment_target.rs @@ -0,0 +1,4 @@ +#![crate_type = "cdylib"] + +#[allow(dead_code)] +fn something_and_nothing() {} diff --git a/src/test/run-make/native-link-modifier-verbatim-linker/Makefile b/src/test/run-make/native-link-modifier-verbatim-linker/Makefile index e56e1e94e..666e4084c 100644 --- a/src/test/run-make/native-link-modifier-verbatim-linker/Makefile +++ b/src/test/run-make/native-link-modifier-verbatim-linker/Makefile @@ -6,10 +6,10 @@ 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 + $(RUSTC) main.rs -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" + $(RUSTC) main.rs -l static:+verbatim=local_native_dep 2>&1 | $(CGREP) "local_native_dep" diff --git a/src/test/run-make/native-link-modifier-verbatim-rustc/Makefile b/src/test/run-make/native-link-modifier-verbatim-rustc/Makefile index 1093b1cd3..6f01f3780 100644 --- a/src/test/run-make/native-link-modifier-verbatim-rustc/Makefile +++ b/src/test/run-make/native-link-modifier-verbatim-rustc/Makefile @@ -3,10 +3,10 @@ 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 + $(RUSTC) rust_dep.rs -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" + $(RUSTC) rust_dep.rs -l static:+verbatim=upstream_native_dep --crate-type rlib 2>&1 | $(CGREP) "upstream_native_dep" diff --git a/src/test/run-make/raw-dylib-c/lib.rs b/src/test/run-make/raw-dylib-c/lib.rs index 005ffcdda..5fb120403 100644 --- a/src/test/run-make/raw-dylib-c/lib.rs +++ b/src/test/run-make/raw-dylib-c/lib.rs @@ -1,4 +1,4 @@ -#![feature(raw_dylib, native_link_modifiers_verbatim)] +#![feature(raw_dylib)] #[link(name = "extern_1.dll", kind = "raw-dylib", modifiers = "+verbatim")] extern { diff --git a/src/test/run-make/raw-dylib-import-name-type/driver.rs b/src/test/run-make/raw-dylib-import-name-type/driver.rs index a38849fc8..9a3cd9ebe 100644 --- a/src/test/run-make/raw-dylib-import-name-type/driver.rs +++ b/src/test/run-make/raw-dylib-import-name-type/driver.rs @@ -3,6 +3,7 @@ #[link(name = "extern", kind = "raw-dylib", import_name_type = "undecorated")] extern "C" { + fn LooksLikeAPrivateGlobal(i: i32); fn cdecl_fn_undecorated(i: i32); #[link_name = "cdecl_fn_undecorated2"] fn cdecl_fn_undecorated_renamed(i: i32); @@ -84,6 +85,13 @@ extern { pub fn main() { unsafe { + // Regression test for #104453 + // On x86 LLVM uses 'L' as the prefix for private globals (PrivateGlobalPrefix), which + // causes it to believe that undecorated functions starting with 'L' are actually temporary + // symbols that it generated, which causes a later check to fail as the symbols we are + // creating don't have definitions (whereas all temporary symbols do). + LooksLikeAPrivateGlobal(13); + cdecl_fn_undecorated(1); cdecl_fn_undecorated_renamed(10); cdecl_fn_noprefix(2); diff --git a/src/test/run-make/raw-dylib-import-name-type/extern.c b/src/test/run-make/raw-dylib-import-name-type/extern.c index 195126d51..23c1e489e 100644 --- a/src/test/run-make/raw-dylib-import-name-type/extern.c +++ b/src/test/run-make/raw-dylib-import-name-type/extern.c @@ -1,6 +1,11 @@ #include <stdio.h> #include <stdint.h> +void _cdecl LooksLikeAPrivateGlobal(int i) { + printf("LooksLikeAPrivateGlobal(%d)\n", i); + fflush(stdout); +} + void _cdecl cdecl_fn_undecorated(int i) { printf("cdecl_fn_undecorated(%d)\n", i); fflush(stdout); diff --git a/src/test/run-make/raw-dylib-import-name-type/extern.gnu.def b/src/test/run-make/raw-dylib-import-name-type/extern.gnu.def index a523c959a..498e90e86 100644 --- a/src/test/run-make/raw-dylib-import-name-type/extern.gnu.def +++ b/src/test/run-make/raw-dylib-import-name-type/extern.gnu.def @@ -1,5 +1,6 @@ LIBRARY extern EXPORTS + LooksLikeAPrivateGlobal cdecl_fn_undecorated cdecl_fn_undecorated2 cdecl_fn_noprefix diff --git a/src/test/run-make/raw-dylib-import-name-type/extern.msvc.def b/src/test/run-make/raw-dylib-import-name-type/extern.msvc.def index dbff32d4c..cddb88bb8 100644 --- a/src/test/run-make/raw-dylib-import-name-type/extern.msvc.def +++ b/src/test/run-make/raw-dylib-import-name-type/extern.msvc.def @@ -1,5 +1,6 @@ LIBRARY extern EXPORTS + LooksLikeAPrivateGlobal cdecl_fn_undecorated cdecl_fn_undecorated2 cdecl_fn_noprefix diff --git a/src/test/run-make/raw-dylib-import-name-type/output.txt b/src/test/run-make/raw-dylib-import-name-type/output.txt index 707faf403..a2a2bfeec 100644 --- a/src/test/run-make/raw-dylib-import-name-type/output.txt +++ b/src/test/run-make/raw-dylib-import-name-type/output.txt @@ -1,3 +1,4 @@ +LooksLikeAPrivateGlobal(13) cdecl_fn_undecorated(1) cdecl_fn_undecorated2(10) cdecl_fn_noprefix(2) diff --git a/src/test/run-make/repr128-dwarf/Makefile b/src/test/run-make/repr128-dwarf/Makefile new file mode 100644 index 000000000..a840e3ee6 --- /dev/null +++ b/src/test/run-make/repr128-dwarf/Makefile @@ -0,0 +1,16 @@ +# ignore-windows +# This test should be replaced with one in src/test/debuginfo once GDB or LLDB support 128-bit +# enums. + +include ../../run-make-fulldeps/tools.mk + +all: + $(RUSTC) -Cdebuginfo=2 lib.rs -o $(TMPDIR)/repr128.rlib + "$(LLVM_BIN_DIR)"/llvm-dwarfdump -n U128A $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 )" + "$(LLVM_BIN_DIR)"/llvm-dwarfdump -n U128B $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 )" + "$(LLVM_BIN_DIR)"/llvm-dwarfdump -n U128C $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 )" + "$(LLVM_BIN_DIR)"/llvm-dwarfdump -n U128D $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff )" + "$(LLVM_BIN_DIR)"/llvm-dwarfdump -n I128A $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 )" + "$(LLVM_BIN_DIR)"/llvm-dwarfdump -n I128B $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff )" + "$(LLVM_BIN_DIR)"/llvm-dwarfdump -n I128C $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 )" + "$(LLVM_BIN_DIR)"/llvm-dwarfdump -n I128D $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 7f )" diff --git a/src/test/run-make/repr128-dwarf/lib.rs b/src/test/run-make/repr128-dwarf/lib.rs new file mode 100644 index 000000000..63675441d --- /dev/null +++ b/src/test/run-make/repr128-dwarf/lib.rs @@ -0,0 +1,23 @@ +#![crate_type = "lib"] +#![feature(repr128)] + +// Use .to_le() to ensure that the bytes are in the same order on both little- and big-endian +// platforms. + +#[repr(u128)] +pub enum U128Enum { + U128A = 0_u128.to_le(), + U128B = 1_u128.to_le(), + U128C = (u64::MAX as u128 + 1).to_le(), + U128D = u128::MAX.to_le(), +} + +#[repr(i128)] +pub enum I128Enum { + I128A = 0_i128.to_le(), + I128B = (-1_i128).to_le(), + I128C = i128::MIN.to_le(), + I128D = i128::MAX.to_le(), +} + +pub fn f(_: U128Enum, _: I128Enum) {} 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 new file mode 100644 index 000000000..4574cf17f --- /dev/null +++ b/src/test/run-make/rlib-format-packed-bundled-libs-2/Makefile @@ -0,0 +1,22 @@ +-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 new file mode 100644 index 000000000..8d2b8a285 --- /dev/null +++ b/src/test/run-make/rlib-format-packed-bundled-libs-2/main.rs @@ -0,0 +1,5 @@ +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 new file mode 100644 index 000000000..321a8237e --- /dev/null +++ b/src/test/run-make/rlib-format-packed-bundled-libs-2/native_dep.rs @@ -0,0 +1,4 @@ +#[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 new file mode 100644 index 000000000..77e41e237 --- /dev/null +++ b/src/test/run-make/rlib-format-packed-bundled-libs-2/rust_dep.rs @@ -0,0 +1,10 @@ +#[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 new file mode 100644 index 000000000..0b991ac42 --- /dev/null +++ b/src/test/run-make/rlib-format-packed-bundled-libs/Makefile @@ -0,0 +1,34 @@ +-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 new file mode 100644 index 000000000..042a4879f --- /dev/null +++ b/src/test/run-make/rlib-format-packed-bundled-libs/main.rs @@ -0,0 +1,4 @@ +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 new file mode 100644 index 000000000..07be8562c --- /dev/null +++ b/src/test/run-make/rlib-format-packed-bundled-libs/native_dep_1.c @@ -0,0 +1 @@ +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 new file mode 100644 index 000000000..a1b94e40d --- /dev/null +++ b/src/test/run-make/rlib-format-packed-bundled-libs/native_dep_2.c @@ -0,0 +1 @@ +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 new file mode 100644 index 000000000..f81f397a4 --- /dev/null +++ b/src/test/run-make/rlib-format-packed-bundled-libs/native_dep_3.c @@ -0,0 +1 @@ +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 new file mode 100644 index 000000000..8280c7d6c --- /dev/null +++ b/src/test/run-make/rlib-format-packed-bundled-libs/rust_dep_local.rs @@ -0,0 +1,13 @@ +#[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 new file mode 100644 index 000000000..edcd7c521 --- /dev/null +++ b/src/test/run-make/rlib-format-packed-bundled-libs/rust_dep_up.rs @@ -0,0 +1,13 @@ +#[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); + } +} diff --git a/src/test/run-make/rustdoc-verify-output-files/Makefile b/src/test/run-make/rustdoc-verify-output-files/Makefile new file mode 100644 index 000000000..bfabbbc65 --- /dev/null +++ b/src/test/run-make/rustdoc-verify-output-files/Makefile @@ -0,0 +1,36 @@ +include ../../run-make-fulldeps/tools.mk + +OUTPUT_DIR := "$(TMPDIR)/rustdoc" +TMP_OUTPUT_DIR := "$(TMPDIR)/tmp-rustdoc" + +all: + # Generate html docs + $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR) + + # Copy first output for to check if it's exactly same after second compilation + cp -R $(OUTPUT_DIR) $(TMP_OUTPUT_DIR) + + # Generate html docs once again on same output + $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR) + + # Check if everything exactly same + $(DIFF) -r -q $(OUTPUT_DIR) $(TMP_OUTPUT_DIR) + + # Generate json doc on the same output + $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR) -Z unstable-options --output-format json + + # Check if expected json file is generated + [ -e $(OUTPUT_DIR)/foobar.json ] + + # TODO + # We should re-generate json doc once again and compare the diff with previously + # generated one. Because layout of json docs changes in each compilation, we can't + # do that currently. + # + # See https://github.com/rust-lang/rust/issues/103785#issuecomment-1307425590 for details. + + # remove generated json doc + rm $(OUTPUT_DIR)/foobar.json + + # Check if json doc compilation broke any of the html files generated previously + $(DIFF) -r -q $(OUTPUT_DIR) $(TMP_OUTPUT_DIR) diff --git a/src/test/run-make/rustdoc-verify-output-files/src/lib.rs b/src/test/run-make/rustdoc-verify-output-files/src/lib.rs new file mode 100644 index 000000000..5df757613 --- /dev/null +++ b/src/test/run-make/rustdoc-verify-output-files/src/lib.rs @@ -0,0 +1 @@ +// nothing to see here diff --git a/src/test/run-make/test-benches/Makefile b/src/test/run-make/test-benches/Makefile new file mode 100644 index 000000000..8fc122515 --- /dev/null +++ b/src/test/run-make/test-benches/Makefile @@ -0,0 +1,11 @@ +include ../../run-make-fulldeps/tools.mk + +# ignore-cross-compile + +all: + # Smoke-test that `#[bench]` isn't entirely broken. + $(RUSTC) --test smokebench.rs -O + $(call RUN,smokebench --bench) + $(call RUN,smokebench --bench noiter) + $(call RUN,smokebench --bench yesiter) + $(call RUN,smokebench) diff --git a/src/test/run-make/test-benches/smokebench.rs b/src/test/run-make/test-benches/smokebench.rs new file mode 100644 index 000000000..ef5e5a620 --- /dev/null +++ b/src/test/run-make/test-benches/smokebench.rs @@ -0,0 +1,14 @@ +#![feature(test)] +extern crate test; + +#[bench] +fn smoke_yesiter(b: &mut test::Bencher) { + let mut i = 0usize; + b.iter(|| { + i = i.wrapping_add(1); + i + }) +} + +#[bench] +fn smoke_noiter(_: &mut test::Bencher) {} diff --git a/src/test/run-make/translation/broken.ftl b/src/test/run-make/translation/broken.ftl index 4e3585835..f1dd6ff0b 100644 --- a/src/test/run-make/translation/broken.ftl +++ b/src/test/run-make/translation/broken.ftl @@ -1,3 +1,3 @@ # `foo` isn't provided by this diagnostic so it is expected that the fallback message is used. -parser_struct_literal_body_without_path = this is a {$foo} message +parse_struct_literal_body_without_path = this is a {$foo} message .suggestion = this is a test suggestion diff --git a/src/test/run-make/translation/missing.ftl b/src/test/run-make/translation/missing.ftl index 77bbda357..6be24dc7b 100644 --- a/src/test/run-make/translation/missing.ftl +++ b/src/test/run-make/translation/missing.ftl @@ -1,3 +1,3 @@ -# `parser_struct_literal_body_without_path` isn't provided by this resource at all, so the +# `parse_struct_literal_body_without_path` isn't provided by this resource at all, so the # fallback should be used. foo = bar diff --git a/src/test/run-make/translation/working.ftl b/src/test/run-make/translation/working.ftl index d5ea86738..50d126e3f 100644 --- a/src/test/run-make/translation/working.ftl +++ b/src/test/run-make/translation/working.ftl @@ -1,2 +1,2 @@ -parser_struct_literal_body_without_path = this is a test message +parse_struct_literal_body_without_path = this is a test message .suggestion = this is a test suggestion diff --git a/src/test/run-make/valid-print-requests/Makefile b/src/test/run-make/valid-print-requests/Makefile new file mode 100644 index 000000000..c325e536e --- /dev/null +++ b/src/test/run-make/valid-print-requests/Makefile @@ -0,0 +1,4 @@ +include ../../run-make-fulldeps/tools.mk + +all: + $(RUSTC) --print uwu 2>&1 | diff - valid-print-requests.stderr diff --git a/src/test/run-make/valid-print-requests/valid-print-requests.stderr b/src/test/run-make/valid-print-requests/valid-print-requests.stderr new file mode 100644 index 000000000..5191e4676 --- /dev/null +++ b/src/test/run-make/valid-print-requests/valid-print-requests.stderr @@ -0,0 +1,2 @@ +error: unknown print request `uwu`. Valid print requests are: `crate-name`, `file-names`, `sysroot`, `target-libdir`, `cfg`, `calling-conventions`, `target-list`, `target-cpus`, `target-features`, `relocation-models`, `code-models`, `tls-models`, `native-static-libs`, `stack-protector-strategies`, `target-spec-json`, `link-args`, `split-debuginfo` + |