From 433da1fc047bb39a263eefca4bdb2b1972f1d2ce Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 30 Mar 2023 07:34:55 -0500 Subject: Move almost all run-make-fulldeps to run-make They pass fine. --- .../run-make-fulldeps/a-b-a-linker-guard/Makefile | 15 - tests/run-make-fulldeps/a-b-a-linker-guard/a.rs | 8 - tests/run-make-fulldeps/a-b-a-linker-guard/b.rs | 7 - .../alloc-no-oom-handling/Makefile | 4 - tests/run-make-fulldeps/alloc-no-rc/Makefile | 4 - tests/run-make-fulldeps/alloc-no-sync/Makefile | 4 - .../allow-non-lint-warnings-cmdline/Makefile | 11 - .../allow-non-lint-warnings-cmdline/foo.rs | 5 - .../allow-warnings-cmdline-stability/Makefile | 15 - .../allow-warnings-cmdline-stability/bar.rs | 5 - .../allow-warnings-cmdline-stability/foo.rs | 5 - .../archive-duplicate-names/Makefile | 11 - .../archive-duplicate-names/bar.c | 1 - .../archive-duplicate-names/bar.rs | 5 - .../archive-duplicate-names/foo.c | 1 - .../archive-duplicate-names/foo.rs | 14 - .../arguments-non-c-like-enum/Makefile | 7 - .../arguments-non-c-like-enum/nonclike.rs | 31 -- .../arguments-non-c-like-enum/test.c | 66 ----- tests/run-make-fulldeps/atomic-lock-free/Makefile | 48 ---- .../atomic-lock-free/atomic_lock_free.rs | 66 ----- tests/run-make-fulldeps/bare-outfile/Makefile | 6 - tests/run-make-fulldeps/bare-outfile/foo.rs | 2 - tests/run-make-fulldeps/c-dynamic-dylib/Makefile | 12 - tests/run-make-fulldeps/c-dynamic-dylib/bar.rs | 5 - tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c | 4 - tests/run-make-fulldeps/c-dynamic-dylib/foo.rs | 10 - tests/run-make-fulldeps/c-dynamic-rlib/Makefile | 15 - tests/run-make-fulldeps/c-dynamic-rlib/bar.rs | 5 - tests/run-make-fulldeps/c-dynamic-rlib/cfoo.c | 4 - tests/run-make-fulldeps/c-dynamic-rlib/foo.rs | 10 - .../c-link-to-rust-dylib/Makefile | 17 -- tests/run-make-fulldeps/c-link-to-rust-dylib/bar.c | 6 - .../run-make-fulldeps/c-link-to-rust-dylib/foo.rs | 4 - .../c-link-to-rust-staticlib/Makefile | 12 - .../c-link-to-rust-staticlib/bar.c | 6 - .../c-link-to-rust-staticlib/foo.rs | 4 - .../c-link-to-rust-va-list-fn/Makefile | 6 - .../c-link-to-rust-va-list-fn/checkrust.rs | 148 ---------- .../c-link-to-rust-va-list-fn/test.c | 50 ---- tests/run-make-fulldeps/c-static-dylib/Makefile | 9 - tests/run-make-fulldeps/c-static-dylib/bar.rs | 5 - tests/run-make-fulldeps/c-static-dylib/cfoo.c | 1 - tests/run-make-fulldeps/c-static-dylib/foo.rs | 10 - tests/run-make-fulldeps/c-static-rlib/Makefile | 8 - tests/run-make-fulldeps/c-static-rlib/bar.rs | 5 - tests/run-make-fulldeps/c-static-rlib/cfoo.c | 1 - tests/run-make-fulldeps/c-static-rlib/foo.rs | 10 - .../c-unwind-abi-catch-lib-panic/Makefile | 30 -- .../c-unwind-abi-catch-lib-panic/add.c | 12 - .../c-unwind-abi-catch-lib-panic/main.rs | 35 --- .../c-unwind-abi-catch-lib-panic/panic.rs | 12 - .../c-unwind-abi-catch-panic/Makefile | 5 - .../c-unwind-abi-catch-panic/add.c | 12 - .../c-unwind-abi-catch-panic/main.rs | 44 --- .../cat-and-grep-sanity-check/Makefile | 46 --- .../cdylib-dylib-linkage/Makefile | 27 -- .../run-make-fulldeps/cdylib-dylib-linkage/bar.rs | 5 - tests/run-make-fulldeps/cdylib-dylib-linkage/foo.c | 10 - .../run-make-fulldeps/cdylib-dylib-linkage/foo.rs | 13 - .../cdylib-fewer-symbols/Makefile | 12 - .../run-make-fulldeps/cdylib-fewer-symbols/foo.rs | 6 - tests/run-make-fulldeps/cdylib/Makefile | 19 -- tests/run-make-fulldeps/cdylib/bar.rs | 5 - tests/run-make-fulldeps/cdylib/foo.c | 10 - tests/run-make-fulldeps/cdylib/foo.rs | 13 - .../codegen-options-parsing/Makefile | 31 -- .../codegen-options-parsing/dummy.rs | 1 - tests/run-make-fulldeps/compile-stdin/Makefile | 5 - .../compiler-lookup-paths-2/Makefile | 8 - .../run-make-fulldeps/compiler-lookup-paths-2/a.rs | 1 - .../run-make-fulldeps/compiler-lookup-paths-2/b.rs | 2 - .../run-make-fulldeps/compiler-lookup-paths-2/c.rs | 3 - .../compiler-lookup-paths/Makefile | 38 --- tests/run-make-fulldeps/compiler-lookup-paths/a.rs | 1 - tests/run-make-fulldeps/compiler-lookup-paths/b.rs | 2 - tests/run-make-fulldeps/compiler-lookup-paths/c.rs | 2 - tests/run-make-fulldeps/compiler-lookup-paths/d.rs | 4 - tests/run-make-fulldeps/compiler-lookup-paths/e.rs | 2 - .../run-make-fulldeps/compiler-lookup-paths/e2.rs | 4 - tests/run-make-fulldeps/compiler-lookup-paths/f.rs | 2 - .../compiler-lookup-paths/native.c | 1 - .../compiler-rt-works-on-mingw/Makefile | 9 - .../compiler-rt-works-on-mingw/foo.cpp | 4 - .../compiler-rt-works-on-mingw/foo.rs | 10 - .../core-no-fp-fmt-parse/Makefile | 4 - tests/run-make-fulldeps/crate-data-smoke/Makefile | 10 - tests/run-make-fulldeps/crate-data-smoke/crate.rs | 7 - tests/run-make-fulldeps/crate-data-smoke/lib.rs | 2 - tests/run-make-fulldeps/crate-data-smoke/rlib.rs | 2 - .../crate-hash-rustc-version/Makefile | 37 --- .../crate-hash-rustc-version/a.rs | 4 - .../crate-hash-rustc-version/b.rs | 8 - .../run-make-fulldeps/crate-name-priority/Makefile | 11 - tests/run-make-fulldeps/crate-name-priority/foo.rs | 1 - .../run-make-fulldeps/crate-name-priority/foo1.rs | 3 - .../cross-lang-lto-clang/Makefile | 25 -- .../run-make-fulldeps/cross-lang-lto-clang/clib.c | 9 - .../run-make-fulldeps/cross-lang-lto-clang/cmain.c | 12 - .../run-make-fulldeps/cross-lang-lto-clang/main.rs | 11 - .../cross-lang-lto-clang/rustlib.rs | 12 - .../cross-lang-lto-pgo-smoketest/Makefile | 87 ------ .../cross-lang-lto-pgo-smoketest/clib.c | 9 - .../cross-lang-lto-pgo-smoketest/cmain.c | 12 - .../cross-lang-lto-pgo-smoketest/main.rs | 11 - .../cross-lang-lto-pgo-smoketest/rustlib.rs | 12 - .../cross-lang-lto-upstream-rlibs/Makefile | 32 --- .../cross-lang-lto-upstream-rlibs/staticlib.rs | 8 - .../cross-lang-lto-upstream-rlibs/upstream.rs | 3 - tests/run-make-fulldeps/cross-lang-lto/Makefile | 57 ---- tests/run-make-fulldeps/cross-lang-lto/lib.rs | 4 - tests/run-make-fulldeps/cross-lang-lto/main.rs | 3 - tests/run-make-fulldeps/debug-assertions/Makefile | 25 -- tests/run-make-fulldeps/debug-assertions/debug.rs | 33 --- .../dep-info-doesnt-run-much/Makefile | 4 - .../dep-info-doesnt-run-much/foo.rs | 5 - tests/run-make-fulldeps/dep-info-spaces/Makefile | 19 -- .../run-make-fulldeps/dep-info-spaces/Makefile.foo | 7 - tests/run-make-fulldeps/dep-info-spaces/bar.rs | 1 - tests/run-make-fulldeps/dep-info-spaces/foo foo.rs | 1 - tests/run-make-fulldeps/dep-info-spaces/lib.rs | 4 - tests/run-make-fulldeps/dep-info/Makefile | 25 -- tests/run-make-fulldeps/dep-info/Makefile.foo | 7 - tests/run-make-fulldeps/dep-info/bar.rs | 1 - tests/run-make-fulldeps/dep-info/foo.rs | 1 - tests/run-make-fulldeps/dep-info/lib.rs | 4 - tests/run-make-fulldeps/dep-info/lib2.rs | 3 - .../doctests-keep-binaries/Makefile | 21 -- .../run-make-fulldeps/doctests-keep-binaries/t.rs | 11 - .../duplicate-output-flavors/Makefile | 5 - .../duplicate-output-flavors/foo.rs | 1 - tests/run-make-fulldeps/dylib-chain/Makefile | 12 - tests/run-make-fulldeps/dylib-chain/m1.rs | 2 - tests/run-make-fulldeps/dylib-chain/m2.rs | 4 - tests/run-make-fulldeps/dylib-chain/m3.rs | 4 - tests/run-make-fulldeps/dylib-chain/m4.rs | 3 - tests/run-make-fulldeps/emit-stack-sizes/Makefile | 12 - tests/run-make-fulldeps/emit-stack-sizes/foo.rs | 3 - tests/run-make-fulldeps/emit/Makefile | 21 -- tests/run-make-fulldeps/emit/test-24876.rs | 9 - tests/run-make-fulldeps/emit/test-26235.rs | 46 --- .../error-found-staticlib-instead-crate/Makefile | 5 - .../error-found-staticlib-instead-crate/bar.rs | 5 - .../error-found-staticlib-instead-crate/foo.rs | 1 - .../error-writing-dependencies/Makefile | 8 - .../error-writing-dependencies/foo.rs | 1 - tests/run-make-fulldeps/exit-code/Makefile | 11 - tests/run-make-fulldeps/exit-code/compile-error.rs | 3 - tests/run-make-fulldeps/exit-code/lint-failure.rs | 6 - tests/run-make-fulldeps/exit-code/success.rs | 4 - .../extern-diff-internal-name/Makefile | 5 - .../extern-diff-internal-name/lib.rs | 2 - .../extern-diff-internal-name/test.rs | 5 - .../extern-flag-disambiguates/Makefile | 25 -- .../extern-flag-disambiguates/a.rs | 6 - .../extern-flag-disambiguates/b.rs | 9 - .../extern-flag-disambiguates/c.rs | 9 - .../extern-flag-disambiguates/d.rs | 11 - tests/run-make-fulldeps/extern-flag-fun/Makefile | 19 -- tests/run-make-fulldeps/extern-flag-fun/bar-alt.rs | 1 - tests/run-make-fulldeps/extern-flag-fun/bar.rs | 1 - tests/run-make-fulldeps/extern-flag-fun/foo.rs | 3 - .../extern-flag-fun/gated_unstable.rs | 3 - tests/run-make-fulldeps/extern-flag-fun/rustc.rs | 1 - .../extern-flag-pathless/Makefile | 18 -- .../extern-flag-pathless/bar-dynamic.rs | 3 - .../extern-flag-pathless/bar-static.rs | 3 - .../run-make-fulldeps/extern-flag-pathless/foo.rs | 3 - .../extern-flag-rename-transitive/Makefile | 7 - .../extern-flag-rename-transitive/bar.rs | 3 - .../extern-flag-rename-transitive/baz.rs | 4 - .../extern-flag-rename-transitive/foo.rs | 1 - tests/run-make-fulldeps/extern-fn-generic/Makefile | 6 - tests/run-make-fulldeps/extern-fn-generic/test.c | 16 -- tests/run-make-fulldeps/extern-fn-generic/test.rs | 20 -- .../extern-fn-generic/testcrate.rs | 16 -- tests/run-make-fulldeps/extern-fn-mangle/Makefile | 5 - tests/run-make-fulldeps/extern-fn-mangle/test.c | 8 - tests/run-make-fulldeps/extern-fn-mangle/test.rs | 19 -- .../run-make-fulldeps/extern-fn-reachable/Makefile | 25 -- .../run-make-fulldeps/extern-fn-reachable/dylib.rs | 14 - .../extern-fn-struct-passing-abi/Makefile | 5 - .../extern-fn-struct-passing-abi/test.c | 314 --------------------- .../extern-fn-struct-passing-abi/test.rs | 138 --------- .../extern-fn-with-extern-types/Makefile | 5 - .../extern-fn-with-extern-types/ctest.c | 16 -- .../extern-fn-with-extern-types/test.rs | 17 -- .../extern-fn-with-packed-struct/Makefile | 5 - .../extern-fn-with-packed-struct/test.c | 26 -- .../extern-fn-with-packed-struct/test.rs | 20 -- .../extern-fn-with-union/Makefile | 6 - .../run-make-fulldeps/extern-fn-with-union/ctest.c | 10 - .../run-make-fulldeps/extern-fn-with-union/test.rs | 19 -- .../extern-fn-with-union/testcrate.rs | 11 - .../extern-multiple-copies/Makefile | 8 - .../extern-multiple-copies/bar.rs | 6 - .../extern-multiple-copies/foo1.rs | 1 - .../extern-multiple-copies/foo2.rs | 1 - .../extern-multiple-copies2/Makefile | 10 - .../extern-multiple-copies2/bar.rs | 8 - .../extern-multiple-copies2/foo1.rs | 7 - .../extern-multiple-copies2/foo2.rs | 8 - .../extern-overrides-distribution/Makefile | 5 - .../extern-overrides-distribution/libc.rs | 3 - .../extern-overrides-distribution/main.rs | 5 - .../extra-filename-with-temp-outputs/Makefile | 6 - .../extra-filename-with-temp-outputs/foo.rs | 1 - .../foreign-double-unwind/Makefile | 10 - .../foreign-double-unwind/foo.cpp | 33 --- .../run-make-fulldeps/foreign-double-unwind/foo.rs | 26 -- .../run-make-fulldeps/foreign-exceptions/Makefile | 10 - tests/run-make-fulldeps/foreign-exceptions/foo.cpp | 60 ---- tests/run-make-fulldeps/foreign-exceptions/foo.rs | 59 ---- .../foreign-rust-exceptions/Makefile | 11 - .../foreign-rust-exceptions/bar.rs | 7 - .../foreign-rust-exceptions/foo.rs | 13 - tests/run-make-fulldeps/fpic/Makefile | 10 - tests/run-make-fulldeps/fpic/hello.rs | 1 - .../glibc-staticlib-args/Makefile | 12 - .../glibc-staticlib-args/library.rs | 4 - .../glibc-staticlib-args/program.c | 6 - tests/run-make-fulldeps/hir-tree/Makefile | 8 - tests/run-make-fulldeps/hir-tree/input.rs | 3 - .../hotplug_codegen_backend/Makefile | 26 -- .../hotplug_codegen_backend/some_crate.rs | 2 - .../hotplug_codegen_backend/the_backend.rs | 84 ------ .../run-make-fulldeps/include_bytes_deps/Makefile | 7 - .../run-make-fulldeps/include_bytes_deps/input.bin | 1 - .../run-make-fulldeps/include_bytes_deps/input.md | 1 - .../run-make-fulldeps/include_bytes_deps/input.txt | 1 - tests/run-make-fulldeps/include_bytes_deps/main.rs | 10 - .../incr-add-rust-src-component/Makefile | 44 --- .../incr-add-rust-src-component/main.rs | 3 - .../inline-always-many-cgu/Makefile | 8 - .../inline-always-many-cgu/foo.rs | 15 - .../interdependent-c-libraries/Makefile | 14 - .../interdependent-c-libraries/bar.c | 3 - .../interdependent-c-libraries/bar.rs | 14 - .../interdependent-c-libraries/foo.c | 1 - .../interdependent-c-libraries/foo.rs | 12 - .../interdependent-c-libraries/main.rs | 6 - .../intrinsic-unreachable/Makefile | 12 - .../intrinsic-unreachable/exit-ret.rs | 14 - .../intrinsic-unreachable/exit-unreachable.rs | 18 -- tests/run-make-fulldeps/invalid-library/Makefile | 6 - tests/run-make-fulldeps/invalid-library/foo.rs | 3 - tests/run-make-fulldeps/invalid-staticlib/Makefile | 5 - tests/run-make-fulldeps/issue-11908/Makefile | 21 -- tests/run-make-fulldeps/issue-11908/bar.rs | 3 - tests/run-make-fulldeps/issue-11908/foo.rs | 1 - tests/run-make-fulldeps/issue-14500/Makefile | 13 - tests/run-make-fulldeps/issue-14500/bar.rs | 1 - tests/run-make-fulldeps/issue-14500/foo.c | 7 - tests/run-make-fulldeps/issue-14500/foo.rs | 5 - tests/run-make-fulldeps/issue-14698/Makefile | 4 - tests/run-make-fulldeps/issue-14698/foo.rs | 1 - tests/run-make-fulldeps/issue-15460/Makefile | 6 - tests/run-make-fulldeps/issue-15460/bar.rs | 4 - tests/run-make-fulldeps/issue-15460/foo.c | 6 - tests/run-make-fulldeps/issue-15460/foo.rs | 6 - tests/run-make-fulldeps/issue-18943/Makefile | 7 - tests/run-make-fulldeps/issue-18943/foo.rs | 5 - tests/run-make-fulldeps/issue-20626/Makefile | 8 - tests/run-make-fulldeps/issue-20626/foo.rs | 13 - tests/run-make-fulldeps/issue-22131/Makefile | 7 - tests/run-make-fulldeps/issue-22131/foo.rs | 5 - tests/run-make-fulldeps/issue-24445/Makefile | 10 - tests/run-make-fulldeps/issue-24445/foo.c | 6 - tests/run-make-fulldeps/issue-24445/foo.rs | 15 - tests/run-make-fulldeps/issue-25581/Makefile | 5 - tests/run-make-fulldeps/issue-25581/test.c | 15 - tests/run-make-fulldeps/issue-25581/test.rs | 18 -- tests/run-make-fulldeps/issue-26006/Makefile | 16 -- tests/run-make-fulldeps/issue-26006/in/libc/lib.rs | 3 - tests/run-make-fulldeps/issue-26006/in/time/lib.rs | 4 - tests/run-make-fulldeps/issue-26092/Makefile | 6 - tests/run-make-fulldeps/issue-26092/blank.rs | 1 - tests/run-make-fulldeps/issue-28595/Makefile | 6 - tests/run-make-fulldeps/issue-28595/a.c | 1 - tests/run-make-fulldeps/issue-28595/a.rs | 6 - tests/run-make-fulldeps/issue-28595/b.c | 5 - tests/run-make-fulldeps/issue-28595/b.rs | 12 - tests/run-make-fulldeps/issue-28766/Makefile | 5 - tests/run-make-fulldeps/issue-28766/foo.rs | 8 - tests/run-make-fulldeps/issue-28766/main.rs | 7 - tests/run-make-fulldeps/issue-30063/Makefile | 35 --- tests/run-make-fulldeps/issue-30063/foo.rs | 1 - tests/run-make-fulldeps/issue-33329/Makefile | 5 - tests/run-make-fulldeps/issue-33329/main.rs | 1 - tests/run-make-fulldeps/issue-35164/Makefile | 4 - tests/run-make-fulldeps/issue-35164/main.rs | 5 - .../run-make-fulldeps/issue-35164/submodule/mod.rs | 3 - tests/run-make-fulldeps/issue-37839/Makefile | 6 - tests/run-make-fulldeps/issue-37839/a.rs | 2 - tests/run-make-fulldeps/issue-37839/b.rs | 2 - tests/run-make-fulldeps/issue-37839/c.rs | 2 - tests/run-make-fulldeps/issue-37893/Makefile | 4 - tests/run-make-fulldeps/issue-37893/a.rs | 2 - tests/run-make-fulldeps/issue-37893/b.rs | 2 - tests/run-make-fulldeps/issue-37893/c.rs | 3 - tests/run-make-fulldeps/issue-38237/Makefile | 5 - tests/run-make-fulldeps/issue-38237/bar.rs | 4 - tests/run-make-fulldeps/issue-38237/baz.rs | 8 - tests/run-make-fulldeps/issue-38237/foo.rs | 9 - tests/run-make-fulldeps/issue-40535/Makefile | 13 - tests/run-make-fulldeps/issue-40535/bar.rs | 3 - tests/run-make-fulldeps/issue-40535/baz.rs | 1 - tests/run-make-fulldeps/issue-40535/foo.rs | 4 - tests/run-make-fulldeps/issue-46239/Makefile | 5 - tests/run-make-fulldeps/issue-46239/main.rs | 8 - tests/run-make-fulldeps/issue-47551/Makefile | 9 - .../issue-47551/eh_frame-terminator.rs | 22 -- tests/run-make-fulldeps/issue-51671/Makefile | 9 - tests/run-make-fulldeps/issue-51671/app.rs | 20 -- tests/run-make-fulldeps/issue-53964/Makefile | 5 - tests/run-make-fulldeps/issue-53964/app.rs | 8 - tests/run-make-fulldeps/issue-53964/panic.rs | 10 - tests/run-make-fulldeps/issue-64153/Makefile | 26 -- tests/run-make-fulldeps/issue-64153/downstream.rs | 6 - tests/run-make-fulldeps/issue-64153/upstream.rs | 6 - .../issue-68794-textrel-on-minimal-lib/Makefile | 17 -- .../issue-68794-textrel-on-minimal-lib/bar.c | 6 - .../issue-68794-textrel-on-minimal-lib/foo.rs | 8 - tests/run-make-fulldeps/issue-69368/Makefile | 18 -- tests/run-make-fulldeps/issue-69368/a.rs | 26 -- tests/run-make-fulldeps/issue-69368/b.rs | 8 - tests/run-make-fulldeps/issue-69368/c.rs | 34 --- tests/run-make-fulldeps/issue-7349/Makefile | 11 - tests/run-make-fulldeps/issue-7349/foo.rs | 22 -- tests/run-make-fulldeps/issue-83045/Makefile | 33 --- tests/run-make-fulldeps/issue-83045/a.rs | 1 - tests/run-make-fulldeps/issue-83045/b.rs | 1 - tests/run-make-fulldeps/issue-83045/c.rs | 1 - .../issue-84395-lto-embed-bitcode/Makefile | 11 - .../issue-84395-lto-embed-bitcode/test.rs | 3 - .../issue-97463-abi-param-passing/Makefile | 14 - .../issue-97463-abi-param-passing/bad.c | 24 -- .../issue-97463-abi-param-passing/param_passing.rs | 38 --- tests/run-make-fulldeps/issue64319/Makefile | 39 --- tests/run-make-fulldeps/issue64319/bar.rs | 5 - tests/run-make-fulldeps/issue64319/foo.rs | 9 - .../libs-through-symlinks/Makefile | 11 - .../run-make-fulldeps/libs-through-symlinks/bar.rs | 3 - .../run-make-fulldeps/libs-through-symlinks/foo.rs | 2 - tests/run-make-fulldeps/libtest-json/Makefile | 18 -- tests/run-make-fulldeps/libtest-json/f.rs | 22 -- .../libtest-json/output-default.json | 10 - .../libtest-json/output-stdout-success.json | 10 - .../libtest-json/validate_json.py | 8 - tests/run-make-fulldeps/link-arg/Makefile | 5 - tests/run-make-fulldeps/link-arg/empty.rs | 1 - tests/run-make-fulldeps/link-args-order/Makefile | 10 - tests/run-make-fulldeps/link-args-order/empty.rs | 1 - tests/run-make-fulldeps/link-cfg/Makefile | 22 -- .../link-cfg/dep-with-staticlib.rs | 8 - tests/run-make-fulldeps/link-cfg/dep.rs | 8 - tests/run-make-fulldeps/link-cfg/no-deps.rs | 20 -- tests/run-make-fulldeps/link-cfg/return1.c | 6 - tests/run-make-fulldeps/link-cfg/return2.c | 6 - tests/run-make-fulldeps/link-cfg/return3.c | 6 - tests/run-make-fulldeps/link-cfg/with-deps.rs | 14 - .../link-cfg/with-staticlib-deps.rs | 14 - tests/run-make-fulldeps/link-dedup/Makefile | 12 - tests/run-make-fulldeps/link-dedup/depa.rs | 10 - tests/run-make-fulldeps/link-dedup/depb.rs | 8 - tests/run-make-fulldeps/link-dedup/depc.rs | 4 - tests/run-make-fulldeps/link-dedup/empty.rs | 5 - tests/run-make-fulldeps/link-path-order/Makefile | 18 -- tests/run-make-fulldeps/link-path-order/correct.c | 1 - tests/run-make-fulldeps/link-path-order/main.rs | 16 -- tests/run-make-fulldeps/link-path-order/wrong.c | 1 - .../linkage-attr-on-static/Makefile | 5 - .../linkage-attr-on-static/bar.rs | 16 -- .../run-make-fulldeps/linkage-attr-on-static/foo.c | 7 - .../long-linker-command-lines-cmd-exe/Makefile | 6 - .../long-linker-command-lines-cmd-exe/foo.bat | 1 - .../long-linker-command-lines-cmd-exe/foo.rs | 101 ------- .../long-linker-command-lines/Makefile | 5 - .../long-linker-command-lines/foo.rs | 106 ------- .../run-make-fulldeps/longjmp-across-rust/Makefile | 5 - tests/run-make-fulldeps/longjmp-across-rust/foo.c | 18 -- .../run-make-fulldeps/longjmp-across-rust/main.rs | 29 -- tests/run-make-fulldeps/ls-metadata/Makefile | 7 - tests/run-make-fulldeps/ls-metadata/foo.rs | 1 - tests/run-make-fulldeps/lto-dylib-dep/Makefile | 10 - tests/run-make-fulldeps/lto-dylib-dep/a_dylib.rs | 3 - tests/run-make-fulldeps/lto-dylib-dep/main.rs | 5 - tests/run-make-fulldeps/lto-empty/Makefile | 12 - tests/run-make-fulldeps/lto-empty/lib.rs | 1 - .../lto-no-link-whole-rlib/Makefile | 8 - .../run-make-fulldeps/lto-no-link-whole-rlib/bar.c | 3 - .../run-make-fulldeps/lto-no-link-whole-rlib/foo.c | 3 - .../lto-no-link-whole-rlib/lib1.rs | 10 - .../lto-no-link-whole-rlib/lib2.rs | 12 - .../lto-no-link-whole-rlib/main.rs | 7 - tests/run-make-fulldeps/lto-readonly-lib/Makefile | 12 - tests/run-make-fulldeps/lto-readonly-lib/lib.rs | 1 - tests/run-make-fulldeps/lto-readonly-lib/main.rs | 3 - tests/run-make-fulldeps/lto-smoke-c/Makefile | 11 - tests/run-make-fulldeps/lto-smoke-c/bar.c | 6 - tests/run-make-fulldeps/lto-smoke-c/foo.rs | 4 - tests/run-make-fulldeps/lto-smoke/Makefile | 30 -- tests/run-make-fulldeps/lto-smoke/lib.rs | 1 - tests/run-make-fulldeps/lto-smoke/main.rs | 3 - tests/run-make-fulldeps/manual-crate-name/Makefile | 5 - tests/run-make-fulldeps/manual-crate-name/bar.rs | 1 - tests/run-make-fulldeps/manual-link/Makefile | 6 - tests/run-make-fulldeps/manual-link/bar.c | 1 - tests/run-make-fulldeps/manual-link/foo.c | 1 - tests/run-make-fulldeps/manual-link/foo.rs | 11 - tests/run-make-fulldeps/manual-link/main.rs | 5 - .../many-crates-but-no-match/Makefile | 35 --- .../many-crates-but-no-match/crateA1.rs | 4 - .../many-crates-but-no-match/crateA2.rs | 4 - .../many-crates-but-no-match/crateA3.rs | 4 - .../many-crates-but-no-match/crateB.rs | 1 - .../many-crates-but-no-match/crateC.rs | 3 - .../metadata-flag-frobs-symbols/Makefile | 10 - .../metadata-flag-frobs-symbols/bar.rs | 8 - .../metadata-flag-frobs-symbols/foo.rs | 6 - tests/run-make-fulldeps/min-global-align/Makefile | 22 -- .../min-global-align/min_global_align.rs | 32 --- .../mingw-export-call-convention/Makefile | 9 - .../mingw-export-call-convention/foo.rs | 4 - .../mismatching-target-triples/Makefile | 11 - .../mismatching-target-triples/bar.rs | 3 - .../mismatching-target-triples/foo.rs | 3 - .../missing-crate-dependency/Makefile | 9 - .../missing-crate-dependency/crateA.rs | 2 - .../missing-crate-dependency/crateB.rs | 1 - .../missing-crate-dependency/crateC.rs | 3 - tests/run-make-fulldeps/mixing-deps/Makefile | 7 - tests/run-make-fulldeps/mixing-deps/both.rs | 4 - tests/run-make-fulldeps/mixing-deps/dylib.rs | 6 - tests/run-make-fulldeps/mixing-deps/prog.rs | 9 - tests/run-make-fulldeps/mixing-formats/Makefile | 74 ----- tests/run-make-fulldeps/mixing-formats/bar1.rs | 1 - tests/run-make-fulldeps/mixing-formats/bar2.rs | 1 - tests/run-make-fulldeps/mixing-formats/baz.rs | 3 - tests/run-make-fulldeps/mixing-formats/baz2.rs | 4 - tests/run-make-fulldeps/mixing-formats/foo.rs | 1 - tests/run-make-fulldeps/mixing-libs/Makefile | 9 - tests/run-make-fulldeps/mixing-libs/dylib.rs | 4 - tests/run-make-fulldeps/mixing-libs/prog.rs | 7 - tests/run-make-fulldeps/mixing-libs/rlib.rs | 2 - tests/run-make-fulldeps/msvc-opt-minsize/Makefile | 5 - tests/run-make-fulldeps/msvc-opt-minsize/foo.rs | 19 -- tests/run-make-fulldeps/multiple-emits/Makefile | 7 - tests/run-make-fulldeps/multiple-emits/foo.rs | 1 - tests/run-make-fulldeps/no-builtins-lto/Makefile | 9 - tests/run-make-fulldeps/no-builtins-lto/main.rs | 3 - .../no-builtins-lto/no_builtins.rs | 2 - tests/run-make-fulldeps/no-duplicate-libs/Makefile | 10 - tests/run-make-fulldeps/no-duplicate-libs/bar.c | 5 - tests/run-make-fulldeps/no-duplicate-libs/foo.c | 1 - tests/run-make-fulldeps/no-duplicate-libs/main.rs | 10 - .../no-intermediate-extras/Makefile | 7 - .../no-intermediate-extras/foo.rs | 1 - .../obey-crate-type-flag/Makefile | 13 - .../run-make-fulldeps/obey-crate-type-flag/test.rs | 2 - .../Makefile | 7 - .../foo.rs | 1 - .../output-filename-overwrites-input/Makefile | 13 - .../output-filename-overwrites-input/bar.rs | 1 - .../output-filename-overwrites-input/foo.rs | 1 - .../output-type-permutations/Makefile | 146 ---------- .../output-type-permutations/foo.rs | 3 - .../run-make-fulldeps/output-with-hyphens/Makefile | 7 - .../output-with-hyphens/foo-bar.rs | 1 - .../override-aliased-flags/Makefile | 22 -- .../override-aliased-flags/main.rs | 1 - .../panic-impl-transitive/Makefile | 7 - .../panic-impl-transitive/panic-impl-consumer.rs | 5 - .../panic-impl-transitive/panic-impl-provider.rs | 9 - .../pass-non-c-like-enum-to-c/Makefile | 5 - .../pass-non-c-like-enum-to-c/nonclike.rs | 21 -- .../pass-non-c-like-enum-to-c/test.c | 85 ------ .../run-make-fulldeps/pgo-branch-weights/Makefile | 34 --- .../pgo-branch-weights/filecheck-patterns.txt | 24 -- .../pgo-branch-weights/interesting.rs | 40 --- tests/run-make-fulldeps/pgo-branch-weights/main.rs | 17 -- .../run-make-fulldeps/pgo-branch-weights/opaque.rs | 6 - tests/run-make-fulldeps/pgo-gen-lto/Makefile | 14 - tests/run-make-fulldeps/pgo-gen-lto/test.rs | 1 - .../pgo-gen-no-imp-symbols/Makefile | 13 - .../pgo-gen-no-imp-symbols/test.rs | 1 - tests/run-make-fulldeps/pgo-gen/Makefile | 14 - tests/run-make-fulldeps/pgo-gen/test.rs | 1 - .../pgo-indirect-call-promotion/Makefile | 26 -- .../filecheck-patterns.txt | 16 -- .../pgo-indirect-call-promotion/interesting.rs | 56 ---- .../pgo-indirect-call-promotion/main.rs | 14 - .../pgo-indirect-call-promotion/opaque.rs | 7 - tests/run-make-fulldeps/pgo-use/Makefile | 46 --- .../pgo-use/filecheck-patterns.txt | 11 - tests/run-make-fulldeps/pgo-use/main.rs | 23 -- .../pointer-auth-link-with-c/Makefile | 14 - .../pointer-auth-link-with-c/test.c | 1 - .../pointer-auth-link-with-c/test.rs | 8 - tests/run-make-fulldeps/prefer-dylib/Makefile | 8 - tests/run-make-fulldeps/prefer-dylib/bar.rs | 1 - tests/run-make-fulldeps/prefer-dylib/foo.rs | 5 - tests/run-make-fulldeps/prefer-rlib/Makefile | 8 - tests/run-make-fulldeps/prefer-rlib/bar.rs | 1 - tests/run-make-fulldeps/prefer-rlib/foo.rs | 5 - .../pretty-print-to-file/Makefile | 5 - .../pretty-print-to-file/input.pp | 3 - .../pretty-print-to-file/input.rs | 5 - .../print-calling-conventions/Makefile | 4 - tests/run-make-fulldeps/print-cfg/Makefile | 20 -- tests/run-make-fulldeps/print-target-list/Makefile | 8 - tests/run-make-fulldeps/profile/Makefile | 12 - tests/run-make-fulldeps/profile/test.rs | 1 - tests/run-make-fulldeps/prune-link-args/Makefile | 9 - tests/run-make-fulldeps/prune-link-args/empty.rs | 1 - tests/run-make-fulldeps/redundant-libs/Makefile | 23 -- tests/run-make-fulldeps/redundant-libs/bar.c | 1 - tests/run-make-fulldeps/redundant-libs/baz.c | 7 - tests/run-make-fulldeps/redundant-libs/foo.c | 2 - tests/run-make-fulldeps/redundant-libs/main.rs | 11 - tests/run-make-fulldeps/relocation-model/Makefile | 19 -- tests/run-make-fulldeps/relocation-model/foo.rs | 1 - tests/run-make-fulldeps/relro-levels/Makefile | 21 -- tests/run-make-fulldeps/relro-levels/hello.rs | 3 - tests/run-make-fulldeps/remap-path-prefix/Makefile | 9 - .../remap-path-prefix/auxiliary/lib.rs | 3 - .../reproducible-build-2/Makefile | 26 -- .../reproducible-build-2/linker.rs | 44 --- .../reproducible-build-2/reproducible-build-aux.rs | 28 -- .../reproducible-build-2/reproducible-build.rs | 116 -------- .../run-make-fulldeps/reproducible-build/Makefile | 139 --------- .../run-make-fulldeps/reproducible-build/linker.rs | 50 ---- .../reproducible-build/reproducible-build-aux.rs | 28 -- .../reproducible-build/reproducible-build.rs | 116 -------- tests/run-make-fulldeps/resolve-rename/Makefile | 7 - tests/run-make-fulldeps/resolve-rename/bar.rs | 5 - tests/run-make-fulldeps/resolve-rename/baz.rs | 5 - tests/run-make-fulldeps/resolve-rename/foo.rs | 3 - .../return-non-c-like-enum-from-c/Makefile | 5 - .../return-non-c-like-enum-from-c/nonclike.rs | 31 -- .../return-non-c-like-enum-from-c/test.c | 61 ---- .../return-non-c-like-enum/Makefile | 7 - .../return-non-c-like-enum/nonclike.rs | 21 -- .../return-non-c-like-enum/test.c | 63 ----- tests/run-make-fulldeps/rlib-chain/Makefile | 10 - tests/run-make-fulldeps/rlib-chain/m1.rs | 2 - tests/run-make-fulldeps/rlib-chain/m2.rs | 4 - tests/run-make-fulldeps/rlib-chain/m3.rs | 4 - tests/run-make-fulldeps/rlib-chain/m4.rs | 3 - .../run-make-fulldeps/rustdoc-determinism/Makefile | 16 -- tests/run-make-fulldeps/rustdoc-determinism/bar.rs | 1 - tests/run-make-fulldeps/rustdoc-determinism/foo.rs | 1 - .../run-make-fulldeps/rustdoc-error-lines/Makefile | 13 - .../run-make-fulldeps/rustdoc-error-lines/input.rs | 28 -- tests/run-make-fulldeps/rustdoc-io-error/Makefile | 20 -- tests/run-make-fulldeps/rustdoc-io-error/foo.rs | 1 - tests/run-make-fulldeps/rustdoc-map-file/Makefile | 5 - .../rustdoc-map-file/expected.json | 5 - tests/run-make-fulldeps/rustdoc-map-file/foo.rs | 16 -- .../rustdoc-map-file/validate_json.py | 41 --- .../run-make-fulldeps/rustdoc-output-path/Makefile | 4 - tests/run-make-fulldeps/rustdoc-output-path/foo.rs | 1 - .../rustdoc-scrape-examples-macros/Makefile | 18 -- .../rustdoc-scrape-examples-macros/examples/ex.rs | 27 -- .../rustdoc-scrape-examples-macros/src/lib.rs | 12 - .../rustdoc-scrape-examples-macros/src/proc.rs | 39 --- .../rustdoc-target-spec-json-path/Makefile | 9 - .../rustdoc-target-spec-json-path/dummy_core.rs | 2 - .../rustdoc-target-spec-json-path/my_crate.rs | 3 - .../rustdoc-target-spec-json-path/target.json | 38 --- tests/run-make-fulldeps/rustdoc-themes/Makefile | 10 - tests/run-make-fulldeps/rustdoc-themes/foo.rs | 4 - .../sanitizer-cdylib-link/Makefile | 16 -- .../sanitizer-cdylib-link/library.rs | 5 - .../sanitizer-cdylib-link/program.rs | 7 - .../sanitizer-dylib-link/Makefile | 16 -- .../sanitizer-dylib-link/library.rs | 5 - .../sanitizer-dylib-link/program.rs | 7 - .../sanitizer-staticlib-link/Makefile | 20 -- .../sanitizer-staticlib-link/library.rs | 5 - .../sanitizer-staticlib-link/program.c | 6 - .../sanitizer-staticlib-link/program.rs | 10 - .../run-make-fulldeps/separate-link-fail/Makefile | 7 - tests/run-make-fulldeps/separate-link/Makefile | 6 - .../run-make-fulldeps/sepcomp-cci-copies/Makefile | 12 - .../sepcomp-cci-copies/cci_lib.rs | 6 - tests/run-make-fulldeps/sepcomp-cci-copies/foo.rs | 25 -- tests/run-make-fulldeps/sepcomp-inlining/Makefile | 15 - tests/run-make-fulldeps/sepcomp-inlining/foo.rs | 30 -- tests/run-make-fulldeps/sepcomp-separate/Makefile | 9 - tests/run-make-fulldeps/sepcomp-separate/foo.rs | 21 -- .../share-generics-dylib/Makefile | 22 -- .../share-generics-dylib/instance_provider_a.rs | 6 - .../share-generics-dylib/instance_provider_b.rs | 6 - .../share-generics-dylib/instance_user_a_rlib.rs | 9 - .../share-generics-dylib/instance_user_b_rlib.rs | 9 - .../share-generics-dylib/instance_user_dylib.rs | 7 - .../share-generics-dylib/linked_leaf.rs | 15 - tests/run-make-fulldeps/simd-ffi/Makefile | 47 --- tests/run-make-fulldeps/simd-ffi/simd.rs | 82 ------ tests/run-make-fulldeps/simple-dylib/Makefile | 5 - tests/run-make-fulldeps/simple-dylib/bar.rs | 1 - tests/run-make-fulldeps/simple-dylib/foo.rs | 5 - tests/run-make-fulldeps/simple-rlib/Makefile | 5 - tests/run-make-fulldeps/simple-rlib/bar.rs | 1 - tests/run-make-fulldeps/simple-rlib/foo.rs | 5 - tests/run-make-fulldeps/split-debuginfo/Makefile | 308 -------------------- tests/run-make-fulldeps/split-debuginfo/bar.rs | 13 - tests/run-make-fulldeps/split-debuginfo/baz.rs | 1 - tests/run-make-fulldeps/split-debuginfo/foo.rs | 15 - tests/run-make-fulldeps/split-debuginfo/main.rs | 8 - .../run-make-fulldeps/stable-symbol-names/Makefile | 41 --- .../stable-symbol-names/stable-symbol-names1.rs | 31 -- .../stable-symbol-names/stable-symbol-names2.rs | 17 -- .../static-dylib-by-default/Makefile | 16 -- .../static-dylib-by-default/bar.rs | 8 - .../static-dylib-by-default/foo.rs | 4 - .../static-dylib-by-default/main.c | 6 - .../run-make-fulldeps/static-extern-type/Makefile | 5 - .../static-extern-type/define-foo.c | 11 - .../static-extern-type/use-foo.rs | 14 - tests/run-make-fulldeps/static-unwinding/Makefile | 6 - tests/run-make-fulldeps/static-unwinding/lib.rs | 15 - tests/run-make-fulldeps/static-unwinding/main.rs | 24 -- .../run-make-fulldeps/staticlib-blank-lib/Makefile | 6 - tests/run-make-fulldeps/staticlib-blank-lib/foo.rs | 6 - tests/run-make-fulldeps/std-core-cycle/Makefile | 16 -- tests/run-make-fulldeps/std-core-cycle/bar.rs | 16 -- tests/run-make-fulldeps/std-core-cycle/foo.rs | 11 - tests/run-make-fulldeps/stdin-non-utf8/Makefile | 6 - tests/run-make-fulldeps/stdin-non-utf8/non-utf8 | 1 - .../run-make-fulldeps/suspicious-library/Makefile | 7 - tests/run-make-fulldeps/suspicious-library/bar.rs | 3 - tests/run-make-fulldeps/suspicious-library/foo.rs | 3 - tests/run-make-fulldeps/symbol-visibility/Makefile | 122 -------- .../symbol-visibility/a_cdylib.rs | 12 - .../symbol-visibility/a_proc_macro.rs | 9 - .../symbol-visibility/a_rust_dylib.rs | 15 - .../symbol-visibility/an_executable.rs | 7 - .../run-make-fulldeps/symbol-visibility/an_rlib.rs | 12 - .../symbols-include-type-name/Makefile | 9 - .../symbols-include-type-name/lib.rs | 14 - tests/run-make-fulldeps/symlinked-extern/Makefile | 11 - tests/run-make-fulldeps/symlinked-extern/bar.rs | 6 - tests/run-make-fulldeps/symlinked-extern/baz.rs | 6 - tests/run-make-fulldeps/symlinked-extern/foo.rs | 5 - .../run-make-fulldeps/symlinked-libraries/Makefile | 10 - tests/run-make-fulldeps/symlinked-libraries/bar.rs | 5 - tests/run-make-fulldeps/symlinked-libraries/foo.rs | 3 - tests/run-make-fulldeps/symlinked-rlib/Makefile | 9 - tests/run-make-fulldeps/symlinked-rlib/bar.rs | 5 - tests/run-make-fulldeps/symlinked-rlib/foo.rs | 1 - .../sysroot-crates-are-unstable/Makefile | 2 - .../sysroot-crates-are-unstable/test.py | 74 ----- tests/run-make-fulldeps/target-cpu-native/Makefile | 20 -- tests/run-make-fulldeps/target-cpu-native/foo.rs | 2 - tests/run-make-fulldeps/target-specs/Makefile | 11 - .../definitely-not-builtin-target.json | 7 - tests/run-make-fulldeps/target-specs/foo.rs | 24 -- .../target-specs/mismatching-data-layout.json | 6 - .../target-specs/my-awesome-platform.json | 11 - .../target-specs/my-incomplete-platform.json | 10 - .../target-specs/my-invalid-platform.json | 1 - .../my-x86_64-unknown-linux-gnu-platform.json | 12 - .../target-without-atomic-cas/Makefile | 5 - tests/run-make-fulldeps/test-harness/Makefile | 8 - .../test-harness/test-ignore-cfg.rs | 9 - .../type-mismatch-same-crate-name/Makefile | 19 -- .../type-mismatch-same-crate-name/crateA.rs | 16 -- .../type-mismatch-same-crate-name/crateB.rs | 4 - .../type-mismatch-same-crate-name/crateC.rs | 25 -- .../use-extern-for-plugins/Makefile | 17 -- .../use-extern-for-plugins/bar.rs | 9 - .../use-extern-for-plugins/baz.rs | 8 - .../use-extern-for-plugins/foo.rs | 8 - .../use-suggestions-rust-2018/Makefile | 7 - .../use-suggestions-rust-2018/ep-nested-lib.rs | 7 - .../use-suggestions-rust-2018/use-suggestions.rs | 3 - tests/run-make-fulldeps/used-cdylib-macos/Makefile | 11 - .../used-cdylib-macos/dylib_used.rs | 4 - tests/run-make-fulldeps/used/Makefile | 7 - tests/run-make-fulldeps/used/used.rs | 6 - tests/run-make-fulldeps/version/Makefile | 6 - .../run-make-fulldeps/volatile-intrinsics/Makefile | 9 - .../run-make-fulldeps/volatile-intrinsics/main.rs | 24 -- .../weird-output-filenames/Makefile | 15 - .../weird-output-filenames/foo.rs | 1 - .../windows-binary-no-external-deps/Makefile | 9 - .../windows-binary-no-external-deps/hello.rs | 3 - tests/run-make-fulldeps/windows-spawn/Makefile | 8 - tests/run-make-fulldeps/windows-spawn/hello.rs | 3 - tests/run-make-fulldeps/windows-spawn/spawn.rs | 12 - tests/run-make-fulldeps/windows-subsystem/Makefile | 5 - .../run-make-fulldeps/windows-subsystem/console.rs | 3 - .../run-make-fulldeps/windows-subsystem/windows.rs | 3 - tests/run-make/a-b-a-linker-guard/Makefile | 15 + tests/run-make/a-b-a-linker-guard/a.rs | 8 + tests/run-make/a-b-a-linker-guard/b.rs | 7 + tests/run-make/alloc-no-oom-handling/Makefile | 4 + tests/run-make/alloc-no-rc/Makefile | 4 + tests/run-make/alloc-no-sync/Makefile | 4 + .../allow-non-lint-warnings-cmdline/Makefile | 11 + .../allow-non-lint-warnings-cmdline/foo.rs | 5 + .../allow-warnings-cmdline-stability/Makefile | 15 + .../allow-warnings-cmdline-stability/bar.rs | 5 + .../allow-warnings-cmdline-stability/foo.rs | 5 + tests/run-make/archive-duplicate-names/Makefile | 11 + tests/run-make/archive-duplicate-names/bar.c | 1 + tests/run-make/archive-duplicate-names/bar.rs | 5 + tests/run-make/archive-duplicate-names/foo.c | 1 + tests/run-make/archive-duplicate-names/foo.rs | 14 + tests/run-make/arguments-non-c-like-enum/Makefile | 7 + .../run-make/arguments-non-c-like-enum/nonclike.rs | 31 ++ tests/run-make/arguments-non-c-like-enum/test.c | 66 +++++ tests/run-make/atomic-lock-free/Makefile | 48 ++++ .../run-make/atomic-lock-free/atomic_lock_free.rs | 66 +++++ tests/run-make/bare-outfile/Makefile | 6 + tests/run-make/bare-outfile/foo.rs | 2 + tests/run-make/c-dynamic-dylib/Makefile | 12 + tests/run-make/c-dynamic-dylib/bar.rs | 5 + tests/run-make/c-dynamic-dylib/cfoo.c | 4 + tests/run-make/c-dynamic-dylib/foo.rs | 10 + tests/run-make/c-dynamic-rlib/Makefile | 15 + tests/run-make/c-dynamic-rlib/bar.rs | 5 + tests/run-make/c-dynamic-rlib/cfoo.c | 4 + tests/run-make/c-dynamic-rlib/foo.rs | 10 + tests/run-make/c-link-to-rust-dylib/Makefile | 17 ++ tests/run-make/c-link-to-rust-dylib/bar.c | 6 + tests/run-make/c-link-to-rust-dylib/foo.rs | 4 + tests/run-make/c-link-to-rust-staticlib/Makefile | 12 + tests/run-make/c-link-to-rust-staticlib/bar.c | 6 + tests/run-make/c-link-to-rust-staticlib/foo.rs | 4 + tests/run-make/c-link-to-rust-va-list-fn/Makefile | 6 + .../c-link-to-rust-va-list-fn/checkrust.rs | 148 ++++++++++ tests/run-make/c-link-to-rust-va-list-fn/test.c | 50 ++++ tests/run-make/c-static-dylib/Makefile | 9 + tests/run-make/c-static-dylib/bar.rs | 5 + tests/run-make/c-static-dylib/cfoo.c | 1 + tests/run-make/c-static-dylib/foo.rs | 10 + tests/run-make/c-static-rlib/Makefile | 8 + tests/run-make/c-static-rlib/bar.rs | 5 + tests/run-make/c-static-rlib/cfoo.c | 1 + tests/run-make/c-static-rlib/foo.rs | 10 + .../run-make/c-unwind-abi-catch-lib-panic/Makefile | 30 ++ tests/run-make/c-unwind-abi-catch-lib-panic/add.c | 12 + .../run-make/c-unwind-abi-catch-lib-panic/main.rs | 35 +++ .../run-make/c-unwind-abi-catch-lib-panic/panic.rs | 12 + tests/run-make/c-unwind-abi-catch-panic/Makefile | 5 + tests/run-make/c-unwind-abi-catch-panic/add.c | 12 + tests/run-make/c-unwind-abi-catch-panic/main.rs | 44 +++ tests/run-make/cat-and-grep-sanity-check/Makefile | 46 +++ tests/run-make/cdylib-dylib-linkage/Makefile | 27 ++ tests/run-make/cdylib-dylib-linkage/bar.rs | 5 + tests/run-make/cdylib-dylib-linkage/foo.c | 10 + tests/run-make/cdylib-dylib-linkage/foo.rs | 13 + tests/run-make/cdylib-fewer-symbols/Makefile | 12 + tests/run-make/cdylib-fewer-symbols/foo.rs | 6 + tests/run-make/cdylib/Makefile | 19 ++ tests/run-make/cdylib/bar.rs | 5 + tests/run-make/cdylib/foo.c | 10 + tests/run-make/cdylib/foo.rs | 13 + tests/run-make/codegen-options-parsing/Makefile | 31 ++ tests/run-make/codegen-options-parsing/dummy.rs | 1 + tests/run-make/compile-stdin/Makefile | 5 + tests/run-make/compiler-lookup-paths-2/Makefile | 8 + tests/run-make/compiler-lookup-paths-2/a.rs | 1 + tests/run-make/compiler-lookup-paths-2/b.rs | 2 + tests/run-make/compiler-lookup-paths-2/c.rs | 3 + tests/run-make/compiler-lookup-paths/Makefile | 38 +++ tests/run-make/compiler-lookup-paths/a.rs | 1 + tests/run-make/compiler-lookup-paths/b.rs | 2 + tests/run-make/compiler-lookup-paths/c.rs | 2 + tests/run-make/compiler-lookup-paths/d.rs | 4 + tests/run-make/compiler-lookup-paths/e.rs | 2 + tests/run-make/compiler-lookup-paths/e2.rs | 4 + tests/run-make/compiler-lookup-paths/f.rs | 2 + tests/run-make/compiler-lookup-paths/native.c | 1 + tests/run-make/compiler-rt-works-on-mingw/Makefile | 9 + tests/run-make/compiler-rt-works-on-mingw/foo.cpp | 4 + tests/run-make/compiler-rt-works-on-mingw/foo.rs | 10 + tests/run-make/core-no-fp-fmt-parse/Makefile | 4 + tests/run-make/crate-data-smoke/Makefile | 10 + tests/run-make/crate-data-smoke/crate.rs | 7 + tests/run-make/crate-data-smoke/lib.rs | 2 + tests/run-make/crate-data-smoke/rlib.rs | 2 + tests/run-make/crate-hash-rustc-version/Makefile | 37 +++ tests/run-make/crate-hash-rustc-version/a.rs | 4 + tests/run-make/crate-hash-rustc-version/b.rs | 8 + tests/run-make/crate-name-priority/Makefile | 11 + tests/run-make/crate-name-priority/foo.rs | 1 + tests/run-make/crate-name-priority/foo1.rs | 3 + tests/run-make/cross-lang-lto-clang/Makefile | 25 ++ tests/run-make/cross-lang-lto-clang/clib.c | 9 + tests/run-make/cross-lang-lto-clang/cmain.c | 12 + tests/run-make/cross-lang-lto-clang/main.rs | 11 + tests/run-make/cross-lang-lto-clang/rustlib.rs | 12 + .../run-make/cross-lang-lto-pgo-smoketest/Makefile | 87 ++++++ tests/run-make/cross-lang-lto-pgo-smoketest/clib.c | 9 + .../run-make/cross-lang-lto-pgo-smoketest/cmain.c | 12 + .../run-make/cross-lang-lto-pgo-smoketest/main.rs | 11 + .../cross-lang-lto-pgo-smoketest/rustlib.rs | 12 + .../cross-lang-lto-upstream-rlibs/Makefile | 32 +++ .../cross-lang-lto-upstream-rlibs/staticlib.rs | 8 + .../cross-lang-lto-upstream-rlibs/upstream.rs | 3 + tests/run-make/cross-lang-lto/Makefile | 57 ++++ tests/run-make/cross-lang-lto/lib.rs | 4 + tests/run-make/cross-lang-lto/main.rs | 3 + tests/run-make/debug-assertions/Makefile | 25 ++ tests/run-make/debug-assertions/debug.rs | 33 +++ tests/run-make/dep-info-doesnt-run-much/Makefile | 4 + tests/run-make/dep-info-doesnt-run-much/foo.rs | 5 + tests/run-make/dep-info-spaces/Makefile | 19 ++ tests/run-make/dep-info-spaces/Makefile.foo | 7 + tests/run-make/dep-info-spaces/bar.rs | 1 + tests/run-make/dep-info-spaces/foo foo.rs | 1 + tests/run-make/dep-info-spaces/lib.rs | 4 + tests/run-make/dep-info/Makefile | 25 ++ tests/run-make/dep-info/Makefile.foo | 7 + tests/run-make/dep-info/bar.rs | 1 + tests/run-make/dep-info/foo.rs | 1 + tests/run-make/dep-info/lib.rs | 4 + tests/run-make/dep-info/lib2.rs | 3 + tests/run-make/doctests-keep-binaries/Makefile | 21 ++ tests/run-make/doctests-keep-binaries/t.rs | 11 + tests/run-make/duplicate-output-flavors/Makefile | 5 + tests/run-make/duplicate-output-flavors/foo.rs | 1 + tests/run-make/dylib-chain/Makefile | 12 + tests/run-make/dylib-chain/m1.rs | 2 + tests/run-make/dylib-chain/m2.rs | 4 + tests/run-make/dylib-chain/m3.rs | 4 + tests/run-make/dylib-chain/m4.rs | 3 + tests/run-make/emit-stack-sizes/Makefile | 12 + tests/run-make/emit-stack-sizes/foo.rs | 3 + tests/run-make/emit/Makefile | 21 ++ tests/run-make/emit/test-24876.rs | 9 + tests/run-make/emit/test-26235.rs | 46 +++ .../error-found-staticlib-instead-crate/Makefile | 5 + .../error-found-staticlib-instead-crate/bar.rs | 5 + .../error-found-staticlib-instead-crate/foo.rs | 1 + tests/run-make/error-writing-dependencies/Makefile | 8 + tests/run-make/error-writing-dependencies/foo.rs | 1 + tests/run-make/exit-code/Makefile | 11 + tests/run-make/exit-code/compile-error.rs | 3 + tests/run-make/exit-code/lint-failure.rs | 6 + tests/run-make/exit-code/success.rs | 4 + tests/run-make/extern-diff-internal-name/Makefile | 5 + tests/run-make/extern-diff-internal-name/lib.rs | 2 + tests/run-make/extern-diff-internal-name/test.rs | 5 + tests/run-make/extern-flag-disambiguates/Makefile | 25 ++ tests/run-make/extern-flag-disambiguates/a.rs | 6 + tests/run-make/extern-flag-disambiguates/b.rs | 9 + tests/run-make/extern-flag-disambiguates/c.rs | 9 + tests/run-make/extern-flag-disambiguates/d.rs | 11 + tests/run-make/extern-flag-fun/Makefile | 19 ++ tests/run-make/extern-flag-fun/bar-alt.rs | 1 + tests/run-make/extern-flag-fun/bar.rs | 1 + tests/run-make/extern-flag-fun/foo.rs | 3 + tests/run-make/extern-flag-fun/gated_unstable.rs | 3 + tests/run-make/extern-flag-fun/rustc.rs | 1 + tests/run-make/extern-flag-pathless/Makefile | 18 ++ tests/run-make/extern-flag-pathless/bar-dynamic.rs | 3 + tests/run-make/extern-flag-pathless/bar-static.rs | 3 + tests/run-make/extern-flag-pathless/foo.rs | 3 + .../extern-flag-rename-transitive/Makefile | 7 + .../run-make/extern-flag-rename-transitive/bar.rs | 3 + .../run-make/extern-flag-rename-transitive/baz.rs | 4 + .../run-make/extern-flag-rename-transitive/foo.rs | 1 + tests/run-make/extern-fn-generic/Makefile | 6 + tests/run-make/extern-fn-generic/test.c | 16 ++ tests/run-make/extern-fn-generic/test.rs | 20 ++ tests/run-make/extern-fn-generic/testcrate.rs | 16 ++ tests/run-make/extern-fn-mangle/Makefile | 5 + tests/run-make/extern-fn-mangle/test.c | 8 + tests/run-make/extern-fn-mangle/test.rs | 19 ++ tests/run-make/extern-fn-reachable/Makefile | 25 ++ tests/run-make/extern-fn-reachable/dylib.rs | 14 + .../run-make/extern-fn-struct-passing-abi/Makefile | 5 + tests/run-make/extern-fn-struct-passing-abi/test.c | 314 +++++++++++++++++++++ .../run-make/extern-fn-struct-passing-abi/test.rs | 138 +++++++++ .../run-make/extern-fn-with-extern-types/Makefile | 5 + tests/run-make/extern-fn-with-extern-types/ctest.c | 16 ++ tests/run-make/extern-fn-with-extern-types/test.rs | 17 ++ .../run-make/extern-fn-with-packed-struct/Makefile | 5 + tests/run-make/extern-fn-with-packed-struct/test.c | 26 ++ .../run-make/extern-fn-with-packed-struct/test.rs | 20 ++ tests/run-make/extern-fn-with-union/Makefile | 6 + tests/run-make/extern-fn-with-union/ctest.c | 10 + tests/run-make/extern-fn-with-union/test.rs | 19 ++ tests/run-make/extern-fn-with-union/testcrate.rs | 11 + tests/run-make/extern-multiple-copies/Makefile | 8 + tests/run-make/extern-multiple-copies/bar.rs | 6 + tests/run-make/extern-multiple-copies/foo1.rs | 1 + tests/run-make/extern-multiple-copies/foo2.rs | 1 + tests/run-make/extern-multiple-copies2/Makefile | 10 + tests/run-make/extern-multiple-copies2/bar.rs | 8 + tests/run-make/extern-multiple-copies2/foo1.rs | 7 + tests/run-make/extern-multiple-copies2/foo2.rs | 8 + .../extern-overrides-distribution/Makefile | 5 + .../run-make/extern-overrides-distribution/libc.rs | 3 + .../run-make/extern-overrides-distribution/main.rs | 5 + .../extra-filename-with-temp-outputs/Makefile | 6 + .../extra-filename-with-temp-outputs/foo.rs | 1 + tests/run-make/foreign-double-unwind/Makefile | 10 + tests/run-make/foreign-double-unwind/foo.cpp | 33 +++ tests/run-make/foreign-double-unwind/foo.rs | 26 ++ tests/run-make/foreign-exceptions/Makefile | 10 + tests/run-make/foreign-exceptions/foo.cpp | 60 ++++ tests/run-make/foreign-exceptions/foo.rs | 59 ++++ tests/run-make/foreign-rust-exceptions/Makefile | 11 + tests/run-make/foreign-rust-exceptions/bar.rs | 7 + tests/run-make/foreign-rust-exceptions/foo.rs | 13 + tests/run-make/fpic/Makefile | 10 + tests/run-make/fpic/hello.rs | 1 + tests/run-make/glibc-staticlib-args/Makefile | 12 + tests/run-make/glibc-staticlib-args/library.rs | 4 + tests/run-make/glibc-staticlib-args/program.c | 6 + tests/run-make/hir-tree/Makefile | 8 + tests/run-make/hir-tree/input.rs | 3 + tests/run-make/hotplug_codegen_backend/Makefile | 26 ++ .../run-make/hotplug_codegen_backend/some_crate.rs | 2 + .../hotplug_codegen_backend/the_backend.rs | 84 ++++++ tests/run-make/include_bytes_deps/Makefile | 7 + tests/run-make/include_bytes_deps/input.bin | 1 + tests/run-make/include_bytes_deps/input.md | 1 + tests/run-make/include_bytes_deps/input.txt | 1 + tests/run-make/include_bytes_deps/main.rs | 10 + .../run-make/incr-add-rust-src-component/Makefile | 44 +++ tests/run-make/incr-add-rust-src-component/main.rs | 3 + tests/run-make/inline-always-many-cgu/Makefile | 8 + tests/run-make/inline-always-many-cgu/foo.rs | 15 + tests/run-make/interdependent-c-libraries/Makefile | 14 + tests/run-make/interdependent-c-libraries/bar.c | 3 + tests/run-make/interdependent-c-libraries/bar.rs | 14 + tests/run-make/interdependent-c-libraries/foo.c | 1 + tests/run-make/interdependent-c-libraries/foo.rs | 12 + tests/run-make/interdependent-c-libraries/main.rs | 6 + tests/run-make/intrinsic-unreachable/Makefile | 12 + tests/run-make/intrinsic-unreachable/exit-ret.rs | 14 + .../intrinsic-unreachable/exit-unreachable.rs | 18 ++ tests/run-make/invalid-library/Makefile | 6 + tests/run-make/invalid-library/foo.rs | 3 + tests/run-make/invalid-staticlib/Makefile | 5 + tests/run-make/issue-11908/Makefile | 21 ++ tests/run-make/issue-11908/bar.rs | 3 + tests/run-make/issue-11908/foo.rs | 1 + tests/run-make/issue-14500/Makefile | 13 + tests/run-make/issue-14500/bar.rs | 1 + tests/run-make/issue-14500/foo.c | 7 + tests/run-make/issue-14500/foo.rs | 5 + tests/run-make/issue-14698/Makefile | 4 + tests/run-make/issue-14698/foo.rs | 1 + tests/run-make/issue-15460/Makefile | 6 + tests/run-make/issue-15460/bar.rs | 4 + tests/run-make/issue-15460/foo.c | 6 + tests/run-make/issue-15460/foo.rs | 6 + tests/run-make/issue-18943/Makefile | 7 + tests/run-make/issue-18943/foo.rs | 5 + tests/run-make/issue-20626/Makefile | 8 + tests/run-make/issue-20626/foo.rs | 13 + tests/run-make/issue-22131/Makefile | 7 + tests/run-make/issue-22131/foo.rs | 5 + tests/run-make/issue-24445/Makefile | 10 + tests/run-make/issue-24445/foo.c | 6 + tests/run-make/issue-24445/foo.rs | 15 + tests/run-make/issue-25581/Makefile | 5 + tests/run-make/issue-25581/test.c | 15 + tests/run-make/issue-25581/test.rs | 18 ++ tests/run-make/issue-26006/Makefile | 16 ++ tests/run-make/issue-26006/in/libc/lib.rs | 3 + tests/run-make/issue-26006/in/time/lib.rs | 4 + tests/run-make/issue-26092/Makefile | 6 + tests/run-make/issue-26092/blank.rs | 1 + tests/run-make/issue-28595/Makefile | 6 + tests/run-make/issue-28595/a.c | 1 + tests/run-make/issue-28595/a.rs | 6 + tests/run-make/issue-28595/b.c | 5 + tests/run-make/issue-28595/b.rs | 12 + tests/run-make/issue-28766/Makefile | 5 + tests/run-make/issue-28766/foo.rs | 8 + tests/run-make/issue-28766/main.rs | 7 + tests/run-make/issue-30063/Makefile | 35 +++ tests/run-make/issue-30063/foo.rs | 1 + tests/run-make/issue-33329/Makefile | 5 + tests/run-make/issue-33329/main.rs | 1 + tests/run-make/issue-35164/Makefile | 4 + tests/run-make/issue-35164/main.rs | 5 + tests/run-make/issue-35164/submodule/mod.rs | 3 + tests/run-make/issue-37839/Makefile | 6 + tests/run-make/issue-37839/a.rs | 2 + tests/run-make/issue-37839/b.rs | 2 + tests/run-make/issue-37839/c.rs | 2 + tests/run-make/issue-37893/Makefile | 4 + tests/run-make/issue-37893/a.rs | 2 + tests/run-make/issue-37893/b.rs | 2 + tests/run-make/issue-37893/c.rs | 3 + tests/run-make/issue-38237/Makefile | 5 + tests/run-make/issue-38237/bar.rs | 4 + tests/run-make/issue-38237/baz.rs | 8 + tests/run-make/issue-38237/foo.rs | 9 + tests/run-make/issue-40535/Makefile | 13 + tests/run-make/issue-40535/bar.rs | 3 + tests/run-make/issue-40535/baz.rs | 1 + tests/run-make/issue-40535/foo.rs | 4 + tests/run-make/issue-46239/Makefile | 5 + tests/run-make/issue-46239/main.rs | 8 + tests/run-make/issue-47551/Makefile | 9 + tests/run-make/issue-47551/eh_frame-terminator.rs | 22 ++ tests/run-make/issue-51671/Makefile | 9 + tests/run-make/issue-51671/app.rs | 20 ++ tests/run-make/issue-53964/Makefile | 5 + tests/run-make/issue-53964/app.rs | 8 + tests/run-make/issue-53964/panic.rs | 10 + tests/run-make/issue-64153/Makefile | 26 ++ tests/run-make/issue-64153/downstream.rs | 6 + tests/run-make/issue-64153/upstream.rs | 6 + .../issue-68794-textrel-on-minimal-lib/Makefile | 17 ++ .../issue-68794-textrel-on-minimal-lib/bar.c | 6 + .../issue-68794-textrel-on-minimal-lib/foo.rs | 8 + tests/run-make/issue-69368/Makefile | 18 ++ tests/run-make/issue-69368/a.rs | 26 ++ tests/run-make/issue-69368/b.rs | 8 + tests/run-make/issue-69368/c.rs | 34 +++ tests/run-make/issue-7349/Makefile | 11 + tests/run-make/issue-7349/foo.rs | 22 ++ tests/run-make/issue-83045/Makefile | 33 +++ tests/run-make/issue-83045/a.rs | 1 + tests/run-make/issue-83045/b.rs | 1 + tests/run-make/issue-83045/c.rs | 1 + .../issue-84395-lto-embed-bitcode/Makefile | 11 + .../run-make/issue-84395-lto-embed-bitcode/test.rs | 3 + .../issue-97463-abi-param-passing/Makefile | 14 + tests/run-make/issue-97463-abi-param-passing/bad.c | 24 ++ .../issue-97463-abi-param-passing/param_passing.rs | 38 +++ tests/run-make/issue64319/Makefile | 39 +++ tests/run-make/issue64319/bar.rs | 5 + tests/run-make/issue64319/foo.rs | 9 + tests/run-make/libs-through-symlinks/Makefile | 11 + tests/run-make/libs-through-symlinks/bar.rs | 3 + tests/run-make/libs-through-symlinks/foo.rs | 2 + tests/run-make/libtest-json/Makefile | 18 ++ tests/run-make/libtest-json/f.rs | 22 ++ tests/run-make/libtest-json/output-default.json | 10 + .../libtest-json/output-stdout-success.json | 10 + tests/run-make/libtest-json/validate_json.py | 8 + tests/run-make/link-arg/Makefile | 5 + tests/run-make/link-arg/empty.rs | 1 + tests/run-make/link-args-order/Makefile | 10 + tests/run-make/link-args-order/empty.rs | 1 + tests/run-make/link-cfg/Makefile | 22 ++ tests/run-make/link-cfg/dep-with-staticlib.rs | 8 + tests/run-make/link-cfg/dep.rs | 8 + tests/run-make/link-cfg/no-deps.rs | 20 ++ tests/run-make/link-cfg/return1.c | 6 + tests/run-make/link-cfg/return2.c | 6 + tests/run-make/link-cfg/return3.c | 6 + tests/run-make/link-cfg/with-deps.rs | 14 + tests/run-make/link-cfg/with-staticlib-deps.rs | 14 + tests/run-make/link-dedup/Makefile | 12 + tests/run-make/link-dedup/depa.rs | 10 + tests/run-make/link-dedup/depb.rs | 8 + tests/run-make/link-dedup/depc.rs | 4 + tests/run-make/link-dedup/empty.rs | 5 + tests/run-make/link-path-order/Makefile | 18 ++ tests/run-make/link-path-order/correct.c | 1 + tests/run-make/link-path-order/main.rs | 16 ++ tests/run-make/link-path-order/wrong.c | 1 + tests/run-make/linkage-attr-on-static/Makefile | 5 + tests/run-make/linkage-attr-on-static/bar.rs | 16 ++ tests/run-make/linkage-attr-on-static/foo.c | 7 + .../long-linker-command-lines-cmd-exe/Makefile | 6 + .../long-linker-command-lines-cmd-exe/foo.bat | 1 + .../long-linker-command-lines-cmd-exe/foo.rs | 101 +++++++ tests/run-make/long-linker-command-lines/Makefile | 5 + tests/run-make/long-linker-command-lines/foo.rs | 106 +++++++ tests/run-make/longjmp-across-rust/Makefile | 5 + tests/run-make/longjmp-across-rust/foo.c | 18 ++ tests/run-make/longjmp-across-rust/main.rs | 29 ++ tests/run-make/ls-metadata/Makefile | 7 + tests/run-make/ls-metadata/foo.rs | 1 + tests/run-make/lto-dylib-dep/Makefile | 10 + tests/run-make/lto-dylib-dep/a_dylib.rs | 3 + tests/run-make/lto-dylib-dep/main.rs | 5 + tests/run-make/lto-empty/Makefile | 12 + tests/run-make/lto-empty/lib.rs | 1 + tests/run-make/lto-no-link-whole-rlib/Makefile | 8 + tests/run-make/lto-no-link-whole-rlib/bar.c | 3 + tests/run-make/lto-no-link-whole-rlib/foo.c | 3 + tests/run-make/lto-no-link-whole-rlib/lib1.rs | 10 + tests/run-make/lto-no-link-whole-rlib/lib2.rs | 12 + tests/run-make/lto-no-link-whole-rlib/main.rs | 7 + tests/run-make/lto-readonly-lib/Makefile | 12 + tests/run-make/lto-readonly-lib/lib.rs | 1 + tests/run-make/lto-readonly-lib/main.rs | 3 + tests/run-make/lto-smoke-c/Makefile | 11 + tests/run-make/lto-smoke-c/bar.c | 6 + tests/run-make/lto-smoke-c/foo.rs | 4 + tests/run-make/lto-smoke/Makefile | 30 ++ tests/run-make/lto-smoke/lib.rs | 1 + tests/run-make/lto-smoke/main.rs | 3 + tests/run-make/manual-crate-name/Makefile | 5 + tests/run-make/manual-crate-name/bar.rs | 1 + tests/run-make/manual-link/Makefile | 6 + tests/run-make/manual-link/bar.c | 1 + tests/run-make/manual-link/foo.c | 1 + tests/run-make/manual-link/foo.rs | 11 + tests/run-make/manual-link/main.rs | 5 + tests/run-make/many-crates-but-no-match/Makefile | 35 +++ tests/run-make/many-crates-but-no-match/crateA1.rs | 4 + tests/run-make/many-crates-but-no-match/crateA2.rs | 4 + tests/run-make/many-crates-but-no-match/crateA3.rs | 4 + tests/run-make/many-crates-but-no-match/crateB.rs | 1 + tests/run-make/many-crates-but-no-match/crateC.rs | 3 + .../run-make/metadata-flag-frobs-symbols/Makefile | 10 + tests/run-make/metadata-flag-frobs-symbols/bar.rs | 8 + tests/run-make/metadata-flag-frobs-symbols/foo.rs | 6 + tests/run-make/min-global-align/Makefile | 22 ++ .../run-make/min-global-align/min_global_align.rs | 32 +++ .../run-make/mingw-export-call-convention/Makefile | 9 + tests/run-make/mingw-export-call-convention/foo.rs | 4 + tests/run-make/mismatching-target-triples/Makefile | 11 + tests/run-make/mismatching-target-triples/bar.rs | 3 + tests/run-make/mismatching-target-triples/foo.rs | 3 + tests/run-make/missing-crate-dependency/Makefile | 9 + tests/run-make/missing-crate-dependency/crateA.rs | 2 + tests/run-make/missing-crate-dependency/crateB.rs | 1 + tests/run-make/missing-crate-dependency/crateC.rs | 3 + tests/run-make/mixing-deps/Makefile | 7 + tests/run-make/mixing-deps/both.rs | 4 + tests/run-make/mixing-deps/dylib.rs | 6 + tests/run-make/mixing-deps/prog.rs | 9 + tests/run-make/mixing-formats/Makefile | 74 +++++ tests/run-make/mixing-formats/bar1.rs | 1 + tests/run-make/mixing-formats/bar2.rs | 1 + tests/run-make/mixing-formats/baz.rs | 3 + tests/run-make/mixing-formats/baz2.rs | 4 + tests/run-make/mixing-formats/foo.rs | 1 + tests/run-make/mixing-libs/Makefile | 9 + tests/run-make/mixing-libs/dylib.rs | 4 + tests/run-make/mixing-libs/prog.rs | 7 + tests/run-make/mixing-libs/rlib.rs | 2 + tests/run-make/msvc-opt-minsize/Makefile | 5 + tests/run-make/msvc-opt-minsize/foo.rs | 19 ++ tests/run-make/multiple-emits/Makefile | 7 + tests/run-make/multiple-emits/foo.rs | 1 + tests/run-make/no-builtins-lto/Makefile | 9 + tests/run-make/no-builtins-lto/main.rs | 3 + tests/run-make/no-builtins-lto/no_builtins.rs | 2 + tests/run-make/no-duplicate-libs/Makefile | 10 + tests/run-make/no-duplicate-libs/bar.c | 5 + tests/run-make/no-duplicate-libs/foo.c | 1 + tests/run-make/no-duplicate-libs/main.rs | 10 + tests/run-make/no-intermediate-extras/Makefile | 7 + tests/run-make/no-intermediate-extras/foo.rs | 1 + tests/run-make/obey-crate-type-flag/Makefile | 13 + tests/run-make/obey-crate-type-flag/test.rs | 2 + .../Makefile | 7 + .../foo.rs | 1 + .../output-filename-overwrites-input/Makefile | 13 + .../output-filename-overwrites-input/bar.rs | 1 + .../output-filename-overwrites-input/foo.rs | 1 + tests/run-make/output-type-permutations/Makefile | 146 ++++++++++ tests/run-make/output-type-permutations/foo.rs | 3 + tests/run-make/output-with-hyphens/Makefile | 7 + tests/run-make/output-with-hyphens/foo-bar.rs | 1 + tests/run-make/override-aliased-flags/Makefile | 22 ++ tests/run-make/override-aliased-flags/main.rs | 1 + tests/run-make/panic-impl-transitive/Makefile | 7 + .../panic-impl-transitive/panic-impl-consumer.rs | 5 + .../panic-impl-transitive/panic-impl-provider.rs | 9 + tests/run-make/pass-non-c-like-enum-to-c/Makefile | 5 + .../run-make/pass-non-c-like-enum-to-c/nonclike.rs | 21 ++ tests/run-make/pass-non-c-like-enum-to-c/test.c | 85 ++++++ tests/run-make/pgo-branch-weights/Makefile | 34 +++ .../pgo-branch-weights/filecheck-patterns.txt | 24 ++ tests/run-make/pgo-branch-weights/interesting.rs | 40 +++ tests/run-make/pgo-branch-weights/main.rs | 17 ++ tests/run-make/pgo-branch-weights/opaque.rs | 6 + tests/run-make/pgo-gen-lto/Makefile | 14 + tests/run-make/pgo-gen-lto/test.rs | 1 + tests/run-make/pgo-gen-no-imp-symbols/Makefile | 13 + tests/run-make/pgo-gen-no-imp-symbols/test.rs | 1 + tests/run-make/pgo-gen/Makefile | 14 + tests/run-make/pgo-gen/test.rs | 1 + .../run-make/pgo-indirect-call-promotion/Makefile | 26 ++ .../filecheck-patterns.txt | 16 ++ .../pgo-indirect-call-promotion/interesting.rs | 56 ++++ tests/run-make/pgo-indirect-call-promotion/main.rs | 14 + .../run-make/pgo-indirect-call-promotion/opaque.rs | 7 + tests/run-make/pgo-use/Makefile | 46 +++ tests/run-make/pgo-use/filecheck-patterns.txt | 11 + tests/run-make/pgo-use/main.rs | 23 ++ tests/run-make/pointer-auth-link-with-c/Makefile | 14 + tests/run-make/pointer-auth-link-with-c/test.c | 1 + tests/run-make/pointer-auth-link-with-c/test.rs | 8 + tests/run-make/prefer-dylib/Makefile | 8 + tests/run-make/prefer-dylib/bar.rs | 1 + tests/run-make/prefer-dylib/foo.rs | 5 + tests/run-make/prefer-rlib/Makefile | 8 + tests/run-make/prefer-rlib/bar.rs | 1 + tests/run-make/prefer-rlib/foo.rs | 5 + tests/run-make/pretty-print-to-file/Makefile | 5 + tests/run-make/pretty-print-to-file/input.pp | 3 + tests/run-make/pretty-print-to-file/input.rs | 5 + tests/run-make/print-calling-conventions/Makefile | 4 + tests/run-make/print-cfg/Makefile | 20 ++ tests/run-make/print-target-list/Makefile | 8 + tests/run-make/profile/Makefile | 12 + tests/run-make/profile/test.rs | 1 + tests/run-make/prune-link-args/Makefile | 9 + tests/run-make/prune-link-args/empty.rs | 1 + tests/run-make/redundant-libs/Makefile | 23 ++ tests/run-make/redundant-libs/bar.c | 1 + tests/run-make/redundant-libs/baz.c | 7 + tests/run-make/redundant-libs/foo.c | 2 + tests/run-make/redundant-libs/main.rs | 11 + tests/run-make/relocation-model/Makefile | 19 ++ tests/run-make/relocation-model/foo.rs | 1 + tests/run-make/relro-levels/Makefile | 21 ++ tests/run-make/relro-levels/hello.rs | 3 + tests/run-make/remap-path-prefix/Makefile | 9 + tests/run-make/remap-path-prefix/auxiliary/lib.rs | 3 + tests/run-make/reproducible-build-2/Makefile | 26 ++ tests/run-make/reproducible-build-2/linker.rs | 44 +++ .../reproducible-build-2/reproducible-build-aux.rs | 28 ++ .../reproducible-build-2/reproducible-build.rs | 116 ++++++++ tests/run-make/reproducible-build/Makefile | 139 +++++++++ tests/run-make/reproducible-build/linker.rs | 50 ++++ .../reproducible-build/reproducible-build-aux.rs | 28 ++ .../reproducible-build/reproducible-build.rs | 116 ++++++++ tests/run-make/resolve-rename/Makefile | 7 + tests/run-make/resolve-rename/bar.rs | 5 + tests/run-make/resolve-rename/baz.rs | 5 + tests/run-make/resolve-rename/foo.rs | 3 + .../return-non-c-like-enum-from-c/Makefile | 5 + .../return-non-c-like-enum-from-c/nonclike.rs | 31 ++ .../run-make/return-non-c-like-enum-from-c/test.c | 61 ++++ tests/run-make/return-non-c-like-enum/Makefile | 7 + tests/run-make/return-non-c-like-enum/nonclike.rs | 21 ++ tests/run-make/return-non-c-like-enum/test.c | 63 +++++ tests/run-make/rlib-chain/Makefile | 10 + tests/run-make/rlib-chain/m1.rs | 2 + tests/run-make/rlib-chain/m2.rs | 4 + tests/run-make/rlib-chain/m3.rs | 4 + tests/run-make/rlib-chain/m4.rs | 3 + .../rlib-format-packed-bundled-libs/Makefile | 2 +- tests/run-make/rustdoc-determinism/Makefile | 16 ++ tests/run-make/rustdoc-determinism/bar.rs | 1 + tests/run-make/rustdoc-determinism/foo.rs | 1 + tests/run-make/rustdoc-error-lines/Makefile | 13 + tests/run-make/rustdoc-error-lines/input.rs | 28 ++ tests/run-make/rustdoc-io-error/Makefile | 20 ++ tests/run-make/rustdoc-io-error/foo.rs | 1 + tests/run-make/rustdoc-map-file/Makefile | 5 + tests/run-make/rustdoc-map-file/expected.json | 5 + tests/run-make/rustdoc-map-file/foo.rs | 16 ++ tests/run-make/rustdoc-map-file/validate_json.py | 41 +++ tests/run-make/rustdoc-output-path/Makefile | 4 + tests/run-make/rustdoc-output-path/foo.rs | 1 + .../rustdoc-scrape-examples-macros/Makefile | 18 ++ .../rustdoc-scrape-examples-macros/examples/ex.rs | 27 ++ .../rustdoc-scrape-examples-macros/src/lib.rs | 12 + .../rustdoc-scrape-examples-macros/src/proc.rs | 39 +++ .../rustdoc-target-spec-json-path/Makefile | 9 + .../rustdoc-target-spec-json-path/dummy_core.rs | 2 + .../rustdoc-target-spec-json-path/my_crate.rs | 3 + .../rustdoc-target-spec-json-path/target.json | 38 +++ tests/run-make/rustdoc-themes/Makefile | 10 + tests/run-make/rustdoc-themes/foo.rs | 4 + tests/run-make/sanitizer-cdylib-link/Makefile | 16 ++ tests/run-make/sanitizer-cdylib-link/library.rs | 5 + tests/run-make/sanitizer-cdylib-link/program.rs | 7 + tests/run-make/sanitizer-dylib-link/Makefile | 16 ++ tests/run-make/sanitizer-dylib-link/library.rs | 5 + tests/run-make/sanitizer-dylib-link/program.rs | 7 + tests/run-make/sanitizer-staticlib-link/Makefile | 20 ++ tests/run-make/sanitizer-staticlib-link/library.rs | 5 + tests/run-make/sanitizer-staticlib-link/program.c | 6 + tests/run-make/sanitizer-staticlib-link/program.rs | 10 + tests/run-make/separate-link-fail/Makefile | 7 + tests/run-make/separate-link/Makefile | 6 + tests/run-make/sepcomp-cci-copies/Makefile | 12 + tests/run-make/sepcomp-cci-copies/cci_lib.rs | 6 + tests/run-make/sepcomp-cci-copies/foo.rs | 25 ++ tests/run-make/sepcomp-inlining/Makefile | 15 + tests/run-make/sepcomp-inlining/foo.rs | 30 ++ tests/run-make/sepcomp-separate/Makefile | 9 + tests/run-make/sepcomp-separate/foo.rs | 21 ++ tests/run-make/share-generics-dylib/Makefile | 22 ++ .../share-generics-dylib/instance_provider_a.rs | 6 + .../share-generics-dylib/instance_provider_b.rs | 6 + .../share-generics-dylib/instance_user_a_rlib.rs | 9 + .../share-generics-dylib/instance_user_b_rlib.rs | 9 + .../share-generics-dylib/instance_user_dylib.rs | 7 + tests/run-make/share-generics-dylib/linked_leaf.rs | 15 + tests/run-make/simd-ffi/Makefile | 47 +++ tests/run-make/simd-ffi/simd.rs | 82 ++++++ tests/run-make/simple-dylib/Makefile | 5 + tests/run-make/simple-dylib/bar.rs | 1 + tests/run-make/simple-dylib/foo.rs | 5 + tests/run-make/simple-rlib/Makefile | 5 + tests/run-make/simple-rlib/bar.rs | 1 + tests/run-make/simple-rlib/foo.rs | 5 + tests/run-make/split-debuginfo/Makefile | 308 ++++++++++++++++++++ tests/run-make/split-debuginfo/bar.rs | 13 + tests/run-make/split-debuginfo/baz.rs | 1 + tests/run-make/split-debuginfo/foo.rs | 15 + tests/run-make/split-debuginfo/main.rs | 8 + tests/run-make/stable-symbol-names/Makefile | 41 +++ .../stable-symbol-names/stable-symbol-names1.rs | 31 ++ .../stable-symbol-names/stable-symbol-names2.rs | 17 ++ tests/run-make/static-dylib-by-default/Makefile | 16 ++ tests/run-make/static-dylib-by-default/bar.rs | 8 + tests/run-make/static-dylib-by-default/foo.rs | 4 + tests/run-make/static-dylib-by-default/main.c | 6 + tests/run-make/static-extern-type/Makefile | 5 + tests/run-make/static-extern-type/define-foo.c | 11 + tests/run-make/static-extern-type/use-foo.rs | 14 + tests/run-make/static-unwinding/Makefile | 6 + tests/run-make/static-unwinding/lib.rs | 15 + tests/run-make/static-unwinding/main.rs | 24 ++ tests/run-make/staticlib-blank-lib/Makefile | 6 + tests/run-make/staticlib-blank-lib/foo.rs | 6 + tests/run-make/std-core-cycle/Makefile | 16 ++ tests/run-make/std-core-cycle/bar.rs | 16 ++ tests/run-make/std-core-cycle/foo.rs | 11 + tests/run-make/stdin-non-utf8/Makefile | 6 + tests/run-make/stdin-non-utf8/non-utf8 | 1 + tests/run-make/suspicious-library/Makefile | 7 + tests/run-make/suspicious-library/bar.rs | 3 + tests/run-make/suspicious-library/foo.rs | 3 + tests/run-make/symbol-visibility/Makefile | 122 ++++++++ tests/run-make/symbol-visibility/a_cdylib.rs | 12 + tests/run-make/symbol-visibility/a_proc_macro.rs | 9 + tests/run-make/symbol-visibility/a_rust_dylib.rs | 15 + tests/run-make/symbol-visibility/an_executable.rs | 7 + tests/run-make/symbol-visibility/an_rlib.rs | 12 + tests/run-make/symbols-include-type-name/Makefile | 9 + tests/run-make/symbols-include-type-name/lib.rs | 14 + tests/run-make/symlinked-extern/Makefile | 11 + tests/run-make/symlinked-extern/bar.rs | 6 + tests/run-make/symlinked-extern/baz.rs | 6 + tests/run-make/symlinked-extern/foo.rs | 5 + tests/run-make/symlinked-libraries/Makefile | 10 + tests/run-make/symlinked-libraries/bar.rs | 5 + tests/run-make/symlinked-libraries/foo.rs | 3 + tests/run-make/symlinked-rlib/Makefile | 9 + tests/run-make/symlinked-rlib/bar.rs | 5 + tests/run-make/symlinked-rlib/foo.rs | 1 + .../run-make/sysroot-crates-are-unstable/Makefile | 2 + tests/run-make/sysroot-crates-are-unstable/test.py | 74 +++++ tests/run-make/target-cpu-native/Makefile | 20 ++ tests/run-make/target-cpu-native/foo.rs | 2 + tests/run-make/target-specs/Makefile | 11 + .../definitely-not-builtin-target.json | 7 + tests/run-make/target-specs/foo.rs | 24 ++ .../target-specs/mismatching-data-layout.json | 6 + .../run-make/target-specs/my-awesome-platform.json | 11 + .../target-specs/my-incomplete-platform.json | 10 + .../run-make/target-specs/my-invalid-platform.json | 1 + .../my-x86_64-unknown-linux-gnu-platform.json | 12 + tests/run-make/target-without-atomic-cas/Makefile | 5 + tests/run-make/test-harness/Makefile | 8 + tests/run-make/test-harness/test-ignore-cfg.rs | 9 + .../type-mismatch-same-crate-name/Makefile | 19 ++ .../type-mismatch-same-crate-name/crateA.rs | 16 ++ .../type-mismatch-same-crate-name/crateB.rs | 4 + .../type-mismatch-same-crate-name/crateC.rs | 25 ++ tests/run-make/use-extern-for-plugins/Makefile | 17 ++ tests/run-make/use-extern-for-plugins/bar.rs | 9 + tests/run-make/use-extern-for-plugins/baz.rs | 8 + tests/run-make/use-extern-for-plugins/foo.rs | 8 + tests/run-make/use-suggestions-rust-2018/Makefile | 7 + .../use-suggestions-rust-2018/ep-nested-lib.rs | 7 + .../use-suggestions-rust-2018/use-suggestions.rs | 3 + tests/run-make/used-cdylib-macos/Makefile | 11 + tests/run-make/used-cdylib-macos/dylib_used.rs | 4 + tests/run-make/used/Makefile | 7 + tests/run-make/used/used.rs | 6 + tests/run-make/version/Makefile | 6 + tests/run-make/volatile-intrinsics/Makefile | 9 + tests/run-make/volatile-intrinsics/main.rs | 24 ++ tests/run-make/weird-output-filenames/Makefile | 15 + tests/run-make/weird-output-filenames/foo.rs | 1 + .../windows-binary-no-external-deps/Makefile | 9 + .../windows-binary-no-external-deps/hello.rs | 3 + tests/run-make/windows-spawn/Makefile | 8 + tests/run-make/windows-spawn/hello.rs | 3 + tests/run-make/windows-spawn/spawn.rs | 12 + tests/run-make/windows-subsystem/Makefile | 5 + tests/run-make/windows-subsystem/console.rs | 3 + tests/run-make/windows-subsystem/windows.rs | 3 + 1391 files changed, 9222 insertions(+), 9222 deletions(-) delete mode 100644 tests/run-make-fulldeps/a-b-a-linker-guard/Makefile delete mode 100644 tests/run-make-fulldeps/a-b-a-linker-guard/a.rs delete mode 100644 tests/run-make-fulldeps/a-b-a-linker-guard/b.rs delete mode 100644 tests/run-make-fulldeps/alloc-no-oom-handling/Makefile delete mode 100644 tests/run-make-fulldeps/alloc-no-rc/Makefile delete mode 100644 tests/run-make-fulldeps/alloc-no-sync/Makefile delete mode 100644 tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/Makefile delete mode 100644 tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/foo.rs delete mode 100644 tests/run-make-fulldeps/allow-warnings-cmdline-stability/Makefile delete mode 100644 tests/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs delete mode 100644 tests/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs delete mode 100644 tests/run-make-fulldeps/archive-duplicate-names/Makefile delete mode 100644 tests/run-make-fulldeps/archive-duplicate-names/bar.c delete mode 100644 tests/run-make-fulldeps/archive-duplicate-names/bar.rs delete mode 100644 tests/run-make-fulldeps/archive-duplicate-names/foo.c delete mode 100644 tests/run-make-fulldeps/archive-duplicate-names/foo.rs delete mode 100644 tests/run-make-fulldeps/arguments-non-c-like-enum/Makefile delete mode 100644 tests/run-make-fulldeps/arguments-non-c-like-enum/nonclike.rs delete mode 100644 tests/run-make-fulldeps/arguments-non-c-like-enum/test.c delete mode 100644 tests/run-make-fulldeps/atomic-lock-free/Makefile delete mode 100644 tests/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs delete mode 100644 tests/run-make-fulldeps/bare-outfile/Makefile delete mode 100644 tests/run-make-fulldeps/bare-outfile/foo.rs delete mode 100644 tests/run-make-fulldeps/c-dynamic-dylib/Makefile delete mode 100644 tests/run-make-fulldeps/c-dynamic-dylib/bar.rs delete mode 100644 tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c delete mode 100644 tests/run-make-fulldeps/c-dynamic-dylib/foo.rs delete mode 100644 tests/run-make-fulldeps/c-dynamic-rlib/Makefile delete mode 100644 tests/run-make-fulldeps/c-dynamic-rlib/bar.rs delete mode 100644 tests/run-make-fulldeps/c-dynamic-rlib/cfoo.c delete mode 100644 tests/run-make-fulldeps/c-dynamic-rlib/foo.rs delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-dylib/Makefile delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-dylib/bar.c delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-dylib/foo.rs delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-staticlib/Makefile delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-staticlib/bar.c delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-staticlib/foo.rs delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs delete mode 100644 tests/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c delete mode 100644 tests/run-make-fulldeps/c-static-dylib/Makefile delete mode 100644 tests/run-make-fulldeps/c-static-dylib/bar.rs delete mode 100644 tests/run-make-fulldeps/c-static-dylib/cfoo.c delete mode 100644 tests/run-make-fulldeps/c-static-dylib/foo.rs delete mode 100644 tests/run-make-fulldeps/c-static-rlib/Makefile delete mode 100644 tests/run-make-fulldeps/c-static-rlib/bar.rs delete mode 100644 tests/run-make-fulldeps/c-static-rlib/cfoo.c delete mode 100644 tests/run-make-fulldeps/c-static-rlib/foo.rs delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/Makefile delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/add.c delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/main.rs delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-panic/Makefile delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-panic/add.c delete mode 100644 tests/run-make-fulldeps/c-unwind-abi-catch-panic/main.rs delete mode 100644 tests/run-make-fulldeps/cat-and-grep-sanity-check/Makefile delete mode 100644 tests/run-make-fulldeps/cdylib-dylib-linkage/Makefile delete mode 100644 tests/run-make-fulldeps/cdylib-dylib-linkage/bar.rs delete mode 100644 tests/run-make-fulldeps/cdylib-dylib-linkage/foo.c delete mode 100644 tests/run-make-fulldeps/cdylib-dylib-linkage/foo.rs delete mode 100644 tests/run-make-fulldeps/cdylib-fewer-symbols/Makefile delete mode 100644 tests/run-make-fulldeps/cdylib-fewer-symbols/foo.rs delete mode 100644 tests/run-make-fulldeps/cdylib/Makefile delete mode 100644 tests/run-make-fulldeps/cdylib/bar.rs delete mode 100644 tests/run-make-fulldeps/cdylib/foo.c delete mode 100644 tests/run-make-fulldeps/cdylib/foo.rs delete mode 100644 tests/run-make-fulldeps/codegen-options-parsing/Makefile delete mode 100644 tests/run-make-fulldeps/codegen-options-parsing/dummy.rs delete mode 100644 tests/run-make-fulldeps/compile-stdin/Makefile delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths-2/Makefile delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths-2/a.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths-2/b.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths-2/c.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/Makefile delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/a.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/b.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/c.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/d.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/e.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/e2.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/f.rs delete mode 100644 tests/run-make-fulldeps/compiler-lookup-paths/native.c delete mode 100644 tests/run-make-fulldeps/compiler-rt-works-on-mingw/Makefile delete mode 100644 tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.cpp delete mode 100644 tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs delete mode 100644 tests/run-make-fulldeps/core-no-fp-fmt-parse/Makefile delete mode 100644 tests/run-make-fulldeps/crate-data-smoke/Makefile delete mode 100644 tests/run-make-fulldeps/crate-data-smoke/crate.rs delete mode 100644 tests/run-make-fulldeps/crate-data-smoke/lib.rs delete mode 100644 tests/run-make-fulldeps/crate-data-smoke/rlib.rs delete mode 100644 tests/run-make-fulldeps/crate-hash-rustc-version/Makefile delete mode 100644 tests/run-make-fulldeps/crate-hash-rustc-version/a.rs delete mode 100644 tests/run-make-fulldeps/crate-hash-rustc-version/b.rs delete mode 100644 tests/run-make-fulldeps/crate-name-priority/Makefile delete mode 100644 tests/run-make-fulldeps/crate-name-priority/foo.rs delete mode 100644 tests/run-make-fulldeps/crate-name-priority/foo1.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-clang/Makefile delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-clang/clib.c delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-clang/cmain.c delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-clang/main.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-clang/rustlib.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/Makefile delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/clib.c delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/cmain.c delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/main.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/rustlib.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/Makefile delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/staticlib.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/upstream.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto/Makefile delete mode 100644 tests/run-make-fulldeps/cross-lang-lto/lib.rs delete mode 100644 tests/run-make-fulldeps/cross-lang-lto/main.rs delete mode 100644 tests/run-make-fulldeps/debug-assertions/Makefile delete mode 100644 tests/run-make-fulldeps/debug-assertions/debug.rs delete mode 100644 tests/run-make-fulldeps/dep-info-doesnt-run-much/Makefile delete mode 100644 tests/run-make-fulldeps/dep-info-doesnt-run-much/foo.rs delete mode 100644 tests/run-make-fulldeps/dep-info-spaces/Makefile delete mode 100644 tests/run-make-fulldeps/dep-info-spaces/Makefile.foo delete mode 100644 tests/run-make-fulldeps/dep-info-spaces/bar.rs delete mode 100644 tests/run-make-fulldeps/dep-info-spaces/foo foo.rs delete mode 100644 tests/run-make-fulldeps/dep-info-spaces/lib.rs delete mode 100644 tests/run-make-fulldeps/dep-info/Makefile delete mode 100644 tests/run-make-fulldeps/dep-info/Makefile.foo delete mode 100644 tests/run-make-fulldeps/dep-info/bar.rs delete mode 100644 tests/run-make-fulldeps/dep-info/foo.rs delete mode 100644 tests/run-make-fulldeps/dep-info/lib.rs delete mode 100644 tests/run-make-fulldeps/dep-info/lib2.rs delete mode 100644 tests/run-make-fulldeps/doctests-keep-binaries/Makefile delete mode 100644 tests/run-make-fulldeps/doctests-keep-binaries/t.rs delete mode 100644 tests/run-make-fulldeps/duplicate-output-flavors/Makefile delete mode 100644 tests/run-make-fulldeps/duplicate-output-flavors/foo.rs delete mode 100644 tests/run-make-fulldeps/dylib-chain/Makefile delete mode 100644 tests/run-make-fulldeps/dylib-chain/m1.rs delete mode 100644 tests/run-make-fulldeps/dylib-chain/m2.rs delete mode 100644 tests/run-make-fulldeps/dylib-chain/m3.rs delete mode 100644 tests/run-make-fulldeps/dylib-chain/m4.rs delete mode 100644 tests/run-make-fulldeps/emit-stack-sizes/Makefile delete mode 100644 tests/run-make-fulldeps/emit-stack-sizes/foo.rs delete mode 100644 tests/run-make-fulldeps/emit/Makefile delete mode 100644 tests/run-make-fulldeps/emit/test-24876.rs delete mode 100644 tests/run-make-fulldeps/emit/test-26235.rs delete mode 100644 tests/run-make-fulldeps/error-found-staticlib-instead-crate/Makefile delete mode 100644 tests/run-make-fulldeps/error-found-staticlib-instead-crate/bar.rs delete mode 100644 tests/run-make-fulldeps/error-found-staticlib-instead-crate/foo.rs delete mode 100644 tests/run-make-fulldeps/error-writing-dependencies/Makefile delete mode 100644 tests/run-make-fulldeps/error-writing-dependencies/foo.rs delete mode 100644 tests/run-make-fulldeps/exit-code/Makefile delete mode 100644 tests/run-make-fulldeps/exit-code/compile-error.rs delete mode 100644 tests/run-make-fulldeps/exit-code/lint-failure.rs delete mode 100644 tests/run-make-fulldeps/exit-code/success.rs delete mode 100644 tests/run-make-fulldeps/extern-diff-internal-name/Makefile delete mode 100644 tests/run-make-fulldeps/extern-diff-internal-name/lib.rs delete mode 100644 tests/run-make-fulldeps/extern-diff-internal-name/test.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-disambiguates/Makefile delete mode 100644 tests/run-make-fulldeps/extern-flag-disambiguates/a.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-disambiguates/b.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-disambiguates/c.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-disambiguates/d.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-fun/Makefile delete mode 100644 tests/run-make-fulldeps/extern-flag-fun/bar-alt.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-fun/bar.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-fun/foo.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-fun/gated_unstable.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-fun/rustc.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-pathless/Makefile delete mode 100644 tests/run-make-fulldeps/extern-flag-pathless/bar-dynamic.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-pathless/bar-static.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-pathless/foo.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-rename-transitive/Makefile delete mode 100644 tests/run-make-fulldeps/extern-flag-rename-transitive/bar.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-rename-transitive/baz.rs delete mode 100644 tests/run-make-fulldeps/extern-flag-rename-transitive/foo.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-generic/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-generic/test.c delete mode 100644 tests/run-make-fulldeps/extern-fn-generic/test.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-generic/testcrate.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-mangle/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-mangle/test.c delete mode 100644 tests/run-make-fulldeps/extern-fn-mangle/test.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-reachable/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-reachable/dylib.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-struct-passing-abi/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.c delete mode 100644 tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-with-extern-types/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-with-extern-types/ctest.c delete mode 100644 tests/run-make-fulldeps/extern-fn-with-extern-types/test.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-with-packed-struct/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-with-packed-struct/test.c delete mode 100644 tests/run-make-fulldeps/extern-fn-with-packed-struct/test.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-with-union/Makefile delete mode 100644 tests/run-make-fulldeps/extern-fn-with-union/ctest.c delete mode 100644 tests/run-make-fulldeps/extern-fn-with-union/test.rs delete mode 100644 tests/run-make-fulldeps/extern-fn-with-union/testcrate.rs delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies/Makefile delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies/bar.rs delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies/foo1.rs delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies/foo2.rs delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies2/Makefile delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies2/bar.rs delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies2/foo1.rs delete mode 100644 tests/run-make-fulldeps/extern-multiple-copies2/foo2.rs delete mode 100644 tests/run-make-fulldeps/extern-overrides-distribution/Makefile delete mode 100644 tests/run-make-fulldeps/extern-overrides-distribution/libc.rs delete mode 100644 tests/run-make-fulldeps/extern-overrides-distribution/main.rs delete mode 100644 tests/run-make-fulldeps/extra-filename-with-temp-outputs/Makefile delete mode 100644 tests/run-make-fulldeps/extra-filename-with-temp-outputs/foo.rs delete mode 100644 tests/run-make-fulldeps/foreign-double-unwind/Makefile delete mode 100644 tests/run-make-fulldeps/foreign-double-unwind/foo.cpp delete mode 100644 tests/run-make-fulldeps/foreign-double-unwind/foo.rs delete mode 100644 tests/run-make-fulldeps/foreign-exceptions/Makefile delete mode 100644 tests/run-make-fulldeps/foreign-exceptions/foo.cpp delete mode 100644 tests/run-make-fulldeps/foreign-exceptions/foo.rs delete mode 100644 tests/run-make-fulldeps/foreign-rust-exceptions/Makefile delete mode 100644 tests/run-make-fulldeps/foreign-rust-exceptions/bar.rs delete mode 100644 tests/run-make-fulldeps/foreign-rust-exceptions/foo.rs delete mode 100644 tests/run-make-fulldeps/fpic/Makefile delete mode 100644 tests/run-make-fulldeps/fpic/hello.rs delete mode 100644 tests/run-make-fulldeps/glibc-staticlib-args/Makefile delete mode 100644 tests/run-make-fulldeps/glibc-staticlib-args/library.rs delete mode 100644 tests/run-make-fulldeps/glibc-staticlib-args/program.c delete mode 100644 tests/run-make-fulldeps/hir-tree/Makefile delete mode 100644 tests/run-make-fulldeps/hir-tree/input.rs delete mode 100644 tests/run-make-fulldeps/hotplug_codegen_backend/Makefile delete mode 100644 tests/run-make-fulldeps/hotplug_codegen_backend/some_crate.rs delete mode 100644 tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs delete mode 100644 tests/run-make-fulldeps/include_bytes_deps/Makefile delete mode 100644 tests/run-make-fulldeps/include_bytes_deps/input.bin delete mode 100644 tests/run-make-fulldeps/include_bytes_deps/input.md delete mode 100644 tests/run-make-fulldeps/include_bytes_deps/input.txt delete mode 100644 tests/run-make-fulldeps/include_bytes_deps/main.rs delete mode 100644 tests/run-make-fulldeps/incr-add-rust-src-component/Makefile delete mode 100644 tests/run-make-fulldeps/incr-add-rust-src-component/main.rs delete mode 100644 tests/run-make-fulldeps/inline-always-many-cgu/Makefile delete mode 100644 tests/run-make-fulldeps/inline-always-many-cgu/foo.rs delete mode 100644 tests/run-make-fulldeps/interdependent-c-libraries/Makefile delete mode 100644 tests/run-make-fulldeps/interdependent-c-libraries/bar.c delete mode 100644 tests/run-make-fulldeps/interdependent-c-libraries/bar.rs delete mode 100644 tests/run-make-fulldeps/interdependent-c-libraries/foo.c delete mode 100644 tests/run-make-fulldeps/interdependent-c-libraries/foo.rs delete mode 100644 tests/run-make-fulldeps/interdependent-c-libraries/main.rs delete mode 100644 tests/run-make-fulldeps/intrinsic-unreachable/Makefile delete mode 100644 tests/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs delete mode 100644 tests/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs delete mode 100644 tests/run-make-fulldeps/invalid-library/Makefile delete mode 100644 tests/run-make-fulldeps/invalid-library/foo.rs delete mode 100644 tests/run-make-fulldeps/invalid-staticlib/Makefile delete mode 100644 tests/run-make-fulldeps/issue-11908/Makefile delete mode 100644 tests/run-make-fulldeps/issue-11908/bar.rs delete mode 100644 tests/run-make-fulldeps/issue-11908/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-14500/Makefile delete mode 100644 tests/run-make-fulldeps/issue-14500/bar.rs delete mode 100644 tests/run-make-fulldeps/issue-14500/foo.c delete mode 100644 tests/run-make-fulldeps/issue-14500/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-14698/Makefile delete mode 100644 tests/run-make-fulldeps/issue-14698/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-15460/Makefile delete mode 100644 tests/run-make-fulldeps/issue-15460/bar.rs delete mode 100644 tests/run-make-fulldeps/issue-15460/foo.c delete mode 100644 tests/run-make-fulldeps/issue-15460/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-18943/Makefile delete mode 100644 tests/run-make-fulldeps/issue-18943/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-20626/Makefile delete mode 100644 tests/run-make-fulldeps/issue-20626/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-22131/Makefile delete mode 100644 tests/run-make-fulldeps/issue-22131/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-24445/Makefile delete mode 100644 tests/run-make-fulldeps/issue-24445/foo.c delete mode 100644 tests/run-make-fulldeps/issue-24445/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-25581/Makefile delete mode 100644 tests/run-make-fulldeps/issue-25581/test.c delete mode 100644 tests/run-make-fulldeps/issue-25581/test.rs delete mode 100644 tests/run-make-fulldeps/issue-26006/Makefile delete mode 100644 tests/run-make-fulldeps/issue-26006/in/libc/lib.rs delete mode 100644 tests/run-make-fulldeps/issue-26006/in/time/lib.rs delete mode 100644 tests/run-make-fulldeps/issue-26092/Makefile delete mode 100644 tests/run-make-fulldeps/issue-26092/blank.rs delete mode 100644 tests/run-make-fulldeps/issue-28595/Makefile delete mode 100644 tests/run-make-fulldeps/issue-28595/a.c delete mode 100644 tests/run-make-fulldeps/issue-28595/a.rs delete mode 100644 tests/run-make-fulldeps/issue-28595/b.c delete mode 100644 tests/run-make-fulldeps/issue-28595/b.rs delete mode 100644 tests/run-make-fulldeps/issue-28766/Makefile delete mode 100644 tests/run-make-fulldeps/issue-28766/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-28766/main.rs delete mode 100644 tests/run-make-fulldeps/issue-30063/Makefile delete mode 100644 tests/run-make-fulldeps/issue-30063/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-33329/Makefile delete mode 100644 tests/run-make-fulldeps/issue-33329/main.rs delete mode 100644 tests/run-make-fulldeps/issue-35164/Makefile delete mode 100644 tests/run-make-fulldeps/issue-35164/main.rs delete mode 100644 tests/run-make-fulldeps/issue-35164/submodule/mod.rs delete mode 100644 tests/run-make-fulldeps/issue-37839/Makefile delete mode 100644 tests/run-make-fulldeps/issue-37839/a.rs delete mode 100644 tests/run-make-fulldeps/issue-37839/b.rs delete mode 100644 tests/run-make-fulldeps/issue-37839/c.rs delete mode 100644 tests/run-make-fulldeps/issue-37893/Makefile delete mode 100644 tests/run-make-fulldeps/issue-37893/a.rs delete mode 100644 tests/run-make-fulldeps/issue-37893/b.rs delete mode 100644 tests/run-make-fulldeps/issue-37893/c.rs delete mode 100644 tests/run-make-fulldeps/issue-38237/Makefile delete mode 100644 tests/run-make-fulldeps/issue-38237/bar.rs delete mode 100644 tests/run-make-fulldeps/issue-38237/baz.rs delete mode 100644 tests/run-make-fulldeps/issue-38237/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-40535/Makefile delete mode 100644 tests/run-make-fulldeps/issue-40535/bar.rs delete mode 100644 tests/run-make-fulldeps/issue-40535/baz.rs delete mode 100644 tests/run-make-fulldeps/issue-40535/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-46239/Makefile delete mode 100644 tests/run-make-fulldeps/issue-46239/main.rs delete mode 100644 tests/run-make-fulldeps/issue-47551/Makefile delete mode 100644 tests/run-make-fulldeps/issue-47551/eh_frame-terminator.rs delete mode 100644 tests/run-make-fulldeps/issue-51671/Makefile delete mode 100644 tests/run-make-fulldeps/issue-51671/app.rs delete mode 100644 tests/run-make-fulldeps/issue-53964/Makefile delete mode 100644 tests/run-make-fulldeps/issue-53964/app.rs delete mode 100644 tests/run-make-fulldeps/issue-53964/panic.rs delete mode 100644 tests/run-make-fulldeps/issue-64153/Makefile delete mode 100644 tests/run-make-fulldeps/issue-64153/downstream.rs delete mode 100644 tests/run-make-fulldeps/issue-64153/upstream.rs delete mode 100644 tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/Makefile delete mode 100644 tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/bar.c delete mode 100644 tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-69368/Makefile delete mode 100644 tests/run-make-fulldeps/issue-69368/a.rs delete mode 100644 tests/run-make-fulldeps/issue-69368/b.rs delete mode 100644 tests/run-make-fulldeps/issue-69368/c.rs delete mode 100644 tests/run-make-fulldeps/issue-7349/Makefile delete mode 100644 tests/run-make-fulldeps/issue-7349/foo.rs delete mode 100644 tests/run-make-fulldeps/issue-83045/Makefile delete mode 100644 tests/run-make-fulldeps/issue-83045/a.rs delete mode 100644 tests/run-make-fulldeps/issue-83045/b.rs delete mode 100644 tests/run-make-fulldeps/issue-83045/c.rs delete mode 100644 tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/Makefile delete mode 100644 tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/test.rs delete mode 100644 tests/run-make-fulldeps/issue-97463-abi-param-passing/Makefile delete mode 100644 tests/run-make-fulldeps/issue-97463-abi-param-passing/bad.c delete mode 100644 tests/run-make-fulldeps/issue-97463-abi-param-passing/param_passing.rs delete mode 100644 tests/run-make-fulldeps/issue64319/Makefile delete mode 100644 tests/run-make-fulldeps/issue64319/bar.rs delete mode 100644 tests/run-make-fulldeps/issue64319/foo.rs delete mode 100644 tests/run-make-fulldeps/libs-through-symlinks/Makefile delete mode 100644 tests/run-make-fulldeps/libs-through-symlinks/bar.rs delete mode 100644 tests/run-make-fulldeps/libs-through-symlinks/foo.rs delete mode 100644 tests/run-make-fulldeps/libtest-json/Makefile delete mode 100644 tests/run-make-fulldeps/libtest-json/f.rs delete mode 100644 tests/run-make-fulldeps/libtest-json/output-default.json delete mode 100644 tests/run-make-fulldeps/libtest-json/output-stdout-success.json delete mode 100755 tests/run-make-fulldeps/libtest-json/validate_json.py delete mode 100644 tests/run-make-fulldeps/link-arg/Makefile delete mode 100644 tests/run-make-fulldeps/link-arg/empty.rs delete mode 100644 tests/run-make-fulldeps/link-args-order/Makefile delete mode 100644 tests/run-make-fulldeps/link-args-order/empty.rs delete mode 100644 tests/run-make-fulldeps/link-cfg/Makefile delete mode 100644 tests/run-make-fulldeps/link-cfg/dep-with-staticlib.rs delete mode 100644 tests/run-make-fulldeps/link-cfg/dep.rs delete mode 100644 tests/run-make-fulldeps/link-cfg/no-deps.rs delete mode 100644 tests/run-make-fulldeps/link-cfg/return1.c delete mode 100644 tests/run-make-fulldeps/link-cfg/return2.c delete mode 100644 tests/run-make-fulldeps/link-cfg/return3.c delete mode 100644 tests/run-make-fulldeps/link-cfg/with-deps.rs delete mode 100644 tests/run-make-fulldeps/link-cfg/with-staticlib-deps.rs delete mode 100644 tests/run-make-fulldeps/link-dedup/Makefile delete mode 100644 tests/run-make-fulldeps/link-dedup/depa.rs delete mode 100644 tests/run-make-fulldeps/link-dedup/depb.rs delete mode 100644 tests/run-make-fulldeps/link-dedup/depc.rs delete mode 100644 tests/run-make-fulldeps/link-dedup/empty.rs delete mode 100644 tests/run-make-fulldeps/link-path-order/Makefile delete mode 100644 tests/run-make-fulldeps/link-path-order/correct.c delete mode 100644 tests/run-make-fulldeps/link-path-order/main.rs delete mode 100644 tests/run-make-fulldeps/link-path-order/wrong.c delete mode 100644 tests/run-make-fulldeps/linkage-attr-on-static/Makefile delete mode 100644 tests/run-make-fulldeps/linkage-attr-on-static/bar.rs delete mode 100644 tests/run-make-fulldeps/linkage-attr-on-static/foo.c delete mode 100644 tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/Makefile delete mode 100644 tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.bat delete mode 100644 tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.rs delete mode 100644 tests/run-make-fulldeps/long-linker-command-lines/Makefile delete mode 100644 tests/run-make-fulldeps/long-linker-command-lines/foo.rs delete mode 100644 tests/run-make-fulldeps/longjmp-across-rust/Makefile delete mode 100644 tests/run-make-fulldeps/longjmp-across-rust/foo.c delete mode 100644 tests/run-make-fulldeps/longjmp-across-rust/main.rs delete mode 100644 tests/run-make-fulldeps/ls-metadata/Makefile delete mode 100644 tests/run-make-fulldeps/ls-metadata/foo.rs delete mode 100644 tests/run-make-fulldeps/lto-dylib-dep/Makefile delete mode 100644 tests/run-make-fulldeps/lto-dylib-dep/a_dylib.rs delete mode 100644 tests/run-make-fulldeps/lto-dylib-dep/main.rs delete mode 100644 tests/run-make-fulldeps/lto-empty/Makefile delete mode 100644 tests/run-make-fulldeps/lto-empty/lib.rs delete mode 100644 tests/run-make-fulldeps/lto-no-link-whole-rlib/Makefile delete mode 100644 tests/run-make-fulldeps/lto-no-link-whole-rlib/bar.c delete mode 100644 tests/run-make-fulldeps/lto-no-link-whole-rlib/foo.c delete mode 100644 tests/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs delete mode 100644 tests/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs delete mode 100644 tests/run-make-fulldeps/lto-no-link-whole-rlib/main.rs delete mode 100644 tests/run-make-fulldeps/lto-readonly-lib/Makefile delete mode 100644 tests/run-make-fulldeps/lto-readonly-lib/lib.rs delete mode 100644 tests/run-make-fulldeps/lto-readonly-lib/main.rs delete mode 100644 tests/run-make-fulldeps/lto-smoke-c/Makefile delete mode 100644 tests/run-make-fulldeps/lto-smoke-c/bar.c delete mode 100644 tests/run-make-fulldeps/lto-smoke-c/foo.rs delete mode 100644 tests/run-make-fulldeps/lto-smoke/Makefile delete mode 100644 tests/run-make-fulldeps/lto-smoke/lib.rs delete mode 100644 tests/run-make-fulldeps/lto-smoke/main.rs delete mode 100644 tests/run-make-fulldeps/manual-crate-name/Makefile delete mode 100644 tests/run-make-fulldeps/manual-crate-name/bar.rs delete mode 100644 tests/run-make-fulldeps/manual-link/Makefile delete mode 100644 tests/run-make-fulldeps/manual-link/bar.c delete mode 100644 tests/run-make-fulldeps/manual-link/foo.c delete mode 100644 tests/run-make-fulldeps/manual-link/foo.rs delete mode 100644 tests/run-make-fulldeps/manual-link/main.rs delete mode 100644 tests/run-make-fulldeps/many-crates-but-no-match/Makefile delete mode 100644 tests/run-make-fulldeps/many-crates-but-no-match/crateA1.rs delete mode 100644 tests/run-make-fulldeps/many-crates-but-no-match/crateA2.rs delete mode 100644 tests/run-make-fulldeps/many-crates-but-no-match/crateA3.rs delete mode 100644 tests/run-make-fulldeps/many-crates-but-no-match/crateB.rs delete mode 100644 tests/run-make-fulldeps/many-crates-but-no-match/crateC.rs delete mode 100644 tests/run-make-fulldeps/metadata-flag-frobs-symbols/Makefile delete mode 100644 tests/run-make-fulldeps/metadata-flag-frobs-symbols/bar.rs delete mode 100644 tests/run-make-fulldeps/metadata-flag-frobs-symbols/foo.rs delete mode 100644 tests/run-make-fulldeps/min-global-align/Makefile delete mode 100644 tests/run-make-fulldeps/min-global-align/min_global_align.rs delete mode 100644 tests/run-make-fulldeps/mingw-export-call-convention/Makefile delete mode 100644 tests/run-make-fulldeps/mingw-export-call-convention/foo.rs delete mode 100644 tests/run-make-fulldeps/mismatching-target-triples/Makefile delete mode 100644 tests/run-make-fulldeps/mismatching-target-triples/bar.rs delete mode 100644 tests/run-make-fulldeps/mismatching-target-triples/foo.rs delete mode 100644 tests/run-make-fulldeps/missing-crate-dependency/Makefile delete mode 100644 tests/run-make-fulldeps/missing-crate-dependency/crateA.rs delete mode 100644 tests/run-make-fulldeps/missing-crate-dependency/crateB.rs delete mode 100644 tests/run-make-fulldeps/missing-crate-dependency/crateC.rs delete mode 100644 tests/run-make-fulldeps/mixing-deps/Makefile delete mode 100644 tests/run-make-fulldeps/mixing-deps/both.rs delete mode 100644 tests/run-make-fulldeps/mixing-deps/dylib.rs delete mode 100644 tests/run-make-fulldeps/mixing-deps/prog.rs delete mode 100644 tests/run-make-fulldeps/mixing-formats/Makefile delete mode 100644 tests/run-make-fulldeps/mixing-formats/bar1.rs delete mode 100644 tests/run-make-fulldeps/mixing-formats/bar2.rs delete mode 100644 tests/run-make-fulldeps/mixing-formats/baz.rs delete mode 100644 tests/run-make-fulldeps/mixing-formats/baz2.rs delete mode 100644 tests/run-make-fulldeps/mixing-formats/foo.rs delete mode 100644 tests/run-make-fulldeps/mixing-libs/Makefile delete mode 100644 tests/run-make-fulldeps/mixing-libs/dylib.rs delete mode 100644 tests/run-make-fulldeps/mixing-libs/prog.rs delete mode 100644 tests/run-make-fulldeps/mixing-libs/rlib.rs delete mode 100644 tests/run-make-fulldeps/msvc-opt-minsize/Makefile delete mode 100644 tests/run-make-fulldeps/msvc-opt-minsize/foo.rs delete mode 100644 tests/run-make-fulldeps/multiple-emits/Makefile delete mode 100644 tests/run-make-fulldeps/multiple-emits/foo.rs delete mode 100644 tests/run-make-fulldeps/no-builtins-lto/Makefile delete mode 100644 tests/run-make-fulldeps/no-builtins-lto/main.rs delete mode 100644 tests/run-make-fulldeps/no-builtins-lto/no_builtins.rs delete mode 100644 tests/run-make-fulldeps/no-duplicate-libs/Makefile delete mode 100644 tests/run-make-fulldeps/no-duplicate-libs/bar.c delete mode 100644 tests/run-make-fulldeps/no-duplicate-libs/foo.c delete mode 100644 tests/run-make-fulldeps/no-duplicate-libs/main.rs delete mode 100644 tests/run-make-fulldeps/no-intermediate-extras/Makefile delete mode 100644 tests/run-make-fulldeps/no-intermediate-extras/foo.rs delete mode 100644 tests/run-make-fulldeps/obey-crate-type-flag/Makefile delete mode 100644 tests/run-make-fulldeps/obey-crate-type-flag/test.rs delete mode 100644 tests/run-make-fulldeps/output-filename-conflicts-with-directory/Makefile delete mode 100644 tests/run-make-fulldeps/output-filename-conflicts-with-directory/foo.rs delete mode 100644 tests/run-make-fulldeps/output-filename-overwrites-input/Makefile delete mode 100644 tests/run-make-fulldeps/output-filename-overwrites-input/bar.rs delete mode 100644 tests/run-make-fulldeps/output-filename-overwrites-input/foo.rs delete mode 100644 tests/run-make-fulldeps/output-type-permutations/Makefile delete mode 100644 tests/run-make-fulldeps/output-type-permutations/foo.rs delete mode 100644 tests/run-make-fulldeps/output-with-hyphens/Makefile delete mode 100644 tests/run-make-fulldeps/output-with-hyphens/foo-bar.rs delete mode 100644 tests/run-make-fulldeps/override-aliased-flags/Makefile delete mode 100644 tests/run-make-fulldeps/override-aliased-flags/main.rs delete mode 100644 tests/run-make-fulldeps/panic-impl-transitive/Makefile delete mode 100644 tests/run-make-fulldeps/panic-impl-transitive/panic-impl-consumer.rs delete mode 100644 tests/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs delete mode 100644 tests/run-make-fulldeps/pass-non-c-like-enum-to-c/Makefile delete mode 100644 tests/run-make-fulldeps/pass-non-c-like-enum-to-c/nonclike.rs delete mode 100644 tests/run-make-fulldeps/pass-non-c-like-enum-to-c/test.c delete mode 100644 tests/run-make-fulldeps/pgo-branch-weights/Makefile delete mode 100644 tests/run-make-fulldeps/pgo-branch-weights/filecheck-patterns.txt delete mode 100644 tests/run-make-fulldeps/pgo-branch-weights/interesting.rs delete mode 100644 tests/run-make-fulldeps/pgo-branch-weights/main.rs delete mode 100644 tests/run-make-fulldeps/pgo-branch-weights/opaque.rs delete mode 100644 tests/run-make-fulldeps/pgo-gen-lto/Makefile delete mode 100644 tests/run-make-fulldeps/pgo-gen-lto/test.rs delete mode 100644 tests/run-make-fulldeps/pgo-gen-no-imp-symbols/Makefile delete mode 100644 tests/run-make-fulldeps/pgo-gen-no-imp-symbols/test.rs delete mode 100644 tests/run-make-fulldeps/pgo-gen/Makefile delete mode 100644 tests/run-make-fulldeps/pgo-gen/test.rs delete mode 100644 tests/run-make-fulldeps/pgo-indirect-call-promotion/Makefile delete mode 100644 tests/run-make-fulldeps/pgo-indirect-call-promotion/filecheck-patterns.txt delete mode 100644 tests/run-make-fulldeps/pgo-indirect-call-promotion/interesting.rs delete mode 100644 tests/run-make-fulldeps/pgo-indirect-call-promotion/main.rs delete mode 100644 tests/run-make-fulldeps/pgo-indirect-call-promotion/opaque.rs delete mode 100644 tests/run-make-fulldeps/pgo-use/Makefile delete mode 100644 tests/run-make-fulldeps/pgo-use/filecheck-patterns.txt delete mode 100644 tests/run-make-fulldeps/pgo-use/main.rs delete mode 100644 tests/run-make-fulldeps/pointer-auth-link-with-c/Makefile delete mode 100644 tests/run-make-fulldeps/pointer-auth-link-with-c/test.c delete mode 100644 tests/run-make-fulldeps/pointer-auth-link-with-c/test.rs delete mode 100644 tests/run-make-fulldeps/prefer-dylib/Makefile delete mode 100644 tests/run-make-fulldeps/prefer-dylib/bar.rs delete mode 100644 tests/run-make-fulldeps/prefer-dylib/foo.rs delete mode 100644 tests/run-make-fulldeps/prefer-rlib/Makefile delete mode 100644 tests/run-make-fulldeps/prefer-rlib/bar.rs delete mode 100644 tests/run-make-fulldeps/prefer-rlib/foo.rs delete mode 100644 tests/run-make-fulldeps/pretty-print-to-file/Makefile delete mode 100644 tests/run-make-fulldeps/pretty-print-to-file/input.pp delete mode 100644 tests/run-make-fulldeps/pretty-print-to-file/input.rs delete mode 100644 tests/run-make-fulldeps/print-calling-conventions/Makefile delete mode 100644 tests/run-make-fulldeps/print-cfg/Makefile delete mode 100644 tests/run-make-fulldeps/print-target-list/Makefile delete mode 100644 tests/run-make-fulldeps/profile/Makefile delete mode 100644 tests/run-make-fulldeps/profile/test.rs delete mode 100644 tests/run-make-fulldeps/prune-link-args/Makefile delete mode 100644 tests/run-make-fulldeps/prune-link-args/empty.rs delete mode 100644 tests/run-make-fulldeps/redundant-libs/Makefile delete mode 100644 tests/run-make-fulldeps/redundant-libs/bar.c delete mode 100644 tests/run-make-fulldeps/redundant-libs/baz.c delete mode 100644 tests/run-make-fulldeps/redundant-libs/foo.c delete mode 100644 tests/run-make-fulldeps/redundant-libs/main.rs delete mode 100644 tests/run-make-fulldeps/relocation-model/Makefile delete mode 100644 tests/run-make-fulldeps/relocation-model/foo.rs delete mode 100644 tests/run-make-fulldeps/relro-levels/Makefile delete mode 100644 tests/run-make-fulldeps/relro-levels/hello.rs delete mode 100644 tests/run-make-fulldeps/remap-path-prefix/Makefile delete mode 100644 tests/run-make-fulldeps/remap-path-prefix/auxiliary/lib.rs delete mode 100644 tests/run-make-fulldeps/reproducible-build-2/Makefile delete mode 100644 tests/run-make-fulldeps/reproducible-build-2/linker.rs delete mode 100644 tests/run-make-fulldeps/reproducible-build-2/reproducible-build-aux.rs delete mode 100644 tests/run-make-fulldeps/reproducible-build-2/reproducible-build.rs delete mode 100644 tests/run-make-fulldeps/reproducible-build/Makefile delete mode 100644 tests/run-make-fulldeps/reproducible-build/linker.rs delete mode 100644 tests/run-make-fulldeps/reproducible-build/reproducible-build-aux.rs delete mode 100644 tests/run-make-fulldeps/reproducible-build/reproducible-build.rs delete mode 100644 tests/run-make-fulldeps/resolve-rename/Makefile delete mode 100644 tests/run-make-fulldeps/resolve-rename/bar.rs delete mode 100644 tests/run-make-fulldeps/resolve-rename/baz.rs delete mode 100644 tests/run-make-fulldeps/resolve-rename/foo.rs delete mode 100644 tests/run-make-fulldeps/return-non-c-like-enum-from-c/Makefile delete mode 100644 tests/run-make-fulldeps/return-non-c-like-enum-from-c/nonclike.rs delete mode 100644 tests/run-make-fulldeps/return-non-c-like-enum-from-c/test.c delete mode 100644 tests/run-make-fulldeps/return-non-c-like-enum/Makefile delete mode 100644 tests/run-make-fulldeps/return-non-c-like-enum/nonclike.rs delete mode 100644 tests/run-make-fulldeps/return-non-c-like-enum/test.c delete mode 100644 tests/run-make-fulldeps/rlib-chain/Makefile delete mode 100644 tests/run-make-fulldeps/rlib-chain/m1.rs delete mode 100644 tests/run-make-fulldeps/rlib-chain/m2.rs delete mode 100644 tests/run-make-fulldeps/rlib-chain/m3.rs delete mode 100644 tests/run-make-fulldeps/rlib-chain/m4.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-determinism/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-determinism/bar.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-determinism/foo.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-error-lines/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-error-lines/input.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-io-error/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-io-error/foo.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-map-file/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-map-file/expected.json delete mode 100644 tests/run-make-fulldeps/rustdoc-map-file/foo.rs delete mode 100755 tests/run-make-fulldeps/rustdoc-map-file/validate_json.py delete mode 100644 tests/run-make-fulldeps/rustdoc-output-path/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-output-path/foo.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-scrape-examples-macros/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/lib.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/proc.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-target-spec-json-path/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-target-spec-json-path/dummy_core.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-target-spec-json-path/my_crate.rs delete mode 100644 tests/run-make-fulldeps/rustdoc-target-spec-json-path/target.json delete mode 100644 tests/run-make-fulldeps/rustdoc-themes/Makefile delete mode 100644 tests/run-make-fulldeps/rustdoc-themes/foo.rs delete mode 100644 tests/run-make-fulldeps/sanitizer-cdylib-link/Makefile delete mode 100644 tests/run-make-fulldeps/sanitizer-cdylib-link/library.rs delete mode 100644 tests/run-make-fulldeps/sanitizer-cdylib-link/program.rs delete mode 100644 tests/run-make-fulldeps/sanitizer-dylib-link/Makefile delete mode 100644 tests/run-make-fulldeps/sanitizer-dylib-link/library.rs delete mode 100644 tests/run-make-fulldeps/sanitizer-dylib-link/program.rs delete mode 100644 tests/run-make-fulldeps/sanitizer-staticlib-link/Makefile delete mode 100644 tests/run-make-fulldeps/sanitizer-staticlib-link/library.rs delete mode 100644 tests/run-make-fulldeps/sanitizer-staticlib-link/program.c delete mode 100644 tests/run-make-fulldeps/sanitizer-staticlib-link/program.rs delete mode 100644 tests/run-make-fulldeps/separate-link-fail/Makefile delete mode 100644 tests/run-make-fulldeps/separate-link/Makefile delete mode 100644 tests/run-make-fulldeps/sepcomp-cci-copies/Makefile delete mode 100644 tests/run-make-fulldeps/sepcomp-cci-copies/cci_lib.rs delete mode 100644 tests/run-make-fulldeps/sepcomp-cci-copies/foo.rs delete mode 100644 tests/run-make-fulldeps/sepcomp-inlining/Makefile delete mode 100644 tests/run-make-fulldeps/sepcomp-inlining/foo.rs delete mode 100644 tests/run-make-fulldeps/sepcomp-separate/Makefile delete mode 100644 tests/run-make-fulldeps/sepcomp-separate/foo.rs delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/Makefile delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/instance_provider_a.rs delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/instance_provider_b.rs delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/instance_user_a_rlib.rs delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/instance_user_b_rlib.rs delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/instance_user_dylib.rs delete mode 100644 tests/run-make-fulldeps/share-generics-dylib/linked_leaf.rs delete mode 100644 tests/run-make-fulldeps/simd-ffi/Makefile delete mode 100644 tests/run-make-fulldeps/simd-ffi/simd.rs delete mode 100644 tests/run-make-fulldeps/simple-dylib/Makefile delete mode 100644 tests/run-make-fulldeps/simple-dylib/bar.rs delete mode 100644 tests/run-make-fulldeps/simple-dylib/foo.rs delete mode 100644 tests/run-make-fulldeps/simple-rlib/Makefile delete mode 100644 tests/run-make-fulldeps/simple-rlib/bar.rs delete mode 100644 tests/run-make-fulldeps/simple-rlib/foo.rs delete mode 100644 tests/run-make-fulldeps/split-debuginfo/Makefile delete mode 100644 tests/run-make-fulldeps/split-debuginfo/bar.rs delete mode 100644 tests/run-make-fulldeps/split-debuginfo/baz.rs delete mode 100644 tests/run-make-fulldeps/split-debuginfo/foo.rs delete mode 100644 tests/run-make-fulldeps/split-debuginfo/main.rs delete mode 100644 tests/run-make-fulldeps/stable-symbol-names/Makefile delete mode 100644 tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names1.rs delete mode 100644 tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names2.rs delete mode 100644 tests/run-make-fulldeps/static-dylib-by-default/Makefile delete mode 100644 tests/run-make-fulldeps/static-dylib-by-default/bar.rs delete mode 100644 tests/run-make-fulldeps/static-dylib-by-default/foo.rs delete mode 100644 tests/run-make-fulldeps/static-dylib-by-default/main.c delete mode 100644 tests/run-make-fulldeps/static-extern-type/Makefile delete mode 100644 tests/run-make-fulldeps/static-extern-type/define-foo.c delete mode 100644 tests/run-make-fulldeps/static-extern-type/use-foo.rs delete mode 100644 tests/run-make-fulldeps/static-unwinding/Makefile delete mode 100644 tests/run-make-fulldeps/static-unwinding/lib.rs delete mode 100644 tests/run-make-fulldeps/static-unwinding/main.rs delete mode 100644 tests/run-make-fulldeps/staticlib-blank-lib/Makefile delete mode 100644 tests/run-make-fulldeps/staticlib-blank-lib/foo.rs delete mode 100644 tests/run-make-fulldeps/std-core-cycle/Makefile delete mode 100644 tests/run-make-fulldeps/std-core-cycle/bar.rs delete mode 100644 tests/run-make-fulldeps/std-core-cycle/foo.rs delete mode 100644 tests/run-make-fulldeps/stdin-non-utf8/Makefile delete mode 100644 tests/run-make-fulldeps/stdin-non-utf8/non-utf8 delete mode 100644 tests/run-make-fulldeps/suspicious-library/Makefile delete mode 100644 tests/run-make-fulldeps/suspicious-library/bar.rs delete mode 100644 tests/run-make-fulldeps/suspicious-library/foo.rs delete mode 100644 tests/run-make-fulldeps/symbol-visibility/Makefile delete mode 100644 tests/run-make-fulldeps/symbol-visibility/a_cdylib.rs delete mode 100644 tests/run-make-fulldeps/symbol-visibility/a_proc_macro.rs delete mode 100644 tests/run-make-fulldeps/symbol-visibility/a_rust_dylib.rs delete mode 100644 tests/run-make-fulldeps/symbol-visibility/an_executable.rs delete mode 100644 tests/run-make-fulldeps/symbol-visibility/an_rlib.rs delete mode 100644 tests/run-make-fulldeps/symbols-include-type-name/Makefile delete mode 100644 tests/run-make-fulldeps/symbols-include-type-name/lib.rs delete mode 100644 tests/run-make-fulldeps/symlinked-extern/Makefile delete mode 100644 tests/run-make-fulldeps/symlinked-extern/bar.rs delete mode 100644 tests/run-make-fulldeps/symlinked-extern/baz.rs delete mode 100644 tests/run-make-fulldeps/symlinked-extern/foo.rs delete mode 100644 tests/run-make-fulldeps/symlinked-libraries/Makefile delete mode 100644 tests/run-make-fulldeps/symlinked-libraries/bar.rs delete mode 100644 tests/run-make-fulldeps/symlinked-libraries/foo.rs delete mode 100644 tests/run-make-fulldeps/symlinked-rlib/Makefile delete mode 100644 tests/run-make-fulldeps/symlinked-rlib/bar.rs delete mode 100644 tests/run-make-fulldeps/symlinked-rlib/foo.rs delete mode 100644 tests/run-make-fulldeps/sysroot-crates-are-unstable/Makefile delete mode 100644 tests/run-make-fulldeps/sysroot-crates-are-unstable/test.py delete mode 100644 tests/run-make-fulldeps/target-cpu-native/Makefile delete mode 100644 tests/run-make-fulldeps/target-cpu-native/foo.rs delete mode 100644 tests/run-make-fulldeps/target-specs/Makefile delete mode 100644 tests/run-make-fulldeps/target-specs/definitely-not-builtin-target.json delete mode 100644 tests/run-make-fulldeps/target-specs/foo.rs delete mode 100644 tests/run-make-fulldeps/target-specs/mismatching-data-layout.json delete mode 100644 tests/run-make-fulldeps/target-specs/my-awesome-platform.json delete mode 100644 tests/run-make-fulldeps/target-specs/my-incomplete-platform.json delete mode 100644 tests/run-make-fulldeps/target-specs/my-invalid-platform.json delete mode 100644 tests/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json delete mode 100644 tests/run-make-fulldeps/target-without-atomic-cas/Makefile delete mode 100644 tests/run-make-fulldeps/test-harness/Makefile delete mode 100644 tests/run-make-fulldeps/test-harness/test-ignore-cfg.rs delete mode 100644 tests/run-make-fulldeps/type-mismatch-same-crate-name/Makefile delete mode 100644 tests/run-make-fulldeps/type-mismatch-same-crate-name/crateA.rs delete mode 100644 tests/run-make-fulldeps/type-mismatch-same-crate-name/crateB.rs delete mode 100644 tests/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs delete mode 100644 tests/run-make-fulldeps/use-extern-for-plugins/Makefile delete mode 100644 tests/run-make-fulldeps/use-extern-for-plugins/bar.rs delete mode 100644 tests/run-make-fulldeps/use-extern-for-plugins/baz.rs delete mode 100644 tests/run-make-fulldeps/use-extern-for-plugins/foo.rs delete mode 100644 tests/run-make-fulldeps/use-suggestions-rust-2018/Makefile delete mode 100644 tests/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs delete mode 100644 tests/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs delete mode 100644 tests/run-make-fulldeps/used-cdylib-macos/Makefile delete mode 100644 tests/run-make-fulldeps/used-cdylib-macos/dylib_used.rs delete mode 100644 tests/run-make-fulldeps/used/Makefile delete mode 100644 tests/run-make-fulldeps/used/used.rs delete mode 100644 tests/run-make-fulldeps/version/Makefile delete mode 100644 tests/run-make-fulldeps/volatile-intrinsics/Makefile delete mode 100644 tests/run-make-fulldeps/volatile-intrinsics/main.rs delete mode 100644 tests/run-make-fulldeps/weird-output-filenames/Makefile delete mode 100644 tests/run-make-fulldeps/weird-output-filenames/foo.rs delete mode 100644 tests/run-make-fulldeps/windows-binary-no-external-deps/Makefile delete mode 100644 tests/run-make-fulldeps/windows-binary-no-external-deps/hello.rs delete mode 100644 tests/run-make-fulldeps/windows-spawn/Makefile delete mode 100644 tests/run-make-fulldeps/windows-spawn/hello.rs delete mode 100644 tests/run-make-fulldeps/windows-spawn/spawn.rs delete mode 100644 tests/run-make-fulldeps/windows-subsystem/Makefile delete mode 100644 tests/run-make-fulldeps/windows-subsystem/console.rs delete mode 100644 tests/run-make-fulldeps/windows-subsystem/windows.rs create mode 100644 tests/run-make/a-b-a-linker-guard/Makefile create mode 100644 tests/run-make/a-b-a-linker-guard/a.rs create mode 100644 tests/run-make/a-b-a-linker-guard/b.rs create mode 100644 tests/run-make/alloc-no-oom-handling/Makefile create mode 100644 tests/run-make/alloc-no-rc/Makefile create mode 100644 tests/run-make/alloc-no-sync/Makefile create mode 100644 tests/run-make/allow-non-lint-warnings-cmdline/Makefile create mode 100644 tests/run-make/allow-non-lint-warnings-cmdline/foo.rs create mode 100644 tests/run-make/allow-warnings-cmdline-stability/Makefile create mode 100644 tests/run-make/allow-warnings-cmdline-stability/bar.rs create mode 100644 tests/run-make/allow-warnings-cmdline-stability/foo.rs create mode 100644 tests/run-make/archive-duplicate-names/Makefile create mode 100644 tests/run-make/archive-duplicate-names/bar.c create mode 100644 tests/run-make/archive-duplicate-names/bar.rs create mode 100644 tests/run-make/archive-duplicate-names/foo.c create mode 100644 tests/run-make/archive-duplicate-names/foo.rs create mode 100644 tests/run-make/arguments-non-c-like-enum/Makefile create mode 100644 tests/run-make/arguments-non-c-like-enum/nonclike.rs create mode 100644 tests/run-make/arguments-non-c-like-enum/test.c create mode 100644 tests/run-make/atomic-lock-free/Makefile create mode 100644 tests/run-make/atomic-lock-free/atomic_lock_free.rs create mode 100644 tests/run-make/bare-outfile/Makefile create mode 100644 tests/run-make/bare-outfile/foo.rs create mode 100644 tests/run-make/c-dynamic-dylib/Makefile create mode 100644 tests/run-make/c-dynamic-dylib/bar.rs create mode 100644 tests/run-make/c-dynamic-dylib/cfoo.c create mode 100644 tests/run-make/c-dynamic-dylib/foo.rs create mode 100644 tests/run-make/c-dynamic-rlib/Makefile create mode 100644 tests/run-make/c-dynamic-rlib/bar.rs create mode 100644 tests/run-make/c-dynamic-rlib/cfoo.c create mode 100644 tests/run-make/c-dynamic-rlib/foo.rs create mode 100644 tests/run-make/c-link-to-rust-dylib/Makefile create mode 100644 tests/run-make/c-link-to-rust-dylib/bar.c create mode 100644 tests/run-make/c-link-to-rust-dylib/foo.rs create mode 100644 tests/run-make/c-link-to-rust-staticlib/Makefile create mode 100644 tests/run-make/c-link-to-rust-staticlib/bar.c create mode 100644 tests/run-make/c-link-to-rust-staticlib/foo.rs create mode 100644 tests/run-make/c-link-to-rust-va-list-fn/Makefile create mode 100644 tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs create mode 100644 tests/run-make/c-link-to-rust-va-list-fn/test.c create mode 100644 tests/run-make/c-static-dylib/Makefile create mode 100644 tests/run-make/c-static-dylib/bar.rs create mode 100644 tests/run-make/c-static-dylib/cfoo.c create mode 100644 tests/run-make/c-static-dylib/foo.rs create mode 100644 tests/run-make/c-static-rlib/Makefile create mode 100644 tests/run-make/c-static-rlib/bar.rs create mode 100644 tests/run-make/c-static-rlib/cfoo.c create mode 100644 tests/run-make/c-static-rlib/foo.rs create mode 100644 tests/run-make/c-unwind-abi-catch-lib-panic/Makefile create mode 100644 tests/run-make/c-unwind-abi-catch-lib-panic/add.c create mode 100644 tests/run-make/c-unwind-abi-catch-lib-panic/main.rs create mode 100644 tests/run-make/c-unwind-abi-catch-lib-panic/panic.rs create mode 100644 tests/run-make/c-unwind-abi-catch-panic/Makefile create mode 100644 tests/run-make/c-unwind-abi-catch-panic/add.c create mode 100644 tests/run-make/c-unwind-abi-catch-panic/main.rs create mode 100644 tests/run-make/cat-and-grep-sanity-check/Makefile create mode 100644 tests/run-make/cdylib-dylib-linkage/Makefile create mode 100644 tests/run-make/cdylib-dylib-linkage/bar.rs create mode 100644 tests/run-make/cdylib-dylib-linkage/foo.c create mode 100644 tests/run-make/cdylib-dylib-linkage/foo.rs create mode 100644 tests/run-make/cdylib-fewer-symbols/Makefile create mode 100644 tests/run-make/cdylib-fewer-symbols/foo.rs create mode 100644 tests/run-make/cdylib/Makefile create mode 100644 tests/run-make/cdylib/bar.rs create mode 100644 tests/run-make/cdylib/foo.c create mode 100644 tests/run-make/cdylib/foo.rs create mode 100644 tests/run-make/codegen-options-parsing/Makefile create mode 100644 tests/run-make/codegen-options-parsing/dummy.rs create mode 100644 tests/run-make/compile-stdin/Makefile create mode 100644 tests/run-make/compiler-lookup-paths-2/Makefile create mode 100644 tests/run-make/compiler-lookup-paths-2/a.rs create mode 100644 tests/run-make/compiler-lookup-paths-2/b.rs create mode 100644 tests/run-make/compiler-lookup-paths-2/c.rs create mode 100644 tests/run-make/compiler-lookup-paths/Makefile create mode 100644 tests/run-make/compiler-lookup-paths/a.rs create mode 100644 tests/run-make/compiler-lookup-paths/b.rs create mode 100644 tests/run-make/compiler-lookup-paths/c.rs create mode 100644 tests/run-make/compiler-lookup-paths/d.rs create mode 100644 tests/run-make/compiler-lookup-paths/e.rs create mode 100644 tests/run-make/compiler-lookup-paths/e2.rs create mode 100644 tests/run-make/compiler-lookup-paths/f.rs create mode 100644 tests/run-make/compiler-lookup-paths/native.c create mode 100644 tests/run-make/compiler-rt-works-on-mingw/Makefile create mode 100644 tests/run-make/compiler-rt-works-on-mingw/foo.cpp create mode 100644 tests/run-make/compiler-rt-works-on-mingw/foo.rs create mode 100644 tests/run-make/core-no-fp-fmt-parse/Makefile create mode 100644 tests/run-make/crate-data-smoke/Makefile create mode 100644 tests/run-make/crate-data-smoke/crate.rs create mode 100644 tests/run-make/crate-data-smoke/lib.rs create mode 100644 tests/run-make/crate-data-smoke/rlib.rs create mode 100644 tests/run-make/crate-hash-rustc-version/Makefile create mode 100644 tests/run-make/crate-hash-rustc-version/a.rs create mode 100644 tests/run-make/crate-hash-rustc-version/b.rs create mode 100644 tests/run-make/crate-name-priority/Makefile create mode 100644 tests/run-make/crate-name-priority/foo.rs create mode 100644 tests/run-make/crate-name-priority/foo1.rs create mode 100644 tests/run-make/cross-lang-lto-clang/Makefile create mode 100644 tests/run-make/cross-lang-lto-clang/clib.c create mode 100644 tests/run-make/cross-lang-lto-clang/cmain.c create mode 100644 tests/run-make/cross-lang-lto-clang/main.rs create mode 100644 tests/run-make/cross-lang-lto-clang/rustlib.rs create mode 100644 tests/run-make/cross-lang-lto-pgo-smoketest/Makefile create mode 100644 tests/run-make/cross-lang-lto-pgo-smoketest/clib.c create mode 100644 tests/run-make/cross-lang-lto-pgo-smoketest/cmain.c create mode 100644 tests/run-make/cross-lang-lto-pgo-smoketest/main.rs create mode 100644 tests/run-make/cross-lang-lto-pgo-smoketest/rustlib.rs create mode 100644 tests/run-make/cross-lang-lto-upstream-rlibs/Makefile create mode 100644 tests/run-make/cross-lang-lto-upstream-rlibs/staticlib.rs create mode 100644 tests/run-make/cross-lang-lto-upstream-rlibs/upstream.rs create mode 100644 tests/run-make/cross-lang-lto/Makefile create mode 100644 tests/run-make/cross-lang-lto/lib.rs create mode 100644 tests/run-make/cross-lang-lto/main.rs create mode 100644 tests/run-make/debug-assertions/Makefile create mode 100644 tests/run-make/debug-assertions/debug.rs create mode 100644 tests/run-make/dep-info-doesnt-run-much/Makefile create mode 100644 tests/run-make/dep-info-doesnt-run-much/foo.rs create mode 100644 tests/run-make/dep-info-spaces/Makefile create mode 100644 tests/run-make/dep-info-spaces/Makefile.foo create mode 100644 tests/run-make/dep-info-spaces/bar.rs create mode 100644 tests/run-make/dep-info-spaces/foo foo.rs create mode 100644 tests/run-make/dep-info-spaces/lib.rs create mode 100644 tests/run-make/dep-info/Makefile create mode 100644 tests/run-make/dep-info/Makefile.foo create mode 100644 tests/run-make/dep-info/bar.rs create mode 100644 tests/run-make/dep-info/foo.rs create mode 100644 tests/run-make/dep-info/lib.rs create mode 100644 tests/run-make/dep-info/lib2.rs create mode 100644 tests/run-make/doctests-keep-binaries/Makefile create mode 100644 tests/run-make/doctests-keep-binaries/t.rs create mode 100644 tests/run-make/duplicate-output-flavors/Makefile create mode 100644 tests/run-make/duplicate-output-flavors/foo.rs create mode 100644 tests/run-make/dylib-chain/Makefile create mode 100644 tests/run-make/dylib-chain/m1.rs create mode 100644 tests/run-make/dylib-chain/m2.rs create mode 100644 tests/run-make/dylib-chain/m3.rs create mode 100644 tests/run-make/dylib-chain/m4.rs create mode 100644 tests/run-make/emit-stack-sizes/Makefile create mode 100644 tests/run-make/emit-stack-sizes/foo.rs create mode 100644 tests/run-make/emit/Makefile create mode 100644 tests/run-make/emit/test-24876.rs create mode 100644 tests/run-make/emit/test-26235.rs create mode 100644 tests/run-make/error-found-staticlib-instead-crate/Makefile create mode 100644 tests/run-make/error-found-staticlib-instead-crate/bar.rs create mode 100644 tests/run-make/error-found-staticlib-instead-crate/foo.rs create mode 100644 tests/run-make/error-writing-dependencies/Makefile create mode 100644 tests/run-make/error-writing-dependencies/foo.rs create mode 100644 tests/run-make/exit-code/Makefile create mode 100644 tests/run-make/exit-code/compile-error.rs create mode 100644 tests/run-make/exit-code/lint-failure.rs create mode 100644 tests/run-make/exit-code/success.rs create mode 100644 tests/run-make/extern-diff-internal-name/Makefile create mode 100644 tests/run-make/extern-diff-internal-name/lib.rs create mode 100644 tests/run-make/extern-diff-internal-name/test.rs create mode 100644 tests/run-make/extern-flag-disambiguates/Makefile create mode 100644 tests/run-make/extern-flag-disambiguates/a.rs create mode 100644 tests/run-make/extern-flag-disambiguates/b.rs create mode 100644 tests/run-make/extern-flag-disambiguates/c.rs create mode 100644 tests/run-make/extern-flag-disambiguates/d.rs create mode 100644 tests/run-make/extern-flag-fun/Makefile create mode 100644 tests/run-make/extern-flag-fun/bar-alt.rs create mode 100644 tests/run-make/extern-flag-fun/bar.rs create mode 100644 tests/run-make/extern-flag-fun/foo.rs create mode 100644 tests/run-make/extern-flag-fun/gated_unstable.rs create mode 100644 tests/run-make/extern-flag-fun/rustc.rs create mode 100644 tests/run-make/extern-flag-pathless/Makefile create mode 100644 tests/run-make/extern-flag-pathless/bar-dynamic.rs create mode 100644 tests/run-make/extern-flag-pathless/bar-static.rs create mode 100644 tests/run-make/extern-flag-pathless/foo.rs create mode 100644 tests/run-make/extern-flag-rename-transitive/Makefile create mode 100644 tests/run-make/extern-flag-rename-transitive/bar.rs create mode 100644 tests/run-make/extern-flag-rename-transitive/baz.rs create mode 100644 tests/run-make/extern-flag-rename-transitive/foo.rs create mode 100644 tests/run-make/extern-fn-generic/Makefile create mode 100644 tests/run-make/extern-fn-generic/test.c create mode 100644 tests/run-make/extern-fn-generic/test.rs create mode 100644 tests/run-make/extern-fn-generic/testcrate.rs create mode 100644 tests/run-make/extern-fn-mangle/Makefile create mode 100644 tests/run-make/extern-fn-mangle/test.c create mode 100644 tests/run-make/extern-fn-mangle/test.rs create mode 100644 tests/run-make/extern-fn-reachable/Makefile create mode 100644 tests/run-make/extern-fn-reachable/dylib.rs create mode 100644 tests/run-make/extern-fn-struct-passing-abi/Makefile create mode 100644 tests/run-make/extern-fn-struct-passing-abi/test.c create mode 100644 tests/run-make/extern-fn-struct-passing-abi/test.rs create mode 100644 tests/run-make/extern-fn-with-extern-types/Makefile create mode 100644 tests/run-make/extern-fn-with-extern-types/ctest.c create mode 100644 tests/run-make/extern-fn-with-extern-types/test.rs create mode 100644 tests/run-make/extern-fn-with-packed-struct/Makefile create mode 100644 tests/run-make/extern-fn-with-packed-struct/test.c create mode 100644 tests/run-make/extern-fn-with-packed-struct/test.rs create mode 100644 tests/run-make/extern-fn-with-union/Makefile create mode 100644 tests/run-make/extern-fn-with-union/ctest.c create mode 100644 tests/run-make/extern-fn-with-union/test.rs create mode 100644 tests/run-make/extern-fn-with-union/testcrate.rs create mode 100644 tests/run-make/extern-multiple-copies/Makefile create mode 100644 tests/run-make/extern-multiple-copies/bar.rs create mode 100644 tests/run-make/extern-multiple-copies/foo1.rs create mode 100644 tests/run-make/extern-multiple-copies/foo2.rs create mode 100644 tests/run-make/extern-multiple-copies2/Makefile create mode 100644 tests/run-make/extern-multiple-copies2/bar.rs create mode 100644 tests/run-make/extern-multiple-copies2/foo1.rs create mode 100644 tests/run-make/extern-multiple-copies2/foo2.rs create mode 100644 tests/run-make/extern-overrides-distribution/Makefile create mode 100644 tests/run-make/extern-overrides-distribution/libc.rs create mode 100644 tests/run-make/extern-overrides-distribution/main.rs create mode 100644 tests/run-make/extra-filename-with-temp-outputs/Makefile create mode 100644 tests/run-make/extra-filename-with-temp-outputs/foo.rs create mode 100644 tests/run-make/foreign-double-unwind/Makefile create mode 100644 tests/run-make/foreign-double-unwind/foo.cpp create mode 100644 tests/run-make/foreign-double-unwind/foo.rs create mode 100644 tests/run-make/foreign-exceptions/Makefile create mode 100644 tests/run-make/foreign-exceptions/foo.cpp create mode 100644 tests/run-make/foreign-exceptions/foo.rs create mode 100644 tests/run-make/foreign-rust-exceptions/Makefile create mode 100644 tests/run-make/foreign-rust-exceptions/bar.rs create mode 100644 tests/run-make/foreign-rust-exceptions/foo.rs create mode 100644 tests/run-make/fpic/Makefile create mode 100644 tests/run-make/fpic/hello.rs create mode 100644 tests/run-make/glibc-staticlib-args/Makefile create mode 100644 tests/run-make/glibc-staticlib-args/library.rs create mode 100644 tests/run-make/glibc-staticlib-args/program.c create mode 100644 tests/run-make/hir-tree/Makefile create mode 100644 tests/run-make/hir-tree/input.rs create mode 100644 tests/run-make/hotplug_codegen_backend/Makefile create mode 100644 tests/run-make/hotplug_codegen_backend/some_crate.rs create mode 100644 tests/run-make/hotplug_codegen_backend/the_backend.rs create mode 100644 tests/run-make/include_bytes_deps/Makefile create mode 100644 tests/run-make/include_bytes_deps/input.bin create mode 100644 tests/run-make/include_bytes_deps/input.md create mode 100644 tests/run-make/include_bytes_deps/input.txt create mode 100644 tests/run-make/include_bytes_deps/main.rs create mode 100644 tests/run-make/incr-add-rust-src-component/Makefile create mode 100644 tests/run-make/incr-add-rust-src-component/main.rs create mode 100644 tests/run-make/inline-always-many-cgu/Makefile create mode 100644 tests/run-make/inline-always-many-cgu/foo.rs create mode 100644 tests/run-make/interdependent-c-libraries/Makefile create mode 100644 tests/run-make/interdependent-c-libraries/bar.c create mode 100644 tests/run-make/interdependent-c-libraries/bar.rs create mode 100644 tests/run-make/interdependent-c-libraries/foo.c create mode 100644 tests/run-make/interdependent-c-libraries/foo.rs create mode 100644 tests/run-make/interdependent-c-libraries/main.rs create mode 100644 tests/run-make/intrinsic-unreachable/Makefile create mode 100644 tests/run-make/intrinsic-unreachable/exit-ret.rs create mode 100644 tests/run-make/intrinsic-unreachable/exit-unreachable.rs create mode 100644 tests/run-make/invalid-library/Makefile create mode 100644 tests/run-make/invalid-library/foo.rs create mode 100644 tests/run-make/invalid-staticlib/Makefile create mode 100644 tests/run-make/issue-11908/Makefile create mode 100644 tests/run-make/issue-11908/bar.rs create mode 100644 tests/run-make/issue-11908/foo.rs create mode 100644 tests/run-make/issue-14500/Makefile create mode 100644 tests/run-make/issue-14500/bar.rs create mode 100644 tests/run-make/issue-14500/foo.c create mode 100644 tests/run-make/issue-14500/foo.rs create mode 100644 tests/run-make/issue-14698/Makefile create mode 100644 tests/run-make/issue-14698/foo.rs create mode 100644 tests/run-make/issue-15460/Makefile create mode 100644 tests/run-make/issue-15460/bar.rs create mode 100644 tests/run-make/issue-15460/foo.c create mode 100644 tests/run-make/issue-15460/foo.rs create mode 100644 tests/run-make/issue-18943/Makefile create mode 100644 tests/run-make/issue-18943/foo.rs create mode 100644 tests/run-make/issue-20626/Makefile create mode 100644 tests/run-make/issue-20626/foo.rs create mode 100644 tests/run-make/issue-22131/Makefile create mode 100644 tests/run-make/issue-22131/foo.rs create mode 100644 tests/run-make/issue-24445/Makefile create mode 100644 tests/run-make/issue-24445/foo.c create mode 100644 tests/run-make/issue-24445/foo.rs create mode 100644 tests/run-make/issue-25581/Makefile create mode 100644 tests/run-make/issue-25581/test.c create mode 100644 tests/run-make/issue-25581/test.rs create mode 100644 tests/run-make/issue-26006/Makefile create mode 100644 tests/run-make/issue-26006/in/libc/lib.rs create mode 100644 tests/run-make/issue-26006/in/time/lib.rs create mode 100644 tests/run-make/issue-26092/Makefile create mode 100644 tests/run-make/issue-26092/blank.rs create mode 100644 tests/run-make/issue-28595/Makefile create mode 100644 tests/run-make/issue-28595/a.c create mode 100644 tests/run-make/issue-28595/a.rs create mode 100644 tests/run-make/issue-28595/b.c create mode 100644 tests/run-make/issue-28595/b.rs create mode 100644 tests/run-make/issue-28766/Makefile create mode 100644 tests/run-make/issue-28766/foo.rs create mode 100644 tests/run-make/issue-28766/main.rs create mode 100644 tests/run-make/issue-30063/Makefile create mode 100644 tests/run-make/issue-30063/foo.rs create mode 100644 tests/run-make/issue-33329/Makefile create mode 100644 tests/run-make/issue-33329/main.rs create mode 100644 tests/run-make/issue-35164/Makefile create mode 100644 tests/run-make/issue-35164/main.rs create mode 100644 tests/run-make/issue-35164/submodule/mod.rs create mode 100644 tests/run-make/issue-37839/Makefile create mode 100644 tests/run-make/issue-37839/a.rs create mode 100644 tests/run-make/issue-37839/b.rs create mode 100644 tests/run-make/issue-37839/c.rs create mode 100644 tests/run-make/issue-37893/Makefile create mode 100644 tests/run-make/issue-37893/a.rs create mode 100644 tests/run-make/issue-37893/b.rs create mode 100644 tests/run-make/issue-37893/c.rs create mode 100644 tests/run-make/issue-38237/Makefile create mode 100644 tests/run-make/issue-38237/bar.rs create mode 100644 tests/run-make/issue-38237/baz.rs create mode 100644 tests/run-make/issue-38237/foo.rs create mode 100644 tests/run-make/issue-40535/Makefile create mode 100644 tests/run-make/issue-40535/bar.rs create mode 100644 tests/run-make/issue-40535/baz.rs create mode 100644 tests/run-make/issue-40535/foo.rs create mode 100644 tests/run-make/issue-46239/Makefile create mode 100644 tests/run-make/issue-46239/main.rs create mode 100644 tests/run-make/issue-47551/Makefile create mode 100644 tests/run-make/issue-47551/eh_frame-terminator.rs create mode 100644 tests/run-make/issue-51671/Makefile create mode 100644 tests/run-make/issue-51671/app.rs create mode 100644 tests/run-make/issue-53964/Makefile create mode 100644 tests/run-make/issue-53964/app.rs create mode 100644 tests/run-make/issue-53964/panic.rs create mode 100644 tests/run-make/issue-64153/Makefile create mode 100644 tests/run-make/issue-64153/downstream.rs create mode 100644 tests/run-make/issue-64153/upstream.rs create mode 100644 tests/run-make/issue-68794-textrel-on-minimal-lib/Makefile create mode 100644 tests/run-make/issue-68794-textrel-on-minimal-lib/bar.c create mode 100644 tests/run-make/issue-68794-textrel-on-minimal-lib/foo.rs create mode 100644 tests/run-make/issue-69368/Makefile create mode 100644 tests/run-make/issue-69368/a.rs create mode 100644 tests/run-make/issue-69368/b.rs create mode 100644 tests/run-make/issue-69368/c.rs create mode 100644 tests/run-make/issue-7349/Makefile create mode 100644 tests/run-make/issue-7349/foo.rs create mode 100644 tests/run-make/issue-83045/Makefile create mode 100644 tests/run-make/issue-83045/a.rs create mode 100644 tests/run-make/issue-83045/b.rs create mode 100644 tests/run-make/issue-83045/c.rs create mode 100644 tests/run-make/issue-84395-lto-embed-bitcode/Makefile create mode 100644 tests/run-make/issue-84395-lto-embed-bitcode/test.rs create mode 100644 tests/run-make/issue-97463-abi-param-passing/Makefile create mode 100644 tests/run-make/issue-97463-abi-param-passing/bad.c create mode 100644 tests/run-make/issue-97463-abi-param-passing/param_passing.rs create mode 100644 tests/run-make/issue64319/Makefile create mode 100644 tests/run-make/issue64319/bar.rs create mode 100644 tests/run-make/issue64319/foo.rs create mode 100644 tests/run-make/libs-through-symlinks/Makefile create mode 100644 tests/run-make/libs-through-symlinks/bar.rs create mode 100644 tests/run-make/libs-through-symlinks/foo.rs create mode 100644 tests/run-make/libtest-json/Makefile create mode 100644 tests/run-make/libtest-json/f.rs create mode 100644 tests/run-make/libtest-json/output-default.json create mode 100644 tests/run-make/libtest-json/output-stdout-success.json create mode 100755 tests/run-make/libtest-json/validate_json.py create mode 100644 tests/run-make/link-arg/Makefile create mode 100644 tests/run-make/link-arg/empty.rs create mode 100644 tests/run-make/link-args-order/Makefile create mode 100644 tests/run-make/link-args-order/empty.rs create mode 100644 tests/run-make/link-cfg/Makefile create mode 100644 tests/run-make/link-cfg/dep-with-staticlib.rs create mode 100644 tests/run-make/link-cfg/dep.rs create mode 100644 tests/run-make/link-cfg/no-deps.rs create mode 100644 tests/run-make/link-cfg/return1.c create mode 100644 tests/run-make/link-cfg/return2.c create mode 100644 tests/run-make/link-cfg/return3.c create mode 100644 tests/run-make/link-cfg/with-deps.rs create mode 100644 tests/run-make/link-cfg/with-staticlib-deps.rs create mode 100644 tests/run-make/link-dedup/Makefile create mode 100644 tests/run-make/link-dedup/depa.rs create mode 100644 tests/run-make/link-dedup/depb.rs create mode 100644 tests/run-make/link-dedup/depc.rs create mode 100644 tests/run-make/link-dedup/empty.rs create mode 100644 tests/run-make/link-path-order/Makefile create mode 100644 tests/run-make/link-path-order/correct.c create mode 100644 tests/run-make/link-path-order/main.rs create mode 100644 tests/run-make/link-path-order/wrong.c create mode 100644 tests/run-make/linkage-attr-on-static/Makefile create mode 100644 tests/run-make/linkage-attr-on-static/bar.rs create mode 100644 tests/run-make/linkage-attr-on-static/foo.c create mode 100644 tests/run-make/long-linker-command-lines-cmd-exe/Makefile create mode 100644 tests/run-make/long-linker-command-lines-cmd-exe/foo.bat create mode 100644 tests/run-make/long-linker-command-lines-cmd-exe/foo.rs create mode 100644 tests/run-make/long-linker-command-lines/Makefile create mode 100644 tests/run-make/long-linker-command-lines/foo.rs create mode 100644 tests/run-make/longjmp-across-rust/Makefile create mode 100644 tests/run-make/longjmp-across-rust/foo.c create mode 100644 tests/run-make/longjmp-across-rust/main.rs create mode 100644 tests/run-make/ls-metadata/Makefile create mode 100644 tests/run-make/ls-metadata/foo.rs create mode 100644 tests/run-make/lto-dylib-dep/Makefile create mode 100644 tests/run-make/lto-dylib-dep/a_dylib.rs create mode 100644 tests/run-make/lto-dylib-dep/main.rs create mode 100644 tests/run-make/lto-empty/Makefile create mode 100644 tests/run-make/lto-empty/lib.rs create mode 100644 tests/run-make/lto-no-link-whole-rlib/Makefile create mode 100644 tests/run-make/lto-no-link-whole-rlib/bar.c create mode 100644 tests/run-make/lto-no-link-whole-rlib/foo.c create mode 100644 tests/run-make/lto-no-link-whole-rlib/lib1.rs create mode 100644 tests/run-make/lto-no-link-whole-rlib/lib2.rs create mode 100644 tests/run-make/lto-no-link-whole-rlib/main.rs create mode 100644 tests/run-make/lto-readonly-lib/Makefile create mode 100644 tests/run-make/lto-readonly-lib/lib.rs create mode 100644 tests/run-make/lto-readonly-lib/main.rs create mode 100644 tests/run-make/lto-smoke-c/Makefile create mode 100644 tests/run-make/lto-smoke-c/bar.c create mode 100644 tests/run-make/lto-smoke-c/foo.rs create mode 100644 tests/run-make/lto-smoke/Makefile create mode 100644 tests/run-make/lto-smoke/lib.rs create mode 100644 tests/run-make/lto-smoke/main.rs create mode 100644 tests/run-make/manual-crate-name/Makefile create mode 100644 tests/run-make/manual-crate-name/bar.rs create mode 100644 tests/run-make/manual-link/Makefile create mode 100644 tests/run-make/manual-link/bar.c create mode 100644 tests/run-make/manual-link/foo.c create mode 100644 tests/run-make/manual-link/foo.rs create mode 100644 tests/run-make/manual-link/main.rs create mode 100644 tests/run-make/many-crates-but-no-match/Makefile create mode 100644 tests/run-make/many-crates-but-no-match/crateA1.rs create mode 100644 tests/run-make/many-crates-but-no-match/crateA2.rs create mode 100644 tests/run-make/many-crates-but-no-match/crateA3.rs create mode 100644 tests/run-make/many-crates-but-no-match/crateB.rs create mode 100644 tests/run-make/many-crates-but-no-match/crateC.rs create mode 100644 tests/run-make/metadata-flag-frobs-symbols/Makefile create mode 100644 tests/run-make/metadata-flag-frobs-symbols/bar.rs create mode 100644 tests/run-make/metadata-flag-frobs-symbols/foo.rs create mode 100644 tests/run-make/min-global-align/Makefile create mode 100644 tests/run-make/min-global-align/min_global_align.rs create mode 100644 tests/run-make/mingw-export-call-convention/Makefile create mode 100644 tests/run-make/mingw-export-call-convention/foo.rs create mode 100644 tests/run-make/mismatching-target-triples/Makefile create mode 100644 tests/run-make/mismatching-target-triples/bar.rs create mode 100644 tests/run-make/mismatching-target-triples/foo.rs create mode 100644 tests/run-make/missing-crate-dependency/Makefile create mode 100644 tests/run-make/missing-crate-dependency/crateA.rs create mode 100644 tests/run-make/missing-crate-dependency/crateB.rs create mode 100644 tests/run-make/missing-crate-dependency/crateC.rs create mode 100644 tests/run-make/mixing-deps/Makefile create mode 100644 tests/run-make/mixing-deps/both.rs create mode 100644 tests/run-make/mixing-deps/dylib.rs create mode 100644 tests/run-make/mixing-deps/prog.rs create mode 100644 tests/run-make/mixing-formats/Makefile create mode 100644 tests/run-make/mixing-formats/bar1.rs create mode 100644 tests/run-make/mixing-formats/bar2.rs create mode 100644 tests/run-make/mixing-formats/baz.rs create mode 100644 tests/run-make/mixing-formats/baz2.rs create mode 100644 tests/run-make/mixing-formats/foo.rs create mode 100644 tests/run-make/mixing-libs/Makefile create mode 100644 tests/run-make/mixing-libs/dylib.rs create mode 100644 tests/run-make/mixing-libs/prog.rs create mode 100644 tests/run-make/mixing-libs/rlib.rs create mode 100644 tests/run-make/msvc-opt-minsize/Makefile create mode 100644 tests/run-make/msvc-opt-minsize/foo.rs create mode 100644 tests/run-make/multiple-emits/Makefile create mode 100644 tests/run-make/multiple-emits/foo.rs create mode 100644 tests/run-make/no-builtins-lto/Makefile create mode 100644 tests/run-make/no-builtins-lto/main.rs create mode 100644 tests/run-make/no-builtins-lto/no_builtins.rs create mode 100644 tests/run-make/no-duplicate-libs/Makefile create mode 100644 tests/run-make/no-duplicate-libs/bar.c create mode 100644 tests/run-make/no-duplicate-libs/foo.c create mode 100644 tests/run-make/no-duplicate-libs/main.rs create mode 100644 tests/run-make/no-intermediate-extras/Makefile create mode 100644 tests/run-make/no-intermediate-extras/foo.rs create mode 100644 tests/run-make/obey-crate-type-flag/Makefile create mode 100644 tests/run-make/obey-crate-type-flag/test.rs create mode 100644 tests/run-make/output-filename-conflicts-with-directory/Makefile create mode 100644 tests/run-make/output-filename-conflicts-with-directory/foo.rs create mode 100644 tests/run-make/output-filename-overwrites-input/Makefile create mode 100644 tests/run-make/output-filename-overwrites-input/bar.rs create mode 100644 tests/run-make/output-filename-overwrites-input/foo.rs create mode 100644 tests/run-make/output-type-permutations/Makefile create mode 100644 tests/run-make/output-type-permutations/foo.rs create mode 100644 tests/run-make/output-with-hyphens/Makefile create mode 100644 tests/run-make/output-with-hyphens/foo-bar.rs create mode 100644 tests/run-make/override-aliased-flags/Makefile create mode 100644 tests/run-make/override-aliased-flags/main.rs create mode 100644 tests/run-make/panic-impl-transitive/Makefile create mode 100644 tests/run-make/panic-impl-transitive/panic-impl-consumer.rs create mode 100644 tests/run-make/panic-impl-transitive/panic-impl-provider.rs create mode 100644 tests/run-make/pass-non-c-like-enum-to-c/Makefile create mode 100644 tests/run-make/pass-non-c-like-enum-to-c/nonclike.rs create mode 100644 tests/run-make/pass-non-c-like-enum-to-c/test.c create mode 100644 tests/run-make/pgo-branch-weights/Makefile create mode 100644 tests/run-make/pgo-branch-weights/filecheck-patterns.txt create mode 100644 tests/run-make/pgo-branch-weights/interesting.rs create mode 100644 tests/run-make/pgo-branch-weights/main.rs create mode 100644 tests/run-make/pgo-branch-weights/opaque.rs create mode 100644 tests/run-make/pgo-gen-lto/Makefile create mode 100644 tests/run-make/pgo-gen-lto/test.rs create mode 100644 tests/run-make/pgo-gen-no-imp-symbols/Makefile create mode 100644 tests/run-make/pgo-gen-no-imp-symbols/test.rs create mode 100644 tests/run-make/pgo-gen/Makefile create mode 100644 tests/run-make/pgo-gen/test.rs create mode 100644 tests/run-make/pgo-indirect-call-promotion/Makefile create mode 100644 tests/run-make/pgo-indirect-call-promotion/filecheck-patterns.txt create mode 100644 tests/run-make/pgo-indirect-call-promotion/interesting.rs create mode 100644 tests/run-make/pgo-indirect-call-promotion/main.rs create mode 100644 tests/run-make/pgo-indirect-call-promotion/opaque.rs create mode 100644 tests/run-make/pgo-use/Makefile create mode 100644 tests/run-make/pgo-use/filecheck-patterns.txt create mode 100644 tests/run-make/pgo-use/main.rs create mode 100644 tests/run-make/pointer-auth-link-with-c/Makefile create mode 100644 tests/run-make/pointer-auth-link-with-c/test.c create mode 100644 tests/run-make/pointer-auth-link-with-c/test.rs create mode 100644 tests/run-make/prefer-dylib/Makefile create mode 100644 tests/run-make/prefer-dylib/bar.rs create mode 100644 tests/run-make/prefer-dylib/foo.rs create mode 100644 tests/run-make/prefer-rlib/Makefile create mode 100644 tests/run-make/prefer-rlib/bar.rs create mode 100644 tests/run-make/prefer-rlib/foo.rs create mode 100644 tests/run-make/pretty-print-to-file/Makefile create mode 100644 tests/run-make/pretty-print-to-file/input.pp create mode 100644 tests/run-make/pretty-print-to-file/input.rs create mode 100644 tests/run-make/print-calling-conventions/Makefile create mode 100644 tests/run-make/print-cfg/Makefile create mode 100644 tests/run-make/print-target-list/Makefile create mode 100644 tests/run-make/profile/Makefile create mode 100644 tests/run-make/profile/test.rs create mode 100644 tests/run-make/prune-link-args/Makefile create mode 100644 tests/run-make/prune-link-args/empty.rs create mode 100644 tests/run-make/redundant-libs/Makefile create mode 100644 tests/run-make/redundant-libs/bar.c create mode 100644 tests/run-make/redundant-libs/baz.c create mode 100644 tests/run-make/redundant-libs/foo.c create mode 100644 tests/run-make/redundant-libs/main.rs create mode 100644 tests/run-make/relocation-model/Makefile create mode 100644 tests/run-make/relocation-model/foo.rs create mode 100644 tests/run-make/relro-levels/Makefile create mode 100644 tests/run-make/relro-levels/hello.rs create mode 100644 tests/run-make/remap-path-prefix/Makefile create mode 100644 tests/run-make/remap-path-prefix/auxiliary/lib.rs create mode 100644 tests/run-make/reproducible-build-2/Makefile create mode 100644 tests/run-make/reproducible-build-2/linker.rs create mode 100644 tests/run-make/reproducible-build-2/reproducible-build-aux.rs create mode 100644 tests/run-make/reproducible-build-2/reproducible-build.rs create mode 100644 tests/run-make/reproducible-build/Makefile create mode 100644 tests/run-make/reproducible-build/linker.rs create mode 100644 tests/run-make/reproducible-build/reproducible-build-aux.rs create mode 100644 tests/run-make/reproducible-build/reproducible-build.rs create mode 100644 tests/run-make/resolve-rename/Makefile create mode 100644 tests/run-make/resolve-rename/bar.rs create mode 100644 tests/run-make/resolve-rename/baz.rs create mode 100644 tests/run-make/resolve-rename/foo.rs create mode 100644 tests/run-make/return-non-c-like-enum-from-c/Makefile create mode 100644 tests/run-make/return-non-c-like-enum-from-c/nonclike.rs create mode 100644 tests/run-make/return-non-c-like-enum-from-c/test.c create mode 100644 tests/run-make/return-non-c-like-enum/Makefile create mode 100644 tests/run-make/return-non-c-like-enum/nonclike.rs create mode 100644 tests/run-make/return-non-c-like-enum/test.c create mode 100644 tests/run-make/rlib-chain/Makefile create mode 100644 tests/run-make/rlib-chain/m1.rs create mode 100644 tests/run-make/rlib-chain/m2.rs create mode 100644 tests/run-make/rlib-chain/m3.rs create mode 100644 tests/run-make/rlib-chain/m4.rs create mode 100644 tests/run-make/rustdoc-determinism/Makefile create mode 100644 tests/run-make/rustdoc-determinism/bar.rs create mode 100644 tests/run-make/rustdoc-determinism/foo.rs create mode 100644 tests/run-make/rustdoc-error-lines/Makefile create mode 100644 tests/run-make/rustdoc-error-lines/input.rs create mode 100644 tests/run-make/rustdoc-io-error/Makefile create mode 100644 tests/run-make/rustdoc-io-error/foo.rs create mode 100644 tests/run-make/rustdoc-map-file/Makefile create mode 100644 tests/run-make/rustdoc-map-file/expected.json create mode 100644 tests/run-make/rustdoc-map-file/foo.rs create mode 100755 tests/run-make/rustdoc-map-file/validate_json.py create mode 100644 tests/run-make/rustdoc-output-path/Makefile create mode 100644 tests/run-make/rustdoc-output-path/foo.rs create mode 100644 tests/run-make/rustdoc-scrape-examples-macros/Makefile create mode 100644 tests/run-make/rustdoc-scrape-examples-macros/examples/ex.rs create mode 100644 tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs create mode 100644 tests/run-make/rustdoc-scrape-examples-macros/src/proc.rs create mode 100644 tests/run-make/rustdoc-target-spec-json-path/Makefile create mode 100644 tests/run-make/rustdoc-target-spec-json-path/dummy_core.rs create mode 100644 tests/run-make/rustdoc-target-spec-json-path/my_crate.rs create mode 100644 tests/run-make/rustdoc-target-spec-json-path/target.json create mode 100644 tests/run-make/rustdoc-themes/Makefile create mode 100644 tests/run-make/rustdoc-themes/foo.rs create mode 100644 tests/run-make/sanitizer-cdylib-link/Makefile create mode 100644 tests/run-make/sanitizer-cdylib-link/library.rs create mode 100644 tests/run-make/sanitizer-cdylib-link/program.rs create mode 100644 tests/run-make/sanitizer-dylib-link/Makefile create mode 100644 tests/run-make/sanitizer-dylib-link/library.rs create mode 100644 tests/run-make/sanitizer-dylib-link/program.rs create mode 100644 tests/run-make/sanitizer-staticlib-link/Makefile create mode 100644 tests/run-make/sanitizer-staticlib-link/library.rs create mode 100644 tests/run-make/sanitizer-staticlib-link/program.c create mode 100644 tests/run-make/sanitizer-staticlib-link/program.rs create mode 100644 tests/run-make/separate-link-fail/Makefile create mode 100644 tests/run-make/separate-link/Makefile create mode 100644 tests/run-make/sepcomp-cci-copies/Makefile create mode 100644 tests/run-make/sepcomp-cci-copies/cci_lib.rs create mode 100644 tests/run-make/sepcomp-cci-copies/foo.rs create mode 100644 tests/run-make/sepcomp-inlining/Makefile create mode 100644 tests/run-make/sepcomp-inlining/foo.rs create mode 100644 tests/run-make/sepcomp-separate/Makefile create mode 100644 tests/run-make/sepcomp-separate/foo.rs create mode 100644 tests/run-make/share-generics-dylib/Makefile create mode 100644 tests/run-make/share-generics-dylib/instance_provider_a.rs create mode 100644 tests/run-make/share-generics-dylib/instance_provider_b.rs create mode 100644 tests/run-make/share-generics-dylib/instance_user_a_rlib.rs create mode 100644 tests/run-make/share-generics-dylib/instance_user_b_rlib.rs create mode 100644 tests/run-make/share-generics-dylib/instance_user_dylib.rs create mode 100644 tests/run-make/share-generics-dylib/linked_leaf.rs create mode 100644 tests/run-make/simd-ffi/Makefile create mode 100644 tests/run-make/simd-ffi/simd.rs create mode 100644 tests/run-make/simple-dylib/Makefile create mode 100644 tests/run-make/simple-dylib/bar.rs create mode 100644 tests/run-make/simple-dylib/foo.rs create mode 100644 tests/run-make/simple-rlib/Makefile create mode 100644 tests/run-make/simple-rlib/bar.rs create mode 100644 tests/run-make/simple-rlib/foo.rs create mode 100644 tests/run-make/split-debuginfo/Makefile create mode 100644 tests/run-make/split-debuginfo/bar.rs create mode 100644 tests/run-make/split-debuginfo/baz.rs create mode 100644 tests/run-make/split-debuginfo/foo.rs create mode 100644 tests/run-make/split-debuginfo/main.rs create mode 100644 tests/run-make/stable-symbol-names/Makefile create mode 100644 tests/run-make/stable-symbol-names/stable-symbol-names1.rs create mode 100644 tests/run-make/stable-symbol-names/stable-symbol-names2.rs create mode 100644 tests/run-make/static-dylib-by-default/Makefile create mode 100644 tests/run-make/static-dylib-by-default/bar.rs create mode 100644 tests/run-make/static-dylib-by-default/foo.rs create mode 100644 tests/run-make/static-dylib-by-default/main.c create mode 100644 tests/run-make/static-extern-type/Makefile create mode 100644 tests/run-make/static-extern-type/define-foo.c create mode 100644 tests/run-make/static-extern-type/use-foo.rs create mode 100644 tests/run-make/static-unwinding/Makefile create mode 100644 tests/run-make/static-unwinding/lib.rs create mode 100644 tests/run-make/static-unwinding/main.rs create mode 100644 tests/run-make/staticlib-blank-lib/Makefile create mode 100644 tests/run-make/staticlib-blank-lib/foo.rs create mode 100644 tests/run-make/std-core-cycle/Makefile create mode 100644 tests/run-make/std-core-cycle/bar.rs create mode 100644 tests/run-make/std-core-cycle/foo.rs create mode 100644 tests/run-make/stdin-non-utf8/Makefile create mode 100644 tests/run-make/stdin-non-utf8/non-utf8 create mode 100644 tests/run-make/suspicious-library/Makefile create mode 100644 tests/run-make/suspicious-library/bar.rs create mode 100644 tests/run-make/suspicious-library/foo.rs create mode 100644 tests/run-make/symbol-visibility/Makefile create mode 100644 tests/run-make/symbol-visibility/a_cdylib.rs create mode 100644 tests/run-make/symbol-visibility/a_proc_macro.rs create mode 100644 tests/run-make/symbol-visibility/a_rust_dylib.rs create mode 100644 tests/run-make/symbol-visibility/an_executable.rs create mode 100644 tests/run-make/symbol-visibility/an_rlib.rs create mode 100644 tests/run-make/symbols-include-type-name/Makefile create mode 100644 tests/run-make/symbols-include-type-name/lib.rs create mode 100644 tests/run-make/symlinked-extern/Makefile create mode 100644 tests/run-make/symlinked-extern/bar.rs create mode 100644 tests/run-make/symlinked-extern/baz.rs create mode 100644 tests/run-make/symlinked-extern/foo.rs create mode 100644 tests/run-make/symlinked-libraries/Makefile create mode 100644 tests/run-make/symlinked-libraries/bar.rs create mode 100644 tests/run-make/symlinked-libraries/foo.rs create mode 100644 tests/run-make/symlinked-rlib/Makefile create mode 100644 tests/run-make/symlinked-rlib/bar.rs create mode 100644 tests/run-make/symlinked-rlib/foo.rs create mode 100644 tests/run-make/sysroot-crates-are-unstable/Makefile create mode 100644 tests/run-make/sysroot-crates-are-unstable/test.py create mode 100644 tests/run-make/target-cpu-native/Makefile create mode 100644 tests/run-make/target-cpu-native/foo.rs create mode 100644 tests/run-make/target-specs/Makefile create mode 100644 tests/run-make/target-specs/definitely-not-builtin-target.json create mode 100644 tests/run-make/target-specs/foo.rs create mode 100644 tests/run-make/target-specs/mismatching-data-layout.json create mode 100644 tests/run-make/target-specs/my-awesome-platform.json create mode 100644 tests/run-make/target-specs/my-incomplete-platform.json create mode 100644 tests/run-make/target-specs/my-invalid-platform.json create mode 100644 tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json create mode 100644 tests/run-make/target-without-atomic-cas/Makefile create mode 100644 tests/run-make/test-harness/Makefile create mode 100644 tests/run-make/test-harness/test-ignore-cfg.rs create mode 100644 tests/run-make/type-mismatch-same-crate-name/Makefile create mode 100644 tests/run-make/type-mismatch-same-crate-name/crateA.rs create mode 100644 tests/run-make/type-mismatch-same-crate-name/crateB.rs create mode 100644 tests/run-make/type-mismatch-same-crate-name/crateC.rs create mode 100644 tests/run-make/use-extern-for-plugins/Makefile create mode 100644 tests/run-make/use-extern-for-plugins/bar.rs create mode 100644 tests/run-make/use-extern-for-plugins/baz.rs create mode 100644 tests/run-make/use-extern-for-plugins/foo.rs create mode 100644 tests/run-make/use-suggestions-rust-2018/Makefile create mode 100644 tests/run-make/use-suggestions-rust-2018/ep-nested-lib.rs create mode 100644 tests/run-make/use-suggestions-rust-2018/use-suggestions.rs create mode 100644 tests/run-make/used-cdylib-macos/Makefile create mode 100644 tests/run-make/used-cdylib-macos/dylib_used.rs create mode 100644 tests/run-make/used/Makefile create mode 100644 tests/run-make/used/used.rs create mode 100644 tests/run-make/version/Makefile create mode 100644 tests/run-make/volatile-intrinsics/Makefile create mode 100644 tests/run-make/volatile-intrinsics/main.rs create mode 100644 tests/run-make/weird-output-filenames/Makefile create mode 100644 tests/run-make/weird-output-filenames/foo.rs create mode 100644 tests/run-make/windows-binary-no-external-deps/Makefile create mode 100644 tests/run-make/windows-binary-no-external-deps/hello.rs create mode 100644 tests/run-make/windows-spawn/Makefile create mode 100644 tests/run-make/windows-spawn/hello.rs create mode 100644 tests/run-make/windows-spawn/spawn.rs create mode 100644 tests/run-make/windows-subsystem/Makefile create mode 100644 tests/run-make/windows-subsystem/console.rs create mode 100644 tests/run-make/windows-subsystem/windows.rs (limited to 'tests') diff --git a/tests/run-make-fulldeps/a-b-a-linker-guard/Makefile b/tests/run-make-fulldeps/a-b-a-linker-guard/Makefile deleted file mode 100644 index adc9e3d0916..00000000000 --- a/tests/run-make-fulldeps/a-b-a-linker-guard/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../tools.mk - -# Test that if we build `b` against a version of `a` that has one set -# of types, it will not run with a dylib that has a different set of -# types. - -# NOTE(eddyb) this test only works with the `legacy` mangling, -# and will probably get removed once `legacy` is gone. - -all: - $(RUSTC) a.rs --cfg x -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy - $(RUSTC) b.rs -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy - $(call RUN,b) - $(RUSTC) a.rs --cfg y -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy - $(call FAIL,b) diff --git a/tests/run-make-fulldeps/a-b-a-linker-guard/a.rs b/tests/run-make-fulldeps/a-b-a-linker-guard/a.rs deleted file mode 100644 index aa07b1e7160..00000000000 --- a/tests/run-make-fulldeps/a-b-a-linker-guard/a.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_name = "a"] -#![crate_type = "dylib"] - -#[cfg(x)] -pub fn foo(x: u32) { } - -#[cfg(y)] -pub fn foo(x: i32) { } diff --git a/tests/run-make-fulldeps/a-b-a-linker-guard/b.rs b/tests/run-make-fulldeps/a-b-a-linker-guard/b.rs deleted file mode 100644 index f30df120a3b..00000000000 --- a/tests/run-make-fulldeps/a-b-a-linker-guard/b.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_name = "b"] - -extern crate a; - -fn main() { - a::foo(22_u32); -} diff --git a/tests/run-make-fulldeps/alloc-no-oom-handling/Makefile b/tests/run-make-fulldeps/alloc-no-oom-handling/Makefile deleted file mode 100644 index 87f74c69c79..00000000000 --- a/tests/run-make-fulldeps/alloc-no-oom-handling/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_global_oom_handling diff --git a/tests/run-make-fulldeps/alloc-no-rc/Makefile b/tests/run-make-fulldeps/alloc-no-rc/Makefile deleted file mode 100644 index 9824b17e6c2..00000000000 --- a/tests/run-make-fulldeps/alloc-no-rc/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_rc diff --git a/tests/run-make-fulldeps/alloc-no-sync/Makefile b/tests/run-make-fulldeps/alloc-no-sync/Makefile deleted file mode 100644 index 04ec4c7d8bc..00000000000 --- a/tests/run-make-fulldeps/alloc-no-sync/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_sync diff --git a/tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/Makefile b/tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/Makefile deleted file mode 100644 index 60d9c7c3745..00000000000 --- a/tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# Test that -A warnings makes the 'empty trait list for derive' warning go away -OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" ) - -all: foo - test -z '$(OUT)' - -# This is just to make sure the above command actually succeeds -foo: - $(RUSTC) foo.rs -A warnings diff --git a/tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/foo.rs b/tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/foo.rs deleted file mode 100644 index 46e72da2de9..00000000000 --- a/tests/run-make-fulldeps/allow-non-lint-warnings-cmdline/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[derive()] -#[derive(Copy, Clone)] -pub struct Foo; - -pub fn main() { } diff --git a/tests/run-make-fulldeps/allow-warnings-cmdline-stability/Makefile b/tests/run-make-fulldeps/allow-warnings-cmdline-stability/Makefile deleted file mode 100644 index 1ce8d0ec284..00000000000 --- a/tests/run-make-fulldeps/allow-warnings-cmdline-stability/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../tools.mk - -# Test that -A warnings makes the 'empty trait list for derive' warning go away -DEP=$(shell $(RUSTC) bar.rs) -OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" ) - -all: foo bar - test -z '$(OUT)' - -# These are just to ensure that the above commands actually work -bar: - $(RUSTC) bar.rs - -foo: bar - $(RUSTC) foo.rs -A warnings diff --git a/tests/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs b/tests/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs deleted file mode 100644 index 3dcfb9dadd8..00000000000 --- a/tests/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type = "lib"] -#![feature(staged_api)] -#![unstable(feature = "unstable_test_feature", issue = "none")] - -pub fn baz() {} diff --git a/tests/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs b/tests/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs deleted file mode 100644 index 869b5435416..00000000000 --- a/tests/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![feature(unstable_test_feature)] - -extern crate bar; - -pub fn main() { bar::baz() } diff --git a/tests/run-make-fulldeps/archive-duplicate-names/Makefile b/tests/run-make-fulldeps/archive-duplicate-names/Makefile deleted file mode 100644 index bbdcd2a34fe..00000000000 --- a/tests/run-make-fulldeps/archive-duplicate-names/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -all: - mkdir $(TMPDIR)/a - mkdir $(TMPDIR)/b - $(call COMPILE_OBJ,$(TMPDIR)/a/foo.o,foo.c) - $(call COMPILE_OBJ,$(TMPDIR)/b/foo.o,bar.c) - $(AR) crus $(TMPDIR)/libfoo.a $(TMPDIR)/a/foo.o $(TMPDIR)/b/foo.o - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(call RUN,bar) diff --git a/tests/run-make-fulldeps/archive-duplicate-names/bar.c b/tests/run-make-fulldeps/archive-duplicate-names/bar.c deleted file mode 100644 index e4259998678..00000000000 --- a/tests/run-make-fulldeps/archive-duplicate-names/bar.c +++ /dev/null @@ -1 +0,0 @@ -void bar() {} diff --git a/tests/run-make-fulldeps/archive-duplicate-names/bar.rs b/tests/run-make-fulldeps/archive-duplicate-names/bar.rs deleted file mode 100644 index 994a98c2cd8..00000000000 --- a/tests/run-make-fulldeps/archive-duplicate-names/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::baz(); -} diff --git a/tests/run-make-fulldeps/archive-duplicate-names/foo.c b/tests/run-make-fulldeps/archive-duplicate-names/foo.c deleted file mode 100644 index 85e6cd8c390..00000000000 --- a/tests/run-make-fulldeps/archive-duplicate-names/foo.c +++ /dev/null @@ -1 +0,0 @@ -void foo() {} diff --git a/tests/run-make-fulldeps/archive-duplicate-names/foo.rs b/tests/run-make-fulldeps/archive-duplicate-names/foo.rs deleted file mode 100644 index 0bf13c406ab..00000000000 --- a/tests/run-make-fulldeps/archive-duplicate-names/foo.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "foo", kind = "static")] -extern "C" { - fn foo(); - fn bar(); -} - -pub fn baz() { - unsafe { - foo(); - bar(); - } -} diff --git a/tests/run-make-fulldeps/arguments-non-c-like-enum/Makefile b/tests/run-make-fulldeps/arguments-non-c-like-enum/Makefile deleted file mode 100644 index 513311c8289..00000000000 --- a/tests/run-make-fulldeps/arguments-non-c-like-enum/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --crate-type=staticlib nonclike.rs - $(CC) test.c $(call STATICLIB,nonclike) $(call OUT_EXE,test) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(call RUN,test) diff --git a/tests/run-make-fulldeps/arguments-non-c-like-enum/nonclike.rs b/tests/run-make-fulldeps/arguments-non-c-like-enum/nonclike.rs deleted file mode 100644 index 57c2c6127ed..00000000000 --- a/tests/run-make-fulldeps/arguments-non-c-like-enum/nonclike.rs +++ /dev/null @@ -1,31 +0,0 @@ -#[repr(C, u8)] -pub enum TT { - AA(u64, u64), - BB, -} - -#[no_mangle] -pub extern "C" fn tt_add(a: TT, b: TT) -> u64 { - match (a, b) { - (TT::AA(a1, b1), TT::AA(a2, b2)) => a1 + a2 + b1 + b2, - (TT::AA(a1, b1), TT::BB) => a1 + b1, - (TT::BB, TT::AA(a1, b1)) => a1 + b1, - _ => 0, - } -} - -#[repr(C, u8)] -pub enum T { - A(u64), - B, -} - -#[no_mangle] -pub extern "C" fn t_add(a: T, b: T) -> u64 { - match (a, b) { - (T::A(a), T::A(b)) => a + b, - (T::A(a), T::B) => a, - (T::B, T::A(b)) => b, - _ => 0, - } -} diff --git a/tests/run-make-fulldeps/arguments-non-c-like-enum/test.c b/tests/run-make-fulldeps/arguments-non-c-like-enum/test.c deleted file mode 100644 index 0a1621e49f2..00000000000 --- a/tests/run-make-fulldeps/arguments-non-c-like-enum/test.c +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include - -#include - -/* This is the code generated by cbindgen 0.12.1 for the `enum TT` - * type in nonclike.rs . */ -enum TT_Tag { - AA, - BB, -}; -typedef uint8_t TT_Tag; - -typedef struct { - uint64_t _0; - uint64_t _1; -} AA_Body; - -typedef struct { - TT_Tag tag; - union { - AA_Body aa; - }; -} TT; - -/* This is the code generated by cbindgen 0.12.1 for the `enum T` type - * in nonclike.rs . */ -enum T_Tag { - A, - B, -}; -typedef uint8_t T_Tag; - -typedef struct { - uint64_t _0; -} A_Body; - -typedef struct { - T_Tag tag; - union { - A_Body a; - }; -} T; - -/* These symbols are defined by the Rust staticlib built from - * nonclike.rs. */ -extern uint64_t t_add(T a, T b); -extern uint64_t tt_add(TT a, TT b); - -int main(int argc, char *argv[]) { - (void)argc; (void)argv; - - /* This example works. */ - TT xx = { .tag = AA, .aa = { ._0 = 1, ._1 = 2 } }; - TT yy = { .tag = AA, .aa = { ._0 = 10, ._1 = 20 } }; - uint64_t rr = tt_add(xx, yy); - assert(33 == rr); - - /* This one used to return an incorrect result (see issue #68190). */ - T x = { .tag = A, .a = { ._0 = 1 } }; - T y = { .tag = A, .a = { ._0 = 10 } }; - uint64_t r = t_add(x, y); - assert(11 == r); - - return 0; -} diff --git a/tests/run-make-fulldeps/atomic-lock-free/Makefile b/tests/run-make-fulldeps/atomic-lock-free/Makefile deleted file mode 100644 index 37e59624a25..00000000000 --- a/tests/run-make-fulldeps/atomic-lock-free/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -include ../tools.mk - -# This tests ensure that atomic types are never lowered into runtime library calls that are not -# guaranteed to be lock-free. - -all: -ifeq ($(UNAME),Linux) -ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) - $(RUSTC) --target=i686-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=x86_64-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add -endif -ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm) - $(RUSTC) --target=arm-unknown-linux-gnueabi atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=arm-unknown-linux-gnueabihf atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=armv7-unknown-linux-gnueabihf atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=thumbv7neon-unknown-linux-gnueabihf atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add -endif -ifeq ($(filter aarch64,$(LLVM_COMPONENTS)),aarch64) - $(RUSTC) --target=aarch64-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add -endif -ifeq ($(filter mips,$(LLVM_COMPONENTS)),mips) - $(RUSTC) --target=mips-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=mipsel-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add -endif -ifeq ($(filter powerpc,$(LLVM_COMPONENTS)),powerpc) - $(RUSTC) --target=powerpc-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=powerpc-unknown-linux-gnuspe atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=powerpc64-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add - $(RUSTC) --target=powerpc64le-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add -endif -ifeq ($(filter systemz,$(LLVM_COMPONENTS)),systemz) - $(RUSTC) --target=s390x-unknown-linux-gnu atomic_lock_free.rs - nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add -endif -endif diff --git a/tests/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs b/tests/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs deleted file mode 100644 index 47d90b1856b..00000000000 --- a/tests/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs +++ /dev/null @@ -1,66 +0,0 @@ -#![feature(no_core, intrinsics, lang_items)] -#![crate_type="rlib"] -#![no_core] - -extern "rust-intrinsic" { - fn atomic_xadd_seqcst(dst: *mut T, src: T) -> T; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -#[lang = "freeze"] -trait Freeze {} - -impl Copy for *mut T {} - -#[cfg(target_has_atomic = "8")] -pub unsafe fn atomic_u8(x: *mut u8) { - atomic_xadd_seqcst(x, 1); - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "8")] -pub unsafe fn atomic_i8(x: *mut i8) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "16")] -pub unsafe fn atomic_u16(x: *mut u16) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "16")] -pub unsafe fn atomic_i16(x: *mut i16) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "32")] -pub unsafe fn atomic_u32(x: *mut u32) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "32")] -pub unsafe fn atomic_i32(x: *mut i32) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "64")] -pub unsafe fn atomic_u64(x: *mut u64) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "64")] -pub unsafe fn atomic_i64(x: *mut i64) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "128")] -pub unsafe fn atomic_u128(x: *mut u128) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "128")] -pub unsafe fn atomic_i128(x: *mut i128) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "ptr")] -pub unsafe fn atomic_usize(x: *mut usize) { - atomic_xadd_seqcst(x, 1); -} -#[cfg(target_has_atomic = "ptr")] -pub unsafe fn atomic_isize(x: *mut isize) { - atomic_xadd_seqcst(x, 1); -} diff --git a/tests/run-make-fulldeps/bare-outfile/Makefile b/tests/run-make-fulldeps/bare-outfile/Makefile deleted file mode 100644 index 858466e942b..00000000000 --- a/tests/run-make-fulldeps/bare-outfile/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - cp foo.rs $(TMPDIR) - cd $(TMPDIR) && $(RUSTC) -o foo foo.rs - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/bare-outfile/foo.rs b/tests/run-make-fulldeps/bare-outfile/foo.rs deleted file mode 100644 index f79c691f085..00000000000 --- a/tests/run-make-fulldeps/bare-outfile/foo.rs +++ /dev/null @@ -1,2 +0,0 @@ -fn main() { -} diff --git a/tests/run-make-fulldeps/c-dynamic-dylib/Makefile b/tests/run-make-fulldeps/c-dynamic-dylib/Makefile deleted file mode 100644 index ac68778922d..00000000000 --- a/tests/run-make-fulldeps/c-dynamic-dylib/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -# ignore-macos -# -# This hits an assertion in the linker on older versions of osx apparently - -all: $(call DYLIB,cfoo) - $(RUSTC) foo.rs -C prefer-dynamic - $(RUSTC) bar.rs - $(call RUN,bar) - $(call REMOVE_DYLIBS,cfoo) - $(call FAIL,bar) diff --git a/tests/run-make-fulldeps/c-dynamic-dylib/bar.rs b/tests/run-make-fulldeps/c-dynamic-dylib/bar.rs deleted file mode 100644 index b8c798ffdb4..00000000000 --- a/tests/run-make-fulldeps/c-dynamic-dylib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::rsfoo(); -} diff --git a/tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c b/tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c deleted file mode 100644 index fea490cf9b4..00000000000 --- a/tests/run-make-fulldeps/c-dynamic-dylib/cfoo.c +++ /dev/null @@ -1,4 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int foo() { return 0; } diff --git a/tests/run-make-fulldeps/c-dynamic-dylib/foo.rs b/tests/run-make-fulldeps/c-dynamic-dylib/foo.rs deleted file mode 100644 index 9f7a9e2213c..00000000000 --- a/tests/run-make-fulldeps/c-dynamic-dylib/foo.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "dylib"] - -#[link(name = "cfoo")] -extern "C" { - fn foo(); -} - -pub fn rsfoo() { - unsafe { foo() } -} diff --git a/tests/run-make-fulldeps/c-dynamic-rlib/Makefile b/tests/run-make-fulldeps/c-dynamic-rlib/Makefile deleted file mode 100644 index c65d648b929..00000000000 --- a/tests/run-make-fulldeps/c-dynamic-rlib/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../tools.mk - -# ignore-macos -# -# This hits an assertion in the linker on older versions of osx apparently - -# This overrides the LD_LIBRARY_PATH for RUN -TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR) - -all: $(call DYLIB,cfoo) - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(call RUN,bar) - $(call REMOVE_DYLIBS,cfoo) - $(call FAIL,bar) diff --git a/tests/run-make-fulldeps/c-dynamic-rlib/bar.rs b/tests/run-make-fulldeps/c-dynamic-rlib/bar.rs deleted file mode 100644 index b8c798ffdb4..00000000000 --- a/tests/run-make-fulldeps/c-dynamic-rlib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::rsfoo(); -} diff --git a/tests/run-make-fulldeps/c-dynamic-rlib/cfoo.c b/tests/run-make-fulldeps/c-dynamic-rlib/cfoo.c deleted file mode 100644 index fea490cf9b4..00000000000 --- a/tests/run-make-fulldeps/c-dynamic-rlib/cfoo.c +++ /dev/null @@ -1,4 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int foo() { return 0; } diff --git a/tests/run-make-fulldeps/c-dynamic-rlib/foo.rs b/tests/run-make-fulldeps/c-dynamic-rlib/foo.rs deleted file mode 100644 index 3dd376f1ff5..00000000000 --- a/tests/run-make-fulldeps/c-dynamic-rlib/foo.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "cfoo")] -extern "C" { - fn foo(); -} - -pub fn rsfoo() { - unsafe { foo() } -} diff --git a/tests/run-make-fulldeps/c-link-to-rust-dylib/Makefile b/tests/run-make-fulldeps/c-link-to-rust-dylib/Makefile deleted file mode 100644 index 2a371b54541..00000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-dylib/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -include ../tools.mk - -all: $(TMPDIR)/$(call BIN,bar) - $(call RUN,bar) - $(call REMOVE_DYLIBS,foo) - $(call FAIL,bar) - -ifdef IS_MSVC -$(TMPDIR)/$(call BIN,bar): $(call DYLIB,foo) - $(CC) bar.c $(TMPDIR)/foo.dll.lib $(call OUT_EXE,bar) -else -$(TMPDIR)/$(call BIN,bar): $(call DYLIB,foo) - $(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) -L $(TMPDIR) -endif - -$(call DYLIB,foo): foo.rs - $(RUSTC) foo.rs diff --git a/tests/run-make-fulldeps/c-link-to-rust-dylib/bar.c b/tests/run-make-fulldeps/c-link-to-rust-dylib/bar.c deleted file mode 100644 index bb4036b06e1..00000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-dylib/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo(); - -int main() { - foo(); - return 0; -} diff --git a/tests/run-make-fulldeps/c-link-to-rust-dylib/foo.rs b/tests/run-make-fulldeps/c-link-to-rust-dylib/foo.rs deleted file mode 100644 index f197fa51334..00000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-dylib/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "dylib"] - -#[no_mangle] -pub extern "C" fn foo() {} diff --git a/tests/run-make-fulldeps/c-link-to-rust-staticlib/Makefile b/tests/run-make-fulldeps/c-link-to-rust-staticlib/Makefile deleted file mode 100644 index d38bcef309a..00000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-staticlib/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -# ignore-freebsd -# FIXME - -all: - $(RUSTC) foo.rs - $(CC) bar.c $(call STATICLIB,foo) $(call OUT_EXE,bar) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(call RUN,bar) - rm $(call STATICLIB,foo) - $(call RUN,bar) diff --git a/tests/run-make-fulldeps/c-link-to-rust-staticlib/bar.c b/tests/run-make-fulldeps/c-link-to-rust-staticlib/bar.c deleted file mode 100644 index bb4036b06e1..00000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-staticlib/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo(); - -int main() { - foo(); - return 0; -} diff --git a/tests/run-make-fulldeps/c-link-to-rust-staticlib/foo.rs b/tests/run-make-fulldeps/c-link-to-rust-staticlib/foo.rs deleted file mode 100644 index 2e59432cdb1..00000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-staticlib/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "staticlib"] - -#[no_mangle] -pub extern "C" fn foo() {} diff --git a/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile b/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile deleted file mode 100644 index 9ce2a34e677..00000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) checkrust.rs - $(CC) test.c $(call STATICLIB,checkrust) $(call OUT_EXE,test) $(EXTRACFLAGS) - $(call RUN,test) diff --git a/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs b/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs deleted file mode 100644 index 5830ef033d3..00000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs +++ /dev/null @@ -1,148 +0,0 @@ -#![crate_type = "staticlib"] -#![feature(c_variadic)] -#![feature(rustc_private)] - -extern crate libc; - -use libc::{c_char, c_double, c_int, c_long, c_longlong}; -use std::ffi::VaList; -use std::ffi::{CString, CStr}; - -macro_rules! continue_if { - ($cond:expr) => { - if !($cond) { - return 0xff; - } - } -} - -unsafe fn compare_c_str(ptr: *const c_char, val: &str) -> bool { - let cstr0 = CStr::from_ptr(ptr); - match CString::new(val) { - Ok(cstr1) => &*cstr1 == cstr0, - Err(_) => false, - } -} - -#[no_mangle] -pub unsafe extern "C" fn check_list_0(mut ap: VaList) -> usize { - continue_if!(ap.arg::() == 1); - continue_if!(ap.arg::() == 2); - continue_if!(ap.arg::() == 3); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_list_1(mut ap: VaList) -> usize { - continue_if!(ap.arg::() == -1); - continue_if!(ap.arg::() == 'A' as c_char); - continue_if!(ap.arg::() == '4' as c_char); - continue_if!(ap.arg::() == ';' as c_char); - continue_if!(ap.arg::() == 0x32); - continue_if!(ap.arg::() == 0x10000001); - continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Valid!")); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_list_2(mut ap: VaList) -> usize { - continue_if!(ap.arg::().floor() == 3.14f64.floor()); - continue_if!(ap.arg::() == 12); - continue_if!(ap.arg::() == 'a' as c_char); - continue_if!(ap.arg::().floor() == 6.18f64.floor()); - continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello")); - continue_if!(ap.arg::() == 42); - continue_if!(compare_c_str(ap.arg::<*const c_char>(), "World")); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_list_copy_0(mut ap: VaList) -> usize { - continue_if!(ap.arg::().floor() == 6.28f64.floor()); - continue_if!(ap.arg::() == 16); - continue_if!(ap.arg::() == 'A' as c_char); - continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Skip Me!")); - ap.with_copy(|mut ap| { - if compare_c_str(ap.arg::<*const c_char>(), "Correct") { - 0 - } else { - 0xff - } - }) -} - -#[no_mangle] -pub unsafe extern "C" fn check_varargs_0(_: c_int, mut ap: ...) -> usize { - continue_if!(ap.arg::() == 42); - continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello, World!")); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_varargs_1(_: c_int, mut ap: ...) -> usize { - continue_if!(ap.arg::().floor() == 3.14f64.floor()); - continue_if!(ap.arg::() == 12); - continue_if!(ap.arg::() == 'A' as c_char); - continue_if!(ap.arg::() == 1); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_varargs_2(_: c_int, _ap: ...) -> usize { - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_varargs_3(_: c_int, mut ap: ...) -> usize { - continue_if!(ap.arg::() == 1); - continue_if!(ap.arg::() == 2); - continue_if!(ap.arg::() == 3); - continue_if!(ap.arg::() == 4); - continue_if!(ap.arg::() == 5); - continue_if!(ap.arg::() == 6); - continue_if!(ap.arg::() == 7); - continue_if!(ap.arg::() == 8); - continue_if!(ap.arg::() == 9); - continue_if!(ap.arg::() == 10); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_varargs_4(_: c_double, mut ap: ...) -> usize { - continue_if!(ap.arg::() == 1.0); - continue_if!(ap.arg::() == 2.0); - continue_if!(ap.arg::() == 3.0); - continue_if!(ap.arg::() == 4.0); - continue_if!(ap.arg::() == 5.0); - continue_if!(ap.arg::() == 6.0); - continue_if!(ap.arg::() == 7.0); - continue_if!(ap.arg::() == 8.0); - continue_if!(ap.arg::() == 9.0); - continue_if!(ap.arg::() == 10.0); - 0 -} - -#[no_mangle] -pub unsafe extern "C" fn check_varargs_5(_: c_int, mut ap: ...) -> usize { - continue_if!(ap.arg::() == 1.0); - continue_if!(ap.arg::() == 1); - continue_if!(ap.arg::() == 2.0); - continue_if!(ap.arg::() == 2); - continue_if!(ap.arg::() == 3.0); - continue_if!(ap.arg::() == 3); - continue_if!(ap.arg::() == 4.0); - continue_if!(ap.arg::() == 4); - continue_if!(ap.arg::() == 5); - continue_if!(ap.arg::() == 5.0); - continue_if!(ap.arg::() == 6); - continue_if!(ap.arg::() == 6.0); - continue_if!(ap.arg::() == 7); - continue_if!(ap.arg::() == 7.0); - continue_if!(ap.arg::() == 8); - continue_if!(ap.arg::() == 8.0); - continue_if!(ap.arg::() == 9); - continue_if!(ap.arg::() == 9.0); - continue_if!(ap.arg::() == 10); - continue_if!(ap.arg::() == 10.0); - 0 -} diff --git a/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c b/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c deleted file mode 100644 index 5bdb51680a6..00000000000 --- a/tests/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c +++ /dev/null @@ -1,50 +0,0 @@ -#include -#include -#include -#include -#include - -extern size_t check_list_0(va_list ap); -extern size_t check_list_1(va_list ap); -extern size_t check_list_2(va_list ap); -extern size_t check_list_copy_0(va_list ap); -extern size_t check_varargs_0(int fixed, ...); -extern size_t check_varargs_1(int fixed, ...); -extern size_t check_varargs_2(int fixed, ...); -extern size_t check_varargs_3(int fixed, ...); -extern size_t check_varargs_4(double fixed, ...); -extern size_t check_varargs_5(int fixed, ...); - -int test_rust(size_t (*fn)(va_list), ...) { - size_t ret = 0; - va_list ap; - va_start(ap, fn); - ret = fn(ap); - va_end(ap); - return ret; -} - -int main(int argc, char* argv[]) { - assert(test_rust(check_list_0, 0x01LL, 0x02, 0x03LL) == 0); - - assert(test_rust(check_list_1, -1, 'A', '4', ';', 0x32, 0x10000001, "Valid!") == 0); - - assert(test_rust(check_list_2, 3.14, 12l, 'a', 6.28, "Hello", 42, "World") == 0); - - assert(test_rust(check_list_copy_0, 6.28, 16, 'A', "Skip Me!", "Correct") == 0); - - assert(check_varargs_0(0, 42, "Hello, World!") == 0); - - assert(check_varargs_1(0, 3.14, 12l, 'A', 0x1LL) == 0); - - assert(check_varargs_2(0, "All", "of", "these", "are", "ignored", ".") == 0); - - assert(check_varargs_3(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) == 0); - - assert(check_varargs_4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0) == 0); - - assert(check_varargs_5(0, 1.0, 1, 2.0, 2, 3.0, 3, 4.0, 4, 5, 5.0, 6, 6.0, 7, 7.0, 8, 8.0, - 9, 9.0, 10, 10.0) == 0); - - return 0; -} diff --git a/tests/run-make-fulldeps/c-static-dylib/Makefile b/tests/run-make-fulldeps/c-static-dylib/Makefile deleted file mode 100644 index 5b78005e3ee..00000000000 --- a/tests/run-make-fulldeps/c-static-dylib/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,cfoo) - $(RUSTC) foo.rs -C prefer-dynamic - $(RUSTC) bar.rs - rm $(call NATIVE_STATICLIB,cfoo) - $(call RUN,bar) - $(call REMOVE_DYLIBS,foo) - $(call FAIL,bar) diff --git a/tests/run-make-fulldeps/c-static-dylib/bar.rs b/tests/run-make-fulldeps/c-static-dylib/bar.rs deleted file mode 100644 index b8c798ffdb4..00000000000 --- a/tests/run-make-fulldeps/c-static-dylib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::rsfoo(); -} diff --git a/tests/run-make-fulldeps/c-static-dylib/cfoo.c b/tests/run-make-fulldeps/c-static-dylib/cfoo.c deleted file mode 100644 index 9fe07f82f9e..00000000000 --- a/tests/run-make-fulldeps/c-static-dylib/cfoo.c +++ /dev/null @@ -1 +0,0 @@ -int foo() { return 0; } diff --git a/tests/run-make-fulldeps/c-static-dylib/foo.rs b/tests/run-make-fulldeps/c-static-dylib/foo.rs deleted file mode 100644 index 1e8af4d4404..00000000000 --- a/tests/run-make-fulldeps/c-static-dylib/foo.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "dylib"] - -#[link(name = "cfoo", kind = "static")] -extern "C" { - fn foo(); -} - -pub fn rsfoo() { - unsafe { foo() } -} diff --git a/tests/run-make-fulldeps/c-static-rlib/Makefile b/tests/run-make-fulldeps/c-static-rlib/Makefile deleted file mode 100644 index 11a3cf1940c..00000000000 --- a/tests/run-make-fulldeps/c-static-rlib/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,cfoo) - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(call REMOVE_RLIBS,foo) - rm $(call NATIVE_STATICLIB,cfoo) - $(call RUN,bar) diff --git a/tests/run-make-fulldeps/c-static-rlib/bar.rs b/tests/run-make-fulldeps/c-static-rlib/bar.rs deleted file mode 100644 index b8c798ffdb4..00000000000 --- a/tests/run-make-fulldeps/c-static-rlib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::rsfoo(); -} diff --git a/tests/run-make-fulldeps/c-static-rlib/cfoo.c b/tests/run-make-fulldeps/c-static-rlib/cfoo.c deleted file mode 100644 index 9fe07f82f9e..00000000000 --- a/tests/run-make-fulldeps/c-static-rlib/cfoo.c +++ /dev/null @@ -1 +0,0 @@ -int foo() { return 0; } diff --git a/tests/run-make-fulldeps/c-static-rlib/foo.rs b/tests/run-make-fulldeps/c-static-rlib/foo.rs deleted file mode 100644 index 9c6d2080ef4..00000000000 --- a/tests/run-make-fulldeps/c-static-rlib/foo.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "cfoo", kind = "static")] -extern "C" { - fn foo(); -} - -pub fn rsfoo() { - unsafe { foo() } -} diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/Makefile b/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/Makefile deleted file mode 100644 index 134f000d453..00000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -include ../tools.mk - -all: archive - # Compile `main.rs`, which will link into our library, and run it. - $(RUSTC) main.rs - $(call RUN,main) - -ifdef IS_MSVC -archive: add.o panic.o - # Now, create an archive using these two objects. - $(AR) crus $(TMPDIR)/add.lib $(TMPDIR)/add.o $(TMPDIR)/panic.o -else -archive: add.o panic.o - # Now, create an archive using these two objects. - $(AR) crus $(TMPDIR)/libadd.a $(TMPDIR)/add.o $(TMPDIR)/panic.o -endif - -# Compile `panic.rs` into an object file. -# -# Note that we invoke `rustc` directly, so we may emit an object rather -# than an archive. We'll do that later. -panic.o: - $(BARE_RUSTC) $(RUSTFLAGS) \ - --out-dir $(TMPDIR) \ - --emit=obj panic.rs - -# Compile `add.c` into an object file. -add.o: - $(call COMPILE_OBJ,$(TMPDIR)/add.o,add.c) - diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/add.c b/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/add.c deleted file mode 100644 index 444359451f6..00000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/add.c +++ /dev/null @@ -1,12 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif - -// An external function, defined in Rust. -extern void panic_if_greater_than_10(unsigned x); - -unsigned add_small_numbers(unsigned a, unsigned b) { - unsigned c = a + b; - panic_if_greater_than_10(c); - return c; -} diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/main.rs b/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/main.rs deleted file mode 100644 index 78a71219c78..00000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/main.rs +++ /dev/null @@ -1,35 +0,0 @@ -//! A test for calling `C-unwind` functions across foreign function boundaries. -//! -//! This test triggers a panic in a Rust library that our foreign function invokes. This shows -//! that we can unwind through the C code in that library, and catch the underlying panic. -#![feature(c_unwind)] - -use std::panic::{catch_unwind, AssertUnwindSafe}; - -fn main() { - // Call `add_small_numbers`, passing arguments that will NOT trigger a panic. - let (a, b) = (9, 1); - let c = unsafe { add_small_numbers(a, b) }; - assert_eq!(c, 10); - - // Call `add_small_numbers`, passing arguments that will trigger a panic, and catch it. - let caught_unwind = catch_unwind(AssertUnwindSafe(|| { - let (a, b) = (10, 1); - let _c = unsafe { add_small_numbers(a, b) }; - unreachable!("should have unwound instead of returned"); - })); - - // Assert that we did indeed panic, then unwrap and downcast the panic into the sum. - assert!(caught_unwind.is_err()); - let panic_obj = caught_unwind.unwrap_err(); - let msg = panic_obj.downcast_ref::().unwrap(); - assert_eq!(msg, "11"); -} - -#[link(name = "add", kind = "static")] -extern "C-unwind" { - /// An external function, defined in C. - /// - /// Returns the sum of two numbers, or panics if the sum is greater than 10. - fn add_small_numbers(a: u32, b: u32) -> u32; -} diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs b/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs deleted file mode 100644 index a99a04d5c6f..00000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-lib-panic/panic.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type = "staticlib"] -#![feature(c_unwind)] - -/// This function will panic if `x` is greater than 10. -/// -/// This function is called by `add_small_numbers`. -#[no_mangle] -pub extern "C-unwind" fn panic_if_greater_than_10(x: u32) { - if x > 10 { - panic!("{}", x); // That is too big! - } -} diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-panic/Makefile b/tests/run-make-fulldeps/c-unwind-abi-catch-panic/Makefile deleted file mode 100644 index e93ec99da2a..00000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-panic/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,add) - $(RUSTC) main.rs - $(call RUN,main) || exit 1 diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-panic/add.c b/tests/run-make-fulldeps/c-unwind-abi-catch-panic/add.c deleted file mode 100644 index 444359451f6..00000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-panic/add.c +++ /dev/null @@ -1,12 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif - -// An external function, defined in Rust. -extern void panic_if_greater_than_10(unsigned x); - -unsigned add_small_numbers(unsigned a, unsigned b) { - unsigned c = a + b; - panic_if_greater_than_10(c); - return c; -} diff --git a/tests/run-make-fulldeps/c-unwind-abi-catch-panic/main.rs b/tests/run-make-fulldeps/c-unwind-abi-catch-panic/main.rs deleted file mode 100644 index 15d38d72160..00000000000 --- a/tests/run-make-fulldeps/c-unwind-abi-catch-panic/main.rs +++ /dev/null @@ -1,44 +0,0 @@ -//! A test for calling `C-unwind` functions across foreign function boundaries. -//! -//! This test triggers a panic when calling a foreign function that calls *back* into Rust. -#![feature(c_unwind)] - -use std::panic::{catch_unwind, AssertUnwindSafe}; - -fn main() { - // Call `add_small_numbers`, passing arguments that will NOT trigger a panic. - let (a, b) = (9, 1); - let c = unsafe { add_small_numbers(a, b) }; - assert_eq!(c, 10); - - // Call `add_small_numbers`, passing arguments that will trigger a panic, and catch it. - let caught_unwind = catch_unwind(AssertUnwindSafe(|| { - let (a, b) = (10, 1); - let _c = unsafe { add_small_numbers(a, b) }; - unreachable!("should have unwound instead of returned"); - })); - - // Assert that we did indeed panic, then unwrap and downcast the panic into the sum. - assert!(caught_unwind.is_err()); - let panic_obj = caught_unwind.unwrap_err(); - let msg = panic_obj.downcast_ref::().unwrap(); - assert_eq!(msg, "11"); -} - -#[link(name = "add", kind = "static")] -extern "C-unwind" { - /// An external function, defined in C. - /// - /// Returns the sum of two numbers, or panics if the sum is greater than 10. - fn add_small_numbers(a: u32, b: u32) -> u32; -} - -/// This function will panic if `x` is greater than 10. -/// -/// This function is called by `add_small_numbers`. -#[no_mangle] -pub extern "C-unwind" fn panic_if_greater_than_10(x: u32) { - if x > 10 { - panic!("{}", x); // That is too big! - } -} diff --git a/tests/run-make-fulldeps/cat-and-grep-sanity-check/Makefile b/tests/run-make-fulldeps/cat-and-grep-sanity-check/Makefile deleted file mode 100644 index 82351e22009..00000000000 --- a/tests/run-make-fulldeps/cat-and-grep-sanity-check/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -include ../tools.mk - -all: - echo a | $(CGREP) a - ! echo b | $(CGREP) a - echo xyz | $(CGREP) x y z - ! echo abc | $(CGREP) b c d - printf "x\ny\nz" | $(CGREP) x y z - - echo AbCd | $(CGREP) -i a b C D - ! echo AbCd | $(CGREP) a b C D - - true | $(CGREP) -v nothing - ! echo nothing | $(CGREP) -v nothing - ! echo xyz | $(CGREP) -v w x y - ! echo xyz | $(CGREP) -v x y z - echo xyz | $(CGREP) -v a b c - - ! echo 'foo bar baz' | $(CGREP) 'foo baz' - echo 'foo bar baz' | $(CGREP) foo baz - echo 'x a `b` c y z' | $(CGREP) 'a `b` c' - - echo baaac | $(CGREP) -e 'ba*c' - echo bc | $(CGREP) -e 'ba*c' - ! echo aaac | $(CGREP) -e 'ba*c' - - echo aaa | $(CGREP) -e 'a+' - ! echo bbb | $(CGREP) -e 'a+' - - echo abc | $(CGREP) -e 'a|e|i|o|u' - ! echo fgh | $(CGREP) -e 'a|e|i|o|u' - echo abc | $(CGREP) -e '[aeiou]' - ! echo fgh | $(CGREP) -e '[aeiou]' - ! echo abc | $(CGREP) -e '[^aeiou]{3}' - echo fgh | $(CGREP) -e '[^aeiou]{3}' - echo ab cd ef gh | $(CGREP) -e '\bcd\b' - ! echo abcdefgh | $(CGREP) -e '\bcd\b' - echo xyz | $(CGREP) -e '...' - ! echo xy | $(CGREP) -e '...' - ! echo xyz | $(CGREP) -e '\.\.\.' - echo ... | $(CGREP) -e '\.\.\.' - - echo foo bar baz | $(CGREP) -e 'foo.*baz' - ! echo foo bar baz | $(CGREP) -ve 'foo.*baz' - ! echo foo bar baz | $(CGREP) -e 'baz.*foo' - echo foo bar baz | $(CGREP) -ve 'baz.*foo' diff --git a/tests/run-make-fulldeps/cdylib-dylib-linkage/Makefile b/tests/run-make-fulldeps/cdylib-dylib-linkage/Makefile deleted file mode 100644 index 5c9b2d1bb2f..00000000000 --- a/tests/run-make-fulldeps/cdylib-dylib-linkage/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -include ../tools.mk - -TARGET_SYSROOT := $(shell $(RUSTC) --print sysroot)/lib/rustlib/$(TARGET)/lib - -ifdef IS_MSVC -LIBSTD := $(wildcard $(TARGET_SYSROOT)/libstd-*.dll.lib) -else -LIBSTD := $(wildcard $(TARGET_SYSROOT)/$(call DYLIB_GLOB,std)) -STD := $(basename $(patsubst lib%,%, $(notdir $(LIBSTD)))) -endif - -all: $(call RUN_BINFILE,foo) - $(call RUN,foo) - -ifdef IS_MSVC -CLIBS := $(TMPDIR)/foo.dll.lib $(TMPDIR)/bar.dll.lib $(LIBSTD) -$(call RUN_BINFILE,foo): $(call DYLIB,foo) - $(CC) $(CFLAGS) foo.c $(CLIBS) $(call OUT_EXE,foo) -else -CLIBS := -lfoo -lbar -l$(STD) -L $(TMPDIR) -L $(TARGET_SYSROOT) -$(call RUN_BINFILE,foo): $(call DYLIB,foo) - $(CC) $(CFLAGS) foo.c $(CLIBS) -o $(call RUN_BINFILE,foo) -endif - -$(call DYLIB,foo): - $(RUSTC) -C prefer-dynamic bar.rs - $(RUSTC) foo.rs diff --git a/tests/run-make-fulldeps/cdylib-dylib-linkage/bar.rs b/tests/run-make-fulldeps/cdylib-dylib-linkage/bar.rs deleted file mode 100644 index b3a7539abae..00000000000 --- a/tests/run-make-fulldeps/cdylib-dylib-linkage/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type = "dylib"] - -pub fn bar() { - println!("hello!"); -} diff --git a/tests/run-make-fulldeps/cdylib-dylib-linkage/foo.c b/tests/run-make-fulldeps/cdylib-dylib-linkage/foo.c deleted file mode 100644 index 154f9682ef8..00000000000 --- a/tests/run-make-fulldeps/cdylib-dylib-linkage/foo.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern void foo(); -extern unsigned bar(unsigned a, unsigned b); - -int main() { - foo(); - assert(bar(1, 2) == 3); - return 0; -} diff --git a/tests/run-make-fulldeps/cdylib-dylib-linkage/foo.rs b/tests/run-make-fulldeps/cdylib-dylib-linkage/foo.rs deleted file mode 100644 index c4069495aaf..00000000000 --- a/tests/run-make-fulldeps/cdylib-dylib-linkage/foo.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![crate_type = "cdylib"] - -extern crate bar; - -#[no_mangle] -pub extern "C" fn foo() { - bar::bar(); -} - -#[no_mangle] -pub extern "C" fn bar(a: u32, b: u32) -> u32 { - a + b -} diff --git a/tests/run-make-fulldeps/cdylib-fewer-symbols/Makefile b/tests/run-make-fulldeps/cdylib-fewer-symbols/Makefile deleted file mode 100644 index 324791af8de..00000000000 --- a/tests/run-make-fulldeps/cdylib-fewer-symbols/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# Test that allocator-related symbols don't show up as exported from a cdylib as -# they're internal to Rust and not part of the public ABI. - -include ../tools.mk - -# ignore-windows -# FIXME: The __rdl_ and __rust_ symbol still remains, no matter using MSVC or GNU -# See https://github.com/rust-lang/rust/pull/46207#issuecomment-347561753 - -all: - $(RUSTC) foo.rs - nm -g "$(call DYLIB,foo)" | $(CGREP) -v __rdl_ __rde_ __rg_ __rust_ diff --git a/tests/run-make-fulldeps/cdylib-fewer-symbols/foo.rs b/tests/run-make-fulldeps/cdylib-fewer-symbols/foo.rs deleted file mode 100644 index af37bc8e953..00000000000 --- a/tests/run-make-fulldeps/cdylib-fewer-symbols/foo.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "cdylib"] - -#[no_mangle] -pub extern "C" fn foo() -> u32 { - 3 -} diff --git a/tests/run-make-fulldeps/cdylib/Makefile b/tests/run-make-fulldeps/cdylib/Makefile deleted file mode 100644 index 47ec762b3e9..00000000000 --- a/tests/run-make-fulldeps/cdylib/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../tools.mk - -all: $(call RUN_BINFILE,foo) - $(call RUN,foo) - rm $(call DYLIB,foo) - $(RUSTC) foo.rs -C lto - $(call RUN,foo) - -ifdef IS_MSVC -$(call RUN_BINFILE,foo): $(call DYLIB,foo) - $(CC) $(CFLAGS) foo.c $(TMPDIR)/foo.dll.lib $(call OUT_EXE,foo) -else -$(call RUN_BINFILE,foo): $(call DYLIB,foo) - $(CC) $(CFLAGS) foo.c -lfoo -o $(call RUN_BINFILE,foo) -L $(TMPDIR) -endif - -$(call DYLIB,foo): - $(RUSTC) bar.rs - $(RUSTC) foo.rs diff --git a/tests/run-make-fulldeps/cdylib/bar.rs b/tests/run-make-fulldeps/cdylib/bar.rs deleted file mode 100644 index fe665abc7c1..00000000000 --- a/tests/run-make-fulldeps/cdylib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type = "rlib"] - -pub fn bar() { - println!("hello!"); -} diff --git a/tests/run-make-fulldeps/cdylib/foo.c b/tests/run-make-fulldeps/cdylib/foo.c deleted file mode 100644 index 154f9682ef8..00000000000 --- a/tests/run-make-fulldeps/cdylib/foo.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern void foo(); -extern unsigned bar(unsigned a, unsigned b); - -int main() { - foo(); - assert(bar(1, 2) == 3); - return 0; -} diff --git a/tests/run-make-fulldeps/cdylib/foo.rs b/tests/run-make-fulldeps/cdylib/foo.rs deleted file mode 100644 index c4069495aaf..00000000000 --- a/tests/run-make-fulldeps/cdylib/foo.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![crate_type = "cdylib"] - -extern crate bar; - -#[no_mangle] -pub extern "C" fn foo() { - bar::bar(); -} - -#[no_mangle] -pub extern "C" fn bar(a: u32, b: u32) -> u32 { - a + b -} diff --git a/tests/run-make-fulldeps/codegen-options-parsing/Makefile b/tests/run-make-fulldeps/codegen-options-parsing/Makefile deleted file mode 100644 index b063593c9d9..00000000000 --- a/tests/run-make-fulldeps/codegen-options-parsing/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -include ../tools.mk - -all: - #Option taking a number - $(RUSTC) -C codegen-units dummy.rs 2>&1 | \ - $(CGREP) 'codegen option `codegen-units` requires a number' - $(RUSTC) -C codegen-units= dummy.rs 2>&1 | \ - $(CGREP) 'incorrect value `` for codegen option `codegen-units` - a number was expected' - $(RUSTC) -C codegen-units=foo dummy.rs 2>&1 | \ - $(CGREP) 'incorrect value `foo` for codegen option `codegen-units` - a number was expected' - $(RUSTC) -C codegen-units=1 dummy.rs - #Option taking a string - $(RUSTC) -C extra-filename dummy.rs 2>&1 | \ - $(CGREP) 'codegen option `extra-filename` requires a string' - $(RUSTC) -C extra-filename= dummy.rs 2>&1 - $(RUSTC) -C extra-filename=foo dummy.rs 2>&1 - #Option taking no argument - $(RUSTC) -C lto= dummy.rs 2>&1 | \ - $(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted' - $(RUSTC) -C lto=1 dummy.rs 2>&1 | \ - $(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted' - $(RUSTC) -C lto=foo dummy.rs 2>&1 | \ - $(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted' - $(RUSTC) -C lto dummy.rs - - # Should not link dead code... - $(RUSTC) --print link-args dummy.rs 2>&1 | \ - $(CGREP) -e '--gc-sections|-z[^ ]* [^ ]*|-dead_strip|/OPT:REF' - # ... unless you specifically ask to keep it - $(RUSTC) --print link-args -C link-dead-code dummy.rs 2>&1 | \ - $(CGREP) -ve '--gc-sections|-z[^ ]* [^ ]*|-dead_strip|/OPT:REF' diff --git a/tests/run-make-fulldeps/codegen-options-parsing/dummy.rs b/tests/run-make-fulldeps/codegen-options-parsing/dummy.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/codegen-options-parsing/dummy.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/compile-stdin/Makefile b/tests/run-make-fulldeps/compile-stdin/Makefile deleted file mode 100644 index be15548690f..00000000000 --- a/tests/run-make-fulldeps/compile-stdin/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - echo 'fn main(){}' | $(RUSTC) - - $(call RUN,rust_out) diff --git a/tests/run-make-fulldeps/compiler-lookup-paths-2/Makefile b/tests/run-make-fulldeps/compiler-lookup-paths-2/Makefile deleted file mode 100644 index d4ff7d8daab..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths-2/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - mkdir -p $(TMPDIR)/a $(TMPDIR)/b - $(RUSTC) a.rs && mv $(TMPDIR)/liba.rlib $(TMPDIR)/a - $(RUSTC) b.rs -L $(TMPDIR)/a && mv $(TMPDIR)/libb.rlib $(TMPDIR)/b - $(RUSTC) c.rs -L crate=$(TMPDIR)/b -L dependency=$(TMPDIR)/a \ - && exit 1 || exit 0 diff --git a/tests/run-make-fulldeps/compiler-lookup-paths-2/a.rs b/tests/run-make-fulldeps/compiler-lookup-paths-2/a.rs deleted file mode 100644 index 83be6e807e0..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths-2/a.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "lib"] diff --git a/tests/run-make-fulldeps/compiler-lookup-paths-2/b.rs b/tests/run-make-fulldeps/compiler-lookup-paths-2/b.rs deleted file mode 100644 index 1be6cbc919d..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths-2/b.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -extern crate a; diff --git a/tests/run-make-fulldeps/compiler-lookup-paths-2/c.rs b/tests/run-make-fulldeps/compiler-lookup-paths-2/c.rs deleted file mode 100644 index e37bc2e1dce..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths-2/c.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "lib"] -extern crate b; -extern crate a; diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/Makefile b/tests/run-make-fulldeps/compiler-lookup-paths/Makefile deleted file mode 100644 index c16bf7af6c4..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -include ../tools.mk - -all: $(TMPDIR)/libnative.a - mkdir -p $(TMPDIR)/crate - mkdir -p $(TMPDIR)/native - mv $(TMPDIR)/libnative.a $(TMPDIR)/native - $(RUSTC) a.rs - mv $(TMPDIR)/liba.rlib $(TMPDIR)/crate - $(RUSTC) b.rs -L native=$(TMPDIR)/crate && exit 1 || exit 0 - $(RUSTC) b.rs -L dependency=$(TMPDIR)/crate && exit 1 || exit 0 - $(RUSTC) b.rs -L crate=$(TMPDIR)/crate - $(RUSTC) b.rs -L all=$(TMPDIR)/crate - $(RUSTC) c.rs -L native=$(TMPDIR)/crate && exit 1 || exit 0 - $(RUSTC) c.rs -L crate=$(TMPDIR)/crate && exit 1 || exit 0 - $(RUSTC) c.rs -L dependency=$(TMPDIR)/crate - $(RUSTC) c.rs -L all=$(TMPDIR)/crate - $(RUSTC) d.rs -L dependency=$(TMPDIR)/native && exit 1 || exit 0 - $(RUSTC) d.rs -L crate=$(TMPDIR)/native && exit 1 || exit 0 - $(RUSTC) d.rs -L native=$(TMPDIR)/native - $(RUSTC) d.rs -L all=$(TMPDIR)/native - # Deduplication tests: - # Same hash, no errors. - mkdir -p $(TMPDIR)/e1 - mkdir -p $(TMPDIR)/e2 - $(RUSTC) e.rs -o $(TMPDIR)/e1/libe.rlib - $(RUSTC) e.rs -o $(TMPDIR)/e2/libe.rlib - $(RUSTC) f.rs -L $(TMPDIR)/e1 -L $(TMPDIR)/e2 - $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L $(TMPDIR)/e2 - $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 - # Different hash, errors. - $(RUSTC) e2.rs -o $(TMPDIR)/e2/libe.rlib - $(RUSTC) f.rs -L $(TMPDIR)/e1 -L $(TMPDIR)/e2 && exit 1 || exit 0 - $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L $(TMPDIR)/e2 && exit 1 || exit 0 - $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 && exit 1 || exit 0 - # Native/dependency paths don't cause errors. - $(RUSTC) f.rs -L native=$(TMPDIR)/e1 -L $(TMPDIR)/e2 - $(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L $(TMPDIR)/e2 - $(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/a.rs b/tests/run-make-fulldeps/compiler-lookup-paths/a.rs deleted file mode 100644 index 83be6e807e0..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/a.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "lib"] diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/b.rs b/tests/run-make-fulldeps/compiler-lookup-paths/b.rs deleted file mode 100644 index 1be6cbc919d..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/b.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -extern crate a; diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/c.rs b/tests/run-make-fulldeps/compiler-lookup-paths/c.rs deleted file mode 100644 index 4c7ce01b6a0..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/c.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -extern crate b; diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/d.rs b/tests/run-make-fulldeps/compiler-lookup-paths/d.rs deleted file mode 100644 index 6cd9916b6f6..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/d.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "native", kind = "static")] -extern "C" {} diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/e.rs b/tests/run-make-fulldeps/compiler-lookup-paths/e.rs deleted file mode 100644 index 18eb60aca97..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/e.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_name = "e"] -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/e2.rs b/tests/run-make-fulldeps/compiler-lookup-paths/e2.rs deleted file mode 100644 index cbf08b98e7e..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/e2.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_name = "e"] -#![crate_type = "rlib"] - -pub fn f() {} diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/f.rs b/tests/run-make-fulldeps/compiler-lookup-paths/f.rs deleted file mode 100644 index 483deaaea49..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/f.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "rlib"] -extern crate e; diff --git a/tests/run-make-fulldeps/compiler-lookup-paths/native.c b/tests/run-make-fulldeps/compiler-lookup-paths/native.c deleted file mode 100644 index d11c69f812a..00000000000 --- a/tests/run-make-fulldeps/compiler-lookup-paths/native.c +++ /dev/null @@ -1 +0,0 @@ -// intentionally empty diff --git a/tests/run-make-fulldeps/compiler-rt-works-on-mingw/Makefile b/tests/run-make-fulldeps/compiler-rt-works-on-mingw/Makefile deleted file mode 100644 index 74917570a01..00000000000 --- a/tests/run-make-fulldeps/compiler-rt-works-on-mingw/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# only-windows-gnu - -all: - $(CXX) foo.cpp -c -o $(TMPDIR)/foo.o - $(AR) crus $(TMPDIR)/libfoo.a $(TMPDIR)/foo.o - $(RUSTC) foo.rs -lfoo -lstdc++ - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.cpp b/tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.cpp deleted file mode 100644 index 4c2fb9cdb87..00000000000 --- a/tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.cpp +++ /dev/null @@ -1,4 +0,0 @@ -extern "C" void foo() { - int *a = new int(3); - delete a; -} diff --git a/tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs b/tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs deleted file mode 100644 index 7fdb8158871..00000000000 --- a/tests/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs +++ /dev/null @@ -1,10 +0,0 @@ -extern "C" { - fn foo(); -} - -pub fn main() { - unsafe { - foo(); - } - assert_eq!(7f32.powi(3), 343f32); -} diff --git a/tests/run-make-fulldeps/core-no-fp-fmt-parse/Makefile b/tests/run-make-fulldeps/core-no-fp-fmt-parse/Makefile deleted file mode 100644 index 837664d92b9..00000000000 --- a/tests/run-make-fulldeps/core-no-fp-fmt-parse/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/core/src/lib.rs --cfg no_fp_fmt_parse diff --git a/tests/run-make-fulldeps/crate-data-smoke/Makefile b/tests/run-make-fulldeps/crate-data-smoke/Makefile deleted file mode 100644 index a453f65ff3e..00000000000 --- a/tests/run-make-fulldeps/crate-data-smoke/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -all: - [ `$(RUSTC) --print crate-name crate.rs` = "foo" ] - [ `$(RUSTC) --print file-names crate.rs` = "$(call BIN,foo)" ] - [ `$(RUSTC) --print file-names --crate-type=lib \ - --test crate.rs` = "$(call BIN,foo)" ] - [ `$(RUSTC) --print file-names --test lib.rs` = "$(call BIN,mylib)" ] - $(RUSTC) --print file-names lib.rs - $(RUSTC) --print file-names rlib.rs diff --git a/tests/run-make-fulldeps/crate-data-smoke/crate.rs b/tests/run-make-fulldeps/crate-data-smoke/crate.rs deleted file mode 100644 index a48a6f51c42..00000000000 --- a/tests/run-make-fulldeps/crate-data-smoke/crate.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_name = "foo"] - -// Querying about the crate metadata should *not* parse the entire crate, it -// only needs the crate attributes (which are guaranteed to be at the top) be -// sure that if we have an error like a missing module that we can still query -// about the crate id. -mod error; diff --git a/tests/run-make-fulldeps/crate-data-smoke/lib.rs b/tests/run-make-fulldeps/crate-data-smoke/lib.rs deleted file mode 100644 index 8002f11ec87..00000000000 --- a/tests/run-make-fulldeps/crate-data-smoke/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_name = "mylib"] -#![crate_type = "lib"] diff --git a/tests/run-make-fulldeps/crate-data-smoke/rlib.rs b/tests/run-make-fulldeps/crate-data-smoke/rlib.rs deleted file mode 100644 index 47fcce4a7f6..00000000000 --- a/tests/run-make-fulldeps/crate-data-smoke/rlib.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_name = "mylib"] -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/crate-hash-rustc-version/Makefile b/tests/run-make-fulldeps/crate-hash-rustc-version/Makefile deleted file mode 100644 index 4f25a865ebd..00000000000 --- a/tests/run-make-fulldeps/crate-hash-rustc-version/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -include ../../run-make-fulldeps/tools.mk - -# Ensure that crates compiled with different rustc versions cannot -# be dynamically linked. - -FLAGS := -Cprefer-dynamic -Zsymbol-mangling-version=v0 -UNAME := $(shell uname) -ifeq ($(UNAME),Linux) - EXT=".so" - NM_CMD := nm -D -endif -ifeq ($(UNAME),Darwin) - EXT=".dylib" - NM_CMD := nm -endif - -ifndef NM_CMD -all: - exit 0 -else -all: - # a.rs is a dylib - $(RUSTC) a.rs --crate-type=dylib $(FLAGS) - # Write symbols to disk. - $(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsbefore - # b.rs is a binary - $(RUSTC) b.rs --extern a=$(TMPDIR)/liba$(EXT) --crate-type=bin -Crpath $(FLAGS) - $(call RUN,b) - # Now re-compile a.rs with another rustc version - RUSTC_FORCE_RUSTC_VERSION=deadfeed $(RUSTC) a.rs --crate-type=dylib $(FLAGS) - # After compiling with a different rustc version, write symbols to disk again. - $(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsafter - # As a sanity check, test if the symbols changed: - # If the symbols are identical, there's been an error. - if diff $(TMPDIR)/symbolsbefore $(TMPDIR)/symbolsafter; then exit 1; fi - $(call FAIL,b) -endif diff --git a/tests/run-make-fulldeps/crate-hash-rustc-version/a.rs b/tests/run-make-fulldeps/crate-hash-rustc-version/a.rs deleted file mode 100644 index d65b5ce8e88..00000000000 --- a/tests/run-make-fulldeps/crate-hash-rustc-version/a.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub fn foo(mut x: String) -> String { - x.push_str(", world!"); - x -} diff --git a/tests/run-make-fulldeps/crate-hash-rustc-version/b.rs b/tests/run-make-fulldeps/crate-hash-rustc-version/b.rs deleted file mode 100644 index 316ac26e73f..00000000000 --- a/tests/run-make-fulldeps/crate-hash-rustc-version/b.rs +++ /dev/null @@ -1,8 +0,0 @@ -extern crate a; - -use a::foo; - -fn main() { - let x = String::from("Hello"); - println!("{}", foo(x)); -} diff --git a/tests/run-make-fulldeps/crate-name-priority/Makefile b/tests/run-make-fulldeps/crate-name-priority/Makefile deleted file mode 100644 index 08a07c325e3..00000000000 --- a/tests/run-make-fulldeps/crate-name-priority/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --crate-name bar - rm $(TMPDIR)/$(call BIN,bar) - $(RUSTC) foo1.rs - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo1.rs -o $(TMPDIR)/$(call BIN,bar1) - rm $(TMPDIR)/$(call BIN,bar1) diff --git a/tests/run-make-fulldeps/crate-name-priority/foo.rs b/tests/run-make-fulldeps/crate-name-priority/foo.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/crate-name-priority/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/crate-name-priority/foo1.rs b/tests/run-make-fulldeps/crate-name-priority/foo1.rs deleted file mode 100644 index 4ff3bd9516b..00000000000 --- a/tests/run-make-fulldeps/crate-name-priority/foo1.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_name = "foo"] - -fn main() {} diff --git a/tests/run-make-fulldeps/cross-lang-lto-clang/Makefile b/tests/run-make-fulldeps/cross-lang-lto-clang/Makefile deleted file mode 100644 index acaebf439d6..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-clang/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# needs-matching-clang - -# This test makes sure that cross-language inlining actually works by checking -# the generated machine code. - -include ../tools.mk - -all: cpp-executable rust-executable - -cpp-executable: - $(RUSTC) -Clinker-plugin-lto=on -o $(TMPDIR)/librustlib-xlto.a -Copt-level=2 -Ccodegen-units=1 ./rustlib.rs - $(CLANG) -flto=thin -fuse-ld=lld -L $(TMPDIR) -lrustlib-xlto -o $(TMPDIR)/cmain ./cmain.c -O3 - # Make sure we don't find a call instruction to the function we expect to - # always be inlined. - "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -v -e "call.*rust_always_inlined" - # As a sanity check, make sure we do find a call instruction to a - # non-inlined function - "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -e "call.*rust_never_inlined" - -rust-executable: - $(CLANG) ./clib.c -flto=thin -c -o $(TMPDIR)/clib.o -O2 - (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) - $(RUSTC) -Clinker-plugin-lto=on -L$(TMPDIR) -Copt-level=2 -Clinker=$(CLANG) -Clink-arg=-fuse-ld=lld ./main.rs -o $(TMPDIR)/rsmain - "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -e "call.*c_never_inlined" - "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -v -e "call.*c_always_inlined" diff --git a/tests/run-make-fulldeps/cross-lang-lto-clang/clib.c b/tests/run-make-fulldeps/cross-lang-lto-clang/clib.c deleted file mode 100644 index 90f33f24dc4..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-clang/clib.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -uint32_t c_always_inlined() { - return 1234; -} - -__attribute__((noinline)) uint32_t c_never_inlined() { - return 12345; -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-clang/cmain.c b/tests/run-make-fulldeps/cross-lang-lto-clang/cmain.c deleted file mode 100644 index e62a40117ce..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-clang/cmain.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -// A trivial function defined in Rust, returning a constant value. This should -// always be inlined. -uint32_t rust_always_inlined(); - - -uint32_t rust_never_inlined(); - -int main(int argc, char** argv) { - return rust_never_inlined() + rust_always_inlined(); -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-clang/main.rs b/tests/run-make-fulldeps/cross-lang-lto-clang/main.rs deleted file mode 100644 index 8129dcb85d9..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-clang/main.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[link(name = "xyz")] -extern "C" { - fn c_always_inlined() -> u32; - fn c_never_inlined() -> u32; -} - -fn main() { - unsafe { - println!("blub: {}", c_always_inlined() + c_never_inlined()); - } -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-clang/rustlib.rs b/tests/run-make-fulldeps/cross-lang-lto-clang/rustlib.rs deleted file mode 100644 index 8a74d74a420..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-clang/rustlib.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type="staticlib"] - -#[no_mangle] -pub extern "C" fn rust_always_inlined() -> u32 { - 42 -} - -#[no_mangle] -#[inline(never)] -pub extern "C" fn rust_never_inlined() -> u32 { - 421 -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/Makefile b/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/Makefile deleted file mode 100644 index 70085d9bde1..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -# needs-matching-clang - -# This test makes sure that cross-language inlining can be used in conjunction -# with profile-guided optimization. The test only tests that the whole workflow -# can be executed without anything crashing. It does not test whether PGO or -# xLTO have any specific effect on the generated code. - -include ../tools.mk - -COMMON_FLAGS=-Copt-level=3 -Ccodegen-units=1 - -# LLVM doesn't support instrumenting binaries that use SEH: -# https://bugs.llvm.org/show_bug.cgi?id=41279 -# -# Things work fine with -Cpanic=abort though. -ifdef IS_MSVC -COMMON_FLAGS+= -Cpanic=abort -endif - -all: cpp-executable rust-executable - -cpp-executable: - $(RUSTC) -Clinker-plugin-lto=on \ - -Cprofile-generate="$(TMPDIR)"/cpp-profdata \ - -o "$(TMPDIR)"/librustlib-xlto.a \ - $(COMMON_FLAGS) \ - ./rustlib.rs - $(CLANG) -flto=thin \ - -fprofile-generate="$(TMPDIR)"/cpp-profdata \ - -fuse-ld=lld \ - -L "$(TMPDIR)" \ - -lrustlib-xlto \ - -o "$(TMPDIR)"/cmain \ - -O3 \ - ./cmain.c - $(TMPDIR)/cmain - # Postprocess the profiling data so it can be used by the compiler - "$(LLVM_BIN_DIR)"/llvm-profdata merge \ - -o "$(TMPDIR)"/cpp-profdata/merged.profdata \ - "$(TMPDIR)"/cpp-profdata/default_*.profraw - $(RUSTC) -Clinker-plugin-lto=on \ - -Cprofile-use="$(TMPDIR)"/cpp-profdata/merged.profdata \ - -o "$(TMPDIR)"/librustlib-xlto.a \ - $(COMMON_FLAGS) \ - ./rustlib.rs - $(CLANG) -flto=thin \ - -fprofile-use="$(TMPDIR)"/cpp-profdata/merged.profdata \ - -fuse-ld=lld \ - -L "$(TMPDIR)" \ - -lrustlib-xlto \ - -o "$(TMPDIR)"/cmain \ - -O3 \ - ./cmain.c - -rust-executable: - exit - $(CLANG) ./clib.c -fprofile-generate="$(TMPDIR)"/rs-profdata -flto=thin -c -o $(TMPDIR)/clib.o -O3 - (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) - $(RUSTC) -Clinker-plugin-lto=on \ - -Cprofile-generate="$(TMPDIR)"/rs-profdata \ - -L$(TMPDIR) \ - $(COMMON_FLAGS) \ - -Clinker=$(CLANG) \ - -Clink-arg=-fuse-ld=lld \ - -o $(TMPDIR)/rsmain \ - ./main.rs - $(TMPDIR)/rsmain - # Postprocess the profiling data so it can be used by the compiler - "$(LLVM_BIN_DIR)"/llvm-profdata merge \ - -o "$(TMPDIR)"/rs-profdata/merged.profdata \ - "$(TMPDIR)"/rs-profdata/default_*.profraw - $(CLANG) ./clib.c \ - -fprofile-use="$(TMPDIR)"/rs-profdata/merged.profdata \ - -flto=thin \ - -c \ - -o $(TMPDIR)/clib.o \ - -O3 - rm "$(TMPDIR)"/libxyz.a - (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) - $(RUSTC) -Clinker-plugin-lto=on \ - -Cprofile-use="$(TMPDIR)"/rs-profdata/merged.profdata \ - -L$(TMPDIR) \ - $(COMMON_FLAGS) \ - -Clinker=$(CLANG) \ - -Clink-arg=-fuse-ld=lld \ - -o $(TMPDIR)/rsmain \ - ./main.rs diff --git a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/clib.c b/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/clib.c deleted file mode 100644 index 90f33f24dc4..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/clib.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -uint32_t c_always_inlined() { - return 1234; -} - -__attribute__((noinline)) uint32_t c_never_inlined() { - return 12345; -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/cmain.c b/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/cmain.c deleted file mode 100644 index e3f24828be3..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/cmain.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -// A trivial function defined in Rust, returning a constant value. This should -// always be inlined. -uint32_t rust_always_inlined(); - - -uint32_t rust_never_inlined(); - -int main(int argc, char** argv) { - return (rust_never_inlined() + rust_always_inlined()) * 0; -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/main.rs b/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/main.rs deleted file mode 100644 index 8129dcb85d9..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/main.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[link(name = "xyz")] -extern "C" { - fn c_always_inlined() -> u32; - fn c_never_inlined() -> u32; -} - -fn main() { - unsafe { - println!("blub: {}", c_always_inlined() + c_never_inlined()); - } -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/rustlib.rs b/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/rustlib.rs deleted file mode 100644 index 8a74d74a420..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-pgo-smoketest/rustlib.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type="staticlib"] - -#[no_mangle] -pub extern "C" fn rust_always_inlined() -> u32 { - 42 -} - -#[no_mangle] -#[inline(never)] -pub extern "C" fn rust_never_inlined() -> u32 { - 421 -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/Makefile b/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/Makefile deleted file mode 100644 index 6f1caa31a80..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -include ../tools.mk - -# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same -# (so fixing it is harder). See #57765 for context -ifndef IS_WINDOWS - -# This test makes sure that we don't loose upstream object files when compiling -# staticlibs with -C linker-plugin-lto - -all: staticlib.rs upstream.rs - $(RUSTC) upstream.rs -C linker-plugin-lto -Ccodegen-units=1 - - # Check No LTO - $(RUSTC) staticlib.rs -C linker-plugin-lto -Ccodegen-units=1 -L. -o $(TMPDIR)/staticlib.a - (cd $(TMPDIR); "$(LLVM_BIN_DIR)"/llvm-ar x ./staticlib.a) - # Make sure the upstream object file was included - ls $(TMPDIR)/upstream.*.rcgu.o - - # Cleanup - rm $(TMPDIR)/* - - # Check ThinLTO - $(RUSTC) upstream.rs -C linker-plugin-lto -Ccodegen-units=1 -Clto=thin - $(RUSTC) staticlib.rs -C linker-plugin-lto -Ccodegen-units=1 -Clto=thin -L. -o $(TMPDIR)/staticlib.a - (cd $(TMPDIR); "$(LLVM_BIN_DIR)"/llvm-ar x ./staticlib.a) - ls $(TMPDIR)/upstream.*.rcgu.o - -else - -all: - -endif diff --git a/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/staticlib.rs b/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/staticlib.rs deleted file mode 100644 index 34951dda3b6..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/staticlib.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type="staticlib"] - -extern crate upstream; - -#[no_mangle] -pub extern "C" fn bar() { - upstream::foo(); -} diff --git a/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/upstream.rs b/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/upstream.rs deleted file mode 100644 index bd6820098ee..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto-upstream-rlibs/upstream.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "rlib"] - -pub fn foo() {} diff --git a/tests/run-make-fulldeps/cross-lang-lto/Makefile b/tests/run-make-fulldeps/cross-lang-lto/Makefile deleted file mode 100644 index 92058f952a9..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto/Makefile +++ /dev/null @@ -1,57 +0,0 @@ - -include ../tools.mk - -# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same -# (so fixing it is harder). See #57765 for context -ifndef IS_WINDOWS - -# This test makes sure that the object files we generate are actually -# LLVM bitcode files (as used by linker LTO plugins) when compiling with -# -Clinker-plugin-lto. - -# this only succeeds for bitcode files -ASSERT_IS_BITCODE_OBJ=("$(LLVM_BIN_DIR)"/llvm-bcanalyzer $(1)) -EXTRACT_OBJS=(cd $(TMPDIR); rm -f ./*.o; "$(LLVM_BIN_DIR)"/llvm-ar x $(1)) - -BUILD_LIB=$(RUSTC) lib.rs -Copt-level=2 -Clinker-plugin-lto -Ccodegen-units=1 -BUILD_EXE=$(RUSTC) main.rs -Copt-level=2 -Clinker-plugin-lto -Ccodegen-units=1 --emit=obj - -all: staticlib staticlib-fat-lto staticlib-thin-lto rlib exe cdylib rdylib - -staticlib: lib.rs - $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib.a - $(call EXTRACT_OBJS, liblib.a) - for file in $(TMPDIR)/liblib.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done - -staticlib-fat-lto: lib.rs - $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-fat-lto.a -Clto=fat - $(call EXTRACT_OBJS, liblib-fat-lto.a) - for file in $(TMPDIR)/liblib-fat-lto.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done - -staticlib-thin-lto: lib.rs - $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-thin-lto.a -Clto=thin - $(call EXTRACT_OBJS, liblib-thin-lto.a) - for file in $(TMPDIR)/liblib-thin-lto.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done - -rlib: lib.rs - $(BUILD_LIB) --crate-type=rlib -o $(TMPDIR)/liblib.rlib - $(call EXTRACT_OBJS, liblib.rlib) - for file in $(TMPDIR)/liblib.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done - -cdylib: lib.rs - $(BUILD_LIB) --crate-type=cdylib --emit=obj -o $(TMPDIR)/cdylib.o - $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/cdylib.o) - -rdylib: lib.rs - $(BUILD_LIB) --crate-type=dylib --emit=obj -o $(TMPDIR)/rdylib.o - $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/rdylib.o) - -exe: lib.rs - $(BUILD_EXE) -o $(TMPDIR)/exe.o - $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/exe.o) - -else - -all: - -endif diff --git a/tests/run-make-fulldeps/cross-lang-lto/lib.rs b/tests/run-make-fulldeps/cross-lang-lto/lib.rs deleted file mode 100644 index 94cfef6ada5..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[no_mangle] -pub extern "C" fn foo() { - println!("abc"); -} diff --git a/tests/run-make-fulldeps/cross-lang-lto/main.rs b/tests/run-make-fulldeps/cross-lang-lto/main.rs deleted file mode 100644 index f6320bcb04a..00000000000 --- a/tests/run-make-fulldeps/cross-lang-lto/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello World"); -} diff --git a/tests/run-make-fulldeps/debug-assertions/Makefile b/tests/run-make-fulldeps/debug-assertions/Makefile deleted file mode 100644 index 73beb4b03ae..00000000000 --- a/tests/run-make-fulldeps/debug-assertions/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) debug.rs -C debug-assertions=no - $(call RUN,debug) good - $(RUSTC) debug.rs -C opt-level=0 - $(call RUN,debug) bad - $(RUSTC) debug.rs -C opt-level=1 - $(call RUN,debug) good - $(RUSTC) debug.rs -C opt-level=2 - $(call RUN,debug) good - $(RUSTC) debug.rs -C opt-level=3 - $(call RUN,debug) good - $(RUSTC) debug.rs -C opt-level=s - $(call RUN,debug) good - $(RUSTC) debug.rs -C opt-level=z - $(call RUN,debug) good - $(RUSTC) debug.rs -O - $(call RUN,debug) good - $(RUSTC) debug.rs - $(call RUN,debug) bad - $(RUSTC) debug.rs -C debug-assertions=yes -O - $(call RUN,debug) bad - $(RUSTC) debug.rs -C debug-assertions=yes -C opt-level=1 - $(call RUN,debug) bad diff --git a/tests/run-make-fulldeps/debug-assertions/debug.rs b/tests/run-make-fulldeps/debug-assertions/debug.rs deleted file mode 100644 index 76ca60a71c8..00000000000 --- a/tests/run-make-fulldeps/debug-assertions/debug.rs +++ /dev/null @@ -1,33 +0,0 @@ -#![feature(rustc_attrs)] -#![deny(warnings)] - -use std::env; -use std::thread; - -fn main() { - let should_fail = env::args().nth(1) == Some("bad".to_string()); - - assert_eq!(thread::spawn(debug_assert_eq).join().is_err(), should_fail); - assert_eq!(thread::spawn(debug_assert).join().is_err(), should_fail); - assert_eq!(thread::spawn(overflow).join().is_err(), should_fail); -} - -fn debug_assert_eq() { - let mut hit1 = false; - let mut hit2 = false; - debug_assert_eq!({ hit1 = true; 1 }, { hit2 = true; 2 }); - assert!(!hit1); - assert!(!hit2); -} - -fn debug_assert() { - let mut hit = false; - debug_assert!({ hit = true; false }); - assert!(!hit); -} - -fn overflow() { - fn add(a: u8, b: u8) -> u8 { a + b } - - add(200u8, 200u8); -} diff --git a/tests/run-make-fulldeps/dep-info-doesnt-run-much/Makefile b/tests/run-make-fulldeps/dep-info-doesnt-run-much/Makefile deleted file mode 100644 index b4dc44ad2be..00000000000 --- a/tests/run-make-fulldeps/dep-info-doesnt-run-much/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs --emit dep-info diff --git a/tests/run-make-fulldeps/dep-info-doesnt-run-much/foo.rs b/tests/run-make-fulldeps/dep-info-doesnt-run-much/foo.rs deleted file mode 100644 index 316e681293e..00000000000 --- a/tests/run-make-fulldeps/dep-info-doesnt-run-much/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -// We're only emitting dep info, so we shouldn't be running static analysis to -// figure out that this program is erroneous. -fn main() { - let a: u8 = "a"; -} diff --git a/tests/run-make-fulldeps/dep-info-spaces/Makefile b/tests/run-make-fulldeps/dep-info-spaces/Makefile deleted file mode 100644 index 0cfe513e490..00000000000 --- a/tests/run-make-fulldeps/dep-info-spaces/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../tools.mk - -# ignore-windows -# ignore-freebsd -# FIXME: (windows: see `../dep-info/Makefile`) - -all: - cp lib.rs $(TMPDIR)/ - cp 'foo foo.rs' $(TMPDIR)/ - cp bar.rs $(TMPDIR)/ - $(RUSTC) --emit link,dep-info --crate-type=lib $(TMPDIR)/lib.rs - sleep 1 - touch $(TMPDIR)/'foo foo.rs' - -rm -f $(TMPDIR)/done - $(MAKE) -drf Makefile.foo - rm $(TMPDIR)/done - pwd - $(MAKE) -drf Makefile.foo - rm $(TMPDIR)/done && exit 1 || exit 0 diff --git a/tests/run-make-fulldeps/dep-info-spaces/Makefile.foo b/tests/run-make-fulldeps/dep-info-spaces/Makefile.foo deleted file mode 100644 index 80a5d4333cd..00000000000 --- a/tests/run-make-fulldeps/dep-info-spaces/Makefile.foo +++ /dev/null @@ -1,7 +0,0 @@ -LIB := $(shell $(RUSTC) --print file-names --crate-type=lib $(TMPDIR)/lib.rs) - -$(TMPDIR)/$(LIB): - $(RUSTC) --emit link,dep-info --crate-type=lib $(TMPDIR)/lib.rs - touch $(TMPDIR)/done - --include $(TMPDIR)/lib.d diff --git a/tests/run-make-fulldeps/dep-info-spaces/bar.rs b/tests/run-make-fulldeps/dep-info-spaces/bar.rs deleted file mode 100644 index c5c0bc606cd..00000000000 --- a/tests/run-make-fulldeps/dep-info-spaces/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/dep-info-spaces/foo foo.rs b/tests/run-make-fulldeps/dep-info-spaces/foo foo.rs deleted file mode 100644 index b76b4321d62..00000000000 --- a/tests/run-make-fulldeps/dep-info-spaces/foo foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn foo() {} diff --git a/tests/run-make-fulldeps/dep-info-spaces/lib.rs b/tests/run-make-fulldeps/dep-info-spaces/lib.rs deleted file mode 100644 index 6264e7b67ec..00000000000 --- a/tests/run-make-fulldeps/dep-info-spaces/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[path="foo foo.rs"] -pub mod foo; - -pub mod bar; diff --git a/tests/run-make-fulldeps/dep-info/Makefile b/tests/run-make-fulldeps/dep-info/Makefile deleted file mode 100644 index c76f43a8eed..00000000000 --- a/tests/run-make-fulldeps/dep-info/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../tools.mk - -# ignore-windows -# ignore-freebsd -# FIXME: on windows `rustc --dep-info` produces Makefile dependency with -# windows native paths (e.g. `c:\path\to\libfoo.a`) -# but msys make seems to fail to recognize such paths, so test fails. - -all: - cp *.rs $(TMPDIR) - $(RUSTC) --emit dep-info,link --crate-type=lib $(TMPDIR)/lib.rs - sleep 2 - touch $(TMPDIR)/foo.rs - -rm -f $(TMPDIR)/done - $(MAKE) -drf Makefile.foo - sleep 2 - rm $(TMPDIR)/done - pwd - $(MAKE) -drf Makefile.foo - rm $(TMPDIR)/done && exit 1 || exit 0 - - # When a source file is deleted `make` should still work - rm $(TMPDIR)/bar.rs - cp $(TMPDIR)/lib2.rs $(TMPDIR)/lib.rs - $(MAKE) -drf Makefile.foo diff --git a/tests/run-make-fulldeps/dep-info/Makefile.foo b/tests/run-make-fulldeps/dep-info/Makefile.foo deleted file mode 100644 index e5df31f88c1..00000000000 --- a/tests/run-make-fulldeps/dep-info/Makefile.foo +++ /dev/null @@ -1,7 +0,0 @@ -LIB := $(shell $(RUSTC) --print file-names --crate-type=lib lib.rs) - -$(TMPDIR)/$(LIB): - $(RUSTC) --emit dep-info,link --crate-type=lib lib.rs - touch $(TMPDIR)/done - --include $(TMPDIR)/foo.d diff --git a/tests/run-make-fulldeps/dep-info/bar.rs b/tests/run-make-fulldeps/dep-info/bar.rs deleted file mode 100644 index c5c0bc606cd..00000000000 --- a/tests/run-make-fulldeps/dep-info/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/dep-info/foo.rs b/tests/run-make-fulldeps/dep-info/foo.rs deleted file mode 100644 index b76b4321d62..00000000000 --- a/tests/run-make-fulldeps/dep-info/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn foo() {} diff --git a/tests/run-make-fulldeps/dep-info/lib.rs b/tests/run-make-fulldeps/dep-info/lib.rs deleted file mode 100644 index eb8631259d4..00000000000 --- a/tests/run-make-fulldeps/dep-info/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_name = "foo"] - -pub mod foo; -pub mod bar; diff --git a/tests/run-make-fulldeps/dep-info/lib2.rs b/tests/run-make-fulldeps/dep-info/lib2.rs deleted file mode 100644 index f4fda9c93c5..00000000000 --- a/tests/run-make-fulldeps/dep-info/lib2.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_name = "foo"] - -pub mod foo; diff --git a/tests/run-make-fulldeps/doctests-keep-binaries/Makefile b/tests/run-make-fulldeps/doctests-keep-binaries/Makefile deleted file mode 100644 index 273c8980b02..00000000000 --- a/tests/run-make-fulldeps/doctests-keep-binaries/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include ../../run-make-fulldeps/tools.mk - -# Check that valid binaries are persisted by running them, regardless of whether the --run or --no-run option is used. - -all: run no_run - -run: - mkdir -p $(TMPDIR)/doctests - $(RUSTC) --crate-type rlib t.rs - $(RUSTDOC) -Zunstable-options --test --persist-doctests $(TMPDIR)/doctests --extern t=$(TMPDIR)/libt.rlib t.rs - $(TMPDIR)/doctests/t_rs_2_0/rust_out - $(TMPDIR)/doctests/t_rs_8_0/rust_out - rm -rf $(TMPDIR)/doctests - -no_run: - mkdir -p $(TMPDIR)/doctests - $(RUSTC) --crate-type rlib t.rs - $(RUSTDOC) -Zunstable-options --test --persist-doctests $(TMPDIR)/doctests --extern t=$(TMPDIR)/libt.rlib t.rs --no-run - $(TMPDIR)/doctests/t_rs_2_0/rust_out - $(TMPDIR)/doctests/t_rs_8_0/rust_out - rm -rf $(TMPDIR)/doctests diff --git a/tests/run-make-fulldeps/doctests-keep-binaries/t.rs b/tests/run-make-fulldeps/doctests-keep-binaries/t.rs deleted file mode 100644 index c38cf0a0b25..00000000000 --- a/tests/run-make-fulldeps/doctests-keep-binaries/t.rs +++ /dev/null @@ -1,11 +0,0 @@ -/// Fungle the foople. -/// ``` -/// t::foople(); -/// ``` -pub fn foople() {} - -/// Flomble the florp -/// ``` -/// t::florp(); -/// ``` -pub fn florp() {} diff --git a/tests/run-make-fulldeps/duplicate-output-flavors/Makefile b/tests/run-make-fulldeps/duplicate-output-flavors/Makefile deleted file mode 100644 index e33279966c9..00000000000 --- a/tests/run-make-fulldeps/duplicate-output-flavors/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --crate-type=rlib foo.rs - $(RUSTC) --crate-type=rlib,rlib foo.rs diff --git a/tests/run-make-fulldeps/duplicate-output-flavors/foo.rs b/tests/run-make-fulldeps/duplicate-output-flavors/foo.rs deleted file mode 100644 index c1bfaa6cab5..00000000000 --- a/tests/run-make-fulldeps/duplicate-output-flavors/foo.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/dylib-chain/Makefile b/tests/run-make-fulldeps/dylib-chain/Makefile deleted file mode 100644 index 1139822f4ea..00000000000 --- a/tests/run-make-fulldeps/dylib-chain/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) m1.rs -C prefer-dynamic - $(RUSTC) m2.rs -C prefer-dynamic - $(RUSTC) m3.rs -C prefer-dynamic - $(RUSTC) m4.rs - $(call RUN,m4) - $(call REMOVE_DYLIBS,m1) - $(call REMOVE_DYLIBS,m2) - $(call REMOVE_DYLIBS,m3) - $(call FAIL,m4) diff --git a/tests/run-make-fulldeps/dylib-chain/m1.rs b/tests/run-make-fulldeps/dylib-chain/m1.rs deleted file mode 100644 index 08c3f37522c..00000000000 --- a/tests/run-make-fulldeps/dylib-chain/m1.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "dylib"] -pub fn m1() {} diff --git a/tests/run-make-fulldeps/dylib-chain/m2.rs b/tests/run-make-fulldeps/dylib-chain/m2.rs deleted file mode 100644 index 62176ddc9f3..00000000000 --- a/tests/run-make-fulldeps/dylib-chain/m2.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "dylib"] -extern crate m1; - -pub fn m2() { m1::m1() } diff --git a/tests/run-make-fulldeps/dylib-chain/m3.rs b/tests/run-make-fulldeps/dylib-chain/m3.rs deleted file mode 100644 index d213aeda9ac..00000000000 --- a/tests/run-make-fulldeps/dylib-chain/m3.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "dylib"] -extern crate m2; - -pub fn m3() { m2::m2() } diff --git a/tests/run-make-fulldeps/dylib-chain/m4.rs b/tests/run-make-fulldeps/dylib-chain/m4.rs deleted file mode 100644 index fa8ec6079de..00000000000 --- a/tests/run-make-fulldeps/dylib-chain/m4.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate m3; - -fn main() { m3::m3() } diff --git a/tests/run-make-fulldeps/emit-stack-sizes/Makefile b/tests/run-make-fulldeps/emit-stack-sizes/Makefile deleted file mode 100644 index f636ebd28f2..00000000000 --- a/tests/run-make-fulldeps/emit-stack-sizes/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -# ignore-windows -# ignore-macos -# -# This feature only works when the output object format is ELF so we ignore -# macOS and Windows - -# check that the .stack_sizes section is generated -all: - $(RUSTC) -C opt-level=3 -Z emit-stack-sizes --emit=obj foo.rs - size -A $(TMPDIR)/foo.o | $(CGREP) .stack_sizes diff --git a/tests/run-make-fulldeps/emit-stack-sizes/foo.rs b/tests/run-make-fulldeps/emit-stack-sizes/foo.rs deleted file mode 100644 index ee51ae32886..00000000000 --- a/tests/run-make-fulldeps/emit-stack-sizes/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "lib"] - -pub fn foo() {} diff --git a/tests/run-make-fulldeps/emit/Makefile b/tests/run-make-fulldeps/emit/Makefile deleted file mode 100644 index 78e68bd6111..00000000000 --- a/tests/run-make-fulldeps/emit/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) -Copt-level=0 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs - $(RUSTC) -Copt-level=1 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs - $(RUSTC) -Copt-level=2 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs - $(RUSTC) -Copt-level=3 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs - $(RUSTC) -Copt-level=s --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs - $(RUSTC) -Copt-level=z --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs - $(RUSTC) -Copt-level=0 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs - $(call RUN,test-26235) || exit 1 - $(RUSTC) -Copt-level=1 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs - $(call RUN,test-26235) || exit 1 - $(RUSTC) -Copt-level=2 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs - $(call RUN,test-26235) || exit 1 - $(RUSTC) -Copt-level=3 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs - $(call RUN,test-26235) || exit 1 - $(RUSTC) -Copt-level=s --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs - $(call RUN,test-26235) || exit 1 - $(RUSTC) -Copt-level=z --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs - $(call RUN,test-26235) || exit 1 diff --git a/tests/run-make-fulldeps/emit/test-24876.rs b/tests/run-make-fulldeps/emit/test-24876.rs deleted file mode 100644 index 734e2ee4bd4..00000000000 --- a/tests/run-make-fulldeps/emit/test-24876.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Checks for issue #24876 - -fn main() { - let mut v = 0; - for i in 0..0 { - v += i; - } - println!("{}", v) -} diff --git a/tests/run-make-fulldeps/emit/test-26235.rs b/tests/run-make-fulldeps/emit/test-26235.rs deleted file mode 100644 index 07d975f3317..00000000000 --- a/tests/run-make-fulldeps/emit/test-26235.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Checks for issue #26235 - -fn main() { - use std::thread; - - type Key = u32; - const NUM_THREADS: usize = 2; - - #[derive(Clone,Copy)] - struct Stats { - upsert: S, - delete: S, - insert: S, - update: S - }; - - impl Stats where S: Copy { - fn dot(self, s: Stats, f: F) -> Stats where F: Fn(S, T) -> B { - let Stats { upsert: u1, delete: d1, insert: i1, update: p1 } = self; - let Stats { upsert: u2, delete: d2, insert: i2, update: p2 } = s; - Stats { upsert: f(u1, u2), delete: f(d1, d2), insert: f(i1, i2), update: f(p1, p2) } - } - - fn new(init: S) -> Self { - Stats { upsert: init, delete: init, insert: init, update: init } - } - } - - fn make_threads() -> Vec> { - let mut t = Vec::with_capacity(NUM_THREADS); - for _ in 0..NUM_THREADS { - t.push(thread::spawn(move || {})); - } - t - } - - let stats = [Stats::new(0); NUM_THREADS]; - make_threads(); - - { - let Stats { ref upsert, ref delete, ref insert, ref update } = stats.iter().fold( - Stats::new(0), |res, &s| res.dot(s, |x: Key, y: Key| x.wrapping_add(y))); - println!("upserts: {}, deletes: {}, inserts: {}, updates: {}", - upsert, delete, insert, update); - } -} diff --git a/tests/run-make-fulldeps/error-found-staticlib-instead-crate/Makefile b/tests/run-make-fulldeps/error-found-staticlib-instead-crate/Makefile deleted file mode 100644 index 0eae41d720c..00000000000 --- a/tests/run-make-fulldeps/error-found-staticlib-instead-crate/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs --crate-type staticlib - $(RUSTC) bar.rs 2>&1 | $(CGREP) "found staticlib" diff --git a/tests/run-make-fulldeps/error-found-staticlib-instead-crate/bar.rs b/tests/run-make-fulldeps/error-found-staticlib-instead-crate/bar.rs deleted file mode 100644 index fe35f1f8e2e..00000000000 --- a/tests/run-make-fulldeps/error-found-staticlib-instead-crate/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::foo(); -} diff --git a/tests/run-make-fulldeps/error-found-staticlib-instead-crate/foo.rs b/tests/run-make-fulldeps/error-found-staticlib-instead-crate/foo.rs deleted file mode 100644 index b76b4321d62..00000000000 --- a/tests/run-make-fulldeps/error-found-staticlib-instead-crate/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn foo() {} diff --git a/tests/run-make-fulldeps/error-writing-dependencies/Makefile b/tests/run-make-fulldeps/error-writing-dependencies/Makefile deleted file mode 100644 index a5d30a647f8..00000000000 --- a/tests/run-make-fulldeps/error-writing-dependencies/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - # Let's get a nice error message - $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | \ - $(CGREP) "error writing dependencies" - # Make sure the filename shows up - $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | $(CGREP) "baz" diff --git a/tests/run-make-fulldeps/error-writing-dependencies/foo.rs b/tests/run-make-fulldeps/error-writing-dependencies/foo.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/error-writing-dependencies/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/exit-code/Makefile b/tests/run-make-fulldeps/exit-code/Makefile deleted file mode 100644 index 3ffaafe9065..00000000000 --- a/tests/run-make-fulldeps/exit-code/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) success.rs; [ $$? -eq 0 ] - $(RUSTC) --invalid-arg-foo; [ $$? -eq 1 ] - $(RUSTC) compile-error.rs; [ $$? -eq 1 ] - $(RUSTC) -Ztreat-err-as-bug compile-error.rs; [ $$? -eq 101 ] - $(RUSTDOC) -o $(TMPDIR)/exit-code success.rs; [ $$? -eq 0 ] - $(RUSTDOC) --invalid-arg-foo; [ $$? -eq 1 ] - $(RUSTDOC) compile-error.rs; [ $$? -eq 1 ] - $(RUSTDOC) lint-failure.rs; [ $$? -eq 1 ] diff --git a/tests/run-make-fulldeps/exit-code/compile-error.rs b/tests/run-make-fulldeps/exit-code/compile-error.rs deleted file mode 100644 index a96c197606c..00000000000 --- a/tests/run-make-fulldeps/exit-code/compile-error.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - compile_error!("kaboom"); -} diff --git a/tests/run-make-fulldeps/exit-code/lint-failure.rs b/tests/run-make-fulldeps/exit-code/lint-failure.rs deleted file mode 100644 index df876ec237f..00000000000 --- a/tests/run-make-fulldeps/exit-code/lint-failure.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![deny(broken_intra_doc_links)] - -/// [intradoc::failure] -pub fn main() { - println!("Hello, world!"); -} diff --git a/tests/run-make-fulldeps/exit-code/success.rs b/tests/run-make-fulldeps/exit-code/success.rs deleted file mode 100644 index 55b8e42b6e2..00000000000 --- a/tests/run-make-fulldeps/exit-code/success.rs +++ /dev/null @@ -1,4 +0,0 @@ -/// Main function -fn main() { - println!("Hello, world!"); -} diff --git a/tests/run-make-fulldeps/extern-diff-internal-name/Makefile b/tests/run-make-fulldeps/extern-diff-internal-name/Makefile deleted file mode 100644 index 54596c2f029..00000000000 --- a/tests/run-make-fulldeps/extern-diff-internal-name/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) lib.rs - $(RUSTC) test.rs --extern foo=$(TMPDIR)/libbar.rlib diff --git a/tests/run-make-fulldeps/extern-diff-internal-name/lib.rs b/tests/run-make-fulldeps/extern-diff-internal-name/lib.rs deleted file mode 100644 index ad96f70866e..00000000000 --- a/tests/run-make-fulldeps/extern-diff-internal-name/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_name = "bar"] -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/extern-diff-internal-name/test.rs b/tests/run-make-fulldeps/extern-diff-internal-name/test.rs deleted file mode 100644 index 4c53dc28a80..00000000000 --- a/tests/run-make-fulldeps/extern-diff-internal-name/test.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[macro_use] -extern crate foo; - -fn main() { -} diff --git a/tests/run-make-fulldeps/extern-flag-disambiguates/Makefile b/tests/run-make-fulldeps/extern-flag-disambiguates/Makefile deleted file mode 100644 index a8f142a6402..00000000000 --- a/tests/run-make-fulldeps/extern-flag-disambiguates/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../tools.mk - -# Attempt to build this dependency tree: -# -# A.1 A.2 -# |\ | -# | \ | -# B \ C -# \ | / -# \|/ -# D -# -# Note that A.1 and A.2 are crates with the same name. - -all: - $(RUSTC) -C metadata=1 -C extra-filename=-1 a.rs - $(RUSTC) -C metadata=2 -C extra-filename=-2 a.rs - $(RUSTC) b.rs --extern a=$(TMPDIR)/liba-1.rlib - $(RUSTC) c.rs --extern a=$(TMPDIR)/liba-2.rlib - @echo before - $(RUSTC) --cfg before d.rs --extern a=$(TMPDIR)/liba-1.rlib - $(call RUN,d) - @echo after - $(RUSTC) --cfg after d.rs --extern a=$(TMPDIR)/liba-1.rlib - $(call RUN,d) diff --git a/tests/run-make-fulldeps/extern-flag-disambiguates/a.rs b/tests/run-make-fulldeps/extern-flag-disambiguates/a.rs deleted file mode 100644 index 2b1a3190150..00000000000 --- a/tests/run-make-fulldeps/extern-flag-disambiguates/a.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_name = "a"] -#![crate_type = "rlib"] - -static FOO: usize = 3; - -pub fn token() -> &'static usize { &FOO } diff --git a/tests/run-make-fulldeps/extern-flag-disambiguates/b.rs b/tests/run-make-fulldeps/extern-flag-disambiguates/b.rs deleted file mode 100644 index 1d7a7339ce2..00000000000 --- a/tests/run-make-fulldeps/extern-flag-disambiguates/b.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_name = "b"] -#![crate_type = "rlib"] - -extern crate a; - -static FOO: usize = 3; - -pub fn token() -> &'static usize { &FOO } -pub fn a_token() -> &'static usize { a::token() } diff --git a/tests/run-make-fulldeps/extern-flag-disambiguates/c.rs b/tests/run-make-fulldeps/extern-flag-disambiguates/c.rs deleted file mode 100644 index 3f9d143ed2d..00000000000 --- a/tests/run-make-fulldeps/extern-flag-disambiguates/c.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_name = "c"] -#![crate_type = "rlib"] - -extern crate a; - -static FOO: usize = 3; - -pub fn token() -> &'static usize { &FOO } -pub fn a_token() -> &'static usize { a::token() } diff --git a/tests/run-make-fulldeps/extern-flag-disambiguates/d.rs b/tests/run-make-fulldeps/extern-flag-disambiguates/d.rs deleted file mode 100644 index 249c6a107ff..00000000000 --- a/tests/run-make-fulldeps/extern-flag-disambiguates/d.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[cfg(before)] extern crate a; -extern crate b; -extern crate c; -#[cfg(after)] extern crate a; - -fn t(a: &'static usize) -> usize { a as *const _ as usize } - -fn main() { - assert_eq!(t(a::token()), t(b::a_token())); - assert!(t(a::token()) != t(c::a_token())); -} diff --git a/tests/run-make-fulldeps/extern-flag-fun/Makefile b/tests/run-make-fulldeps/extern-flag-fun/Makefile deleted file mode 100644 index a0b7c15edb9..00000000000 --- a/tests/run-make-fulldeps/extern-flag-fun/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) bar.rs --crate-type=rlib - $(RUSTC) bar.rs --crate-type=rlib -C extra-filename=-a - $(RUSTC) bar-alt.rs --crate-type=rlib - $(RUSTC) foo.rs --extern bar=no-exist && exit 1 || exit 0 - $(RUSTC) foo.rs --extern bar=foo.rs && exit 1 || exit 0 - $(RUSTC) foo.rs \ - --extern bar=$(TMPDIR)/libbar.rlib \ - --extern bar=$(TMPDIR)/libbar-alt.rlib \ - && exit 1 || exit 0 - $(RUSTC) foo.rs \ - --extern bar=$(TMPDIR)/libbar.rlib \ - --extern bar=$(TMPDIR)/libbar-a.rlib - $(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib - # Try to be sneaky and load a private crate from with a non-private name. - $(RUSTC) rustc.rs -Zforce-unstable-if-unmarked --crate-type=rlib - $(RUSTC) gated_unstable.rs --extern alloc=$(TMPDIR)/librustc.rlib 2>&1 | $(CGREP) 'rustc_private' diff --git a/tests/run-make-fulldeps/extern-flag-fun/bar-alt.rs b/tests/run-make-fulldeps/extern-flag-fun/bar-alt.rs deleted file mode 100644 index cdc6c27d800..00000000000 --- a/tests/run-make-fulldeps/extern-flag-fun/bar-alt.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn f() {} diff --git a/tests/run-make-fulldeps/extern-flag-fun/bar.rs b/tests/run-make-fulldeps/extern-flag-fun/bar.rs deleted file mode 100644 index d11c69f812a..00000000000 --- a/tests/run-make-fulldeps/extern-flag-fun/bar.rs +++ /dev/null @@ -1 +0,0 @@ -// intentionally empty diff --git a/tests/run-make-fulldeps/extern-flag-fun/foo.rs b/tests/run-make-fulldeps/extern-flag-fun/foo.rs deleted file mode 100644 index 0edda7d7b88..00000000000 --- a/tests/run-make-fulldeps/extern-flag-fun/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate bar; - -fn main() {} diff --git a/tests/run-make-fulldeps/extern-flag-fun/gated_unstable.rs b/tests/run-make-fulldeps/extern-flag-fun/gated_unstable.rs deleted file mode 100644 index 03600c830ff..00000000000 --- a/tests/run-make-fulldeps/extern-flag-fun/gated_unstable.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate alloc; - -fn main() {} diff --git a/tests/run-make-fulldeps/extern-flag-fun/rustc.rs b/tests/run-make-fulldeps/extern-flag-fun/rustc.rs deleted file mode 100644 index b76b4321d62..00000000000 --- a/tests/run-make-fulldeps/extern-flag-fun/rustc.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn foo() {} diff --git a/tests/run-make-fulldeps/extern-flag-pathless/Makefile b/tests/run-make-fulldeps/extern-flag-pathless/Makefile deleted file mode 100644 index 0f23815b650..00000000000 --- a/tests/run-make-fulldeps/extern-flag-pathless/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../tools.mk - -# Test mixing pathless --extern with paths. - -all: - $(RUSTC) bar-static.rs --crate-name=bar --crate-type=rlib - $(RUSTC) bar-dynamic.rs --crate-name=bar --crate-type=dylib -C prefer-dynamic - # rlib preferred over dylib - $(RUSTC) foo.rs --extern bar - $(call RUN,foo) | $(CGREP) 'static' - $(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib --extern bar - $(call RUN,foo) | $(CGREP) 'static' - # explicit --extern overrides pathless - $(RUSTC) foo.rs --extern bar=$(call DYLIB,bar) --extern bar - $(call RUN,foo) | $(CGREP) 'dynamic' - # prefer-dynamic does what it says - $(RUSTC) foo.rs --extern bar -C prefer-dynamic - $(call RUN,foo) | $(CGREP) 'dynamic' diff --git a/tests/run-make-fulldeps/extern-flag-pathless/bar-dynamic.rs b/tests/run-make-fulldeps/extern-flag-pathless/bar-dynamic.rs deleted file mode 100644 index e2d68d517ff..00000000000 --- a/tests/run-make-fulldeps/extern-flag-pathless/bar-dynamic.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn f() { - println!("dynamic"); -} diff --git a/tests/run-make-fulldeps/extern-flag-pathless/bar-static.rs b/tests/run-make-fulldeps/extern-flag-pathless/bar-static.rs deleted file mode 100644 index 240d8bde4d1..00000000000 --- a/tests/run-make-fulldeps/extern-flag-pathless/bar-static.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn f() { - println!("static"); -} diff --git a/tests/run-make-fulldeps/extern-flag-pathless/foo.rs b/tests/run-make-fulldeps/extern-flag-pathless/foo.rs deleted file mode 100644 index 1ea64da7dad..00000000000 --- a/tests/run-make-fulldeps/extern-flag-pathless/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - bar::f(); -} diff --git a/tests/run-make-fulldeps/extern-flag-rename-transitive/Makefile b/tests/run-make-fulldeps/extern-flag-rename-transitive/Makefile deleted file mode 100644 index d16a8e20868..00000000000 --- a/tests/run-make-fulldeps/extern-flag-rename-transitive/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(RUSTC) baz.rs --extern a=$(TMPDIR)/libfoo.rlib - diff --git a/tests/run-make-fulldeps/extern-flag-rename-transitive/bar.rs b/tests/run-make-fulldeps/extern-flag-rename-transitive/bar.rs deleted file mode 100644 index 94446a07d6c..00000000000 --- a/tests/run-make-fulldeps/extern-flag-rename-transitive/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "rlib"] - -extern crate foo; diff --git a/tests/run-make-fulldeps/extern-flag-rename-transitive/baz.rs b/tests/run-make-fulldeps/extern-flag-rename-transitive/baz.rs deleted file mode 100644 index c3908db3429..00000000000 --- a/tests/run-make-fulldeps/extern-flag-rename-transitive/baz.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] - -extern crate a; -extern crate bar; diff --git a/tests/run-make-fulldeps/extern-flag-rename-transitive/foo.rs b/tests/run-make-fulldeps/extern-flag-rename-transitive/foo.rs deleted file mode 100644 index c1bfaa6cab5..00000000000 --- a/tests/run-make-fulldeps/extern-flag-rename-transitive/foo.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/extern-fn-generic/Makefile b/tests/run-make-fulldeps/extern-fn-generic/Makefile deleted file mode 100644 index 71746fb10cb..00000000000 --- a/tests/run-make-fulldeps/extern-fn-generic/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) testcrate.rs - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/extern-fn-generic/test.c b/tests/run-make-fulldeps/extern-fn-generic/test.c deleted file mode 100644 index a8504ff2afb..00000000000 --- a/tests/run-make-fulldeps/extern-fn-generic/test.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -typedef struct TestStruct { - uint8_t x; - int32_t y; -} TestStruct; - -typedef int callback(TestStruct s); - -uint32_t call(callback *c) { - TestStruct s; - s.x = 'a'; - s.y = 3; - - return c(s); -} diff --git a/tests/run-make-fulldeps/extern-fn-generic/test.rs b/tests/run-make-fulldeps/extern-fn-generic/test.rs deleted file mode 100644 index c9baa489881..00000000000 --- a/tests/run-make-fulldeps/extern-fn-generic/test.rs +++ /dev/null @@ -1,20 +0,0 @@ -extern crate testcrate; - -extern "C" fn bar(ts: testcrate::TestStruct) -> T { - ts.y -} - -#[link(name = "test", kind = "static")] -extern "C" { - fn call(c: extern "C" fn(testcrate::TestStruct) -> i32) -> i32; -} - -fn main() { - // Let's test calling it cross crate - let back = unsafe { testcrate::call(testcrate::foo::) }; - assert_eq!(3, back); - - // And just within this crate - let back = unsafe { call(bar::) }; - assert_eq!(3, back); -} diff --git a/tests/run-make-fulldeps/extern-fn-generic/testcrate.rs b/tests/run-make-fulldeps/extern-fn-generic/testcrate.rs deleted file mode 100644 index 39f76e59ca0..00000000000 --- a/tests/run-make-fulldeps/extern-fn-generic/testcrate.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![crate_type = "lib"] - -#[repr(C)] -pub struct TestStruct { - pub x: u8, - pub y: T, -} - -pub extern "C" fn foo(ts: TestStruct) -> T { - ts.y -} - -#[link(name = "test", kind = "static")] -extern "C" { - pub fn call(c: extern "C" fn(TestStruct) -> i32) -> i32; -} diff --git a/tests/run-make-fulldeps/extern-fn-mangle/Makefile b/tests/run-make-fulldeps/extern-fn-mangle/Makefile deleted file mode 100644 index 4f5d026f213..00000000000 --- a/tests/run-make-fulldeps/extern-fn-mangle/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/extern-fn-mangle/test.c b/tests/run-make-fulldeps/extern-fn-mangle/test.c deleted file mode 100644 index e94d75083b8..00000000000 --- a/tests/run-make-fulldeps/extern-fn-mangle/test.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -uint32_t foo(); -uint32_t bar(); - -uint32_t add() { - return foo() + bar(); -} diff --git a/tests/run-make-fulldeps/extern-fn-mangle/test.rs b/tests/run-make-fulldeps/extern-fn-mangle/test.rs deleted file mode 100644 index 40b08f1ed70..00000000000 --- a/tests/run-make-fulldeps/extern-fn-mangle/test.rs +++ /dev/null @@ -1,19 +0,0 @@ -#[no_mangle] -pub extern "C" fn foo() -> i32 { - 3 -} - -#[no_mangle] -pub extern "C" fn bar() -> i32 { - 5 -} - -#[link(name = "test", kind = "static")] -extern "C" { - fn add() -> i32; -} - -fn main() { - let back = unsafe { add() }; - assert_eq!(8, back); -} diff --git a/tests/run-make-fulldeps/extern-fn-reachable/Makefile b/tests/run-make-fulldeps/extern-fn-reachable/Makefile deleted file mode 100644 index 05bdb8d65b7..00000000000 --- a/tests/run-make-fulldeps/extern-fn-reachable/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../tools.mk - -# ignore-windows-msvc - -NM=nm -D - -ifeq ($(UNAME),Darwin) -NM=nm -gU -endif - -ifdef IS_WINDOWS -NM=nm -g -endif - -# This overrides the LD_LIBRARY_PATH for RUN -TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR) - -all: - $(RUSTC) dylib.rs -o $(TMPDIR)/libdylib.so -C prefer-dynamic - - [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun1)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun2)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun3)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun4)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun5)" -eq "1" ] diff --git a/tests/run-make-fulldeps/extern-fn-reachable/dylib.rs b/tests/run-make-fulldeps/extern-fn-reachable/dylib.rs deleted file mode 100644 index cd017934870..00000000000 --- a/tests/run-make-fulldeps/extern-fn-reachable/dylib.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_type = "dylib"] -#![allow(dead_code)] - -#[no_mangle] pub extern "C" fn fun1() {} -#[no_mangle] extern "C" fn fun2() {} - -mod foo { - #[no_mangle] pub extern "C" fn fun3() {} -} -pub mod bar { - #[no_mangle] pub extern "C" fn fun4() {} -} - -#[no_mangle] pub fn fun5() {} diff --git a/tests/run-make-fulldeps/extern-fn-struct-passing-abi/Makefile b/tests/run-make-fulldeps/extern-fn-struct-passing-abi/Makefile deleted file mode 100644 index 4f5d026f213..00000000000 --- a/tests/run-make-fulldeps/extern-fn-struct-passing-abi/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.c b/tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.c deleted file mode 100644 index 136b07129e1..00000000000 --- a/tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.c +++ /dev/null @@ -1,314 +0,0 @@ -#include -#include - -struct Rect { - int32_t a; - int32_t b; - int32_t c; - int32_t d; -}; - -struct BiggerRect { - struct Rect s; - int32_t a; - int32_t b; -}; - -struct FloatRect { - int32_t a; - int32_t b; - double c; -}; - -struct Huge { - int32_t a; - int32_t b; - int32_t c; - int32_t d; - int32_t e; -}; - -struct FloatPoint { - double x; - double y; -}; - -struct FloatOne { - double x; -}; - -struct IntOdd { - int8_t a; - int8_t b; - int8_t c; -}; - -// System V x86_64 ABI: -// a, b, c, d, e should be in registers -// s should be byval pointer -// -// Win64 ABI: -// a, b, c, d should be in registers -// e should be on the stack -// s should be byval pointer -void byval_rect(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(c == 3); - assert(d == 4); - assert(e == 5); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); -} - -// System V x86_64 ABI: -// a, b, c, d, e, f should be in registers -// s should be byval pointer on the stack -// -// Win64 ABI: -// a, b, c, d should be in registers -// e, f should be on the stack -// s should be byval pointer on the stack -void byval_many_rect(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, - int32_t f, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(c == 3); - assert(d == 4); - assert(e == 5); - assert(f == 6); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); -} - -// System V x86_64 ABI: -// a, b, c, d, e, f, g should be in sse registers -// s should be split across 2 registers -// t should be byval pointer -// -// Win64 ABI: -// a, b, c, d should be in sse registers -// e, f, g should be on the stack -// s should be on the stack (treated as 2 i64's) -// t should be on the stack (treated as an i64 and a double) -void byval_rect_floats(float a, float b, double c, float d, float e, - float f, double g, struct Rect s, struct FloatRect t) { - assert(a == 1.); - assert(b == 2.); - assert(c == 3.); - assert(d == 4.); - assert(e == 5.); - assert(f == 6.); - assert(g == 7.); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); - assert(t.a == 3489); - assert(t.b == 3490); - assert(t.c == 8.); -} - -// System V x86_64 ABI: -// a, b, d, e, f should be in registers -// c passed via sse registers -// s should be byval pointer -// -// Win64 ABI: -// a, b, d should be in registers -// c passed via sse registers -// e, f should be on the stack -// s should be byval pointer -void byval_rect_with_float(int32_t a, int32_t b, float c, int32_t d, - int32_t e, int32_t f, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(c == 3.); - assert(d == 4); - assert(e == 5); - assert(f == 6); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); -} - -// System V x86_64 ABI: -// a, b, d, e, f should be byval pointer (on the stack) -// g passed via register (fixes #41375) -// -// Win64 ABI: -// a, b, d, e, f, g should be byval pointer -void byval_rect_with_many_huge(struct Huge a, struct Huge b, struct Huge c, - struct Huge d, struct Huge e, struct Huge f, - struct Rect g) { - assert(g.a == 123); - assert(g.b == 456); - assert(g.c == 789); - assert(g.d == 420); -} - -// System V x86_64 & Win64 ABI: -// a, b should be in registers -// s should be split across 2 integer registers -void split_rect(int32_t a, int32_t b, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); -} - -// System V x86_64 & Win64 ABI: -// a, b should be in sse registers -// s should be split across integer & sse registers -void split_rect_floats(float a, float b, struct FloatRect s) { - assert(a == 1.); - assert(b == 2.); - assert(s.a == 3489); - assert(s.b == 3490); - assert(s.c == 8.); -} - -// System V x86_64 ABI: -// a, b, d, f should be in registers -// c, e passed via sse registers -// s should be split across 2 registers -// -// Win64 ABI: -// a, b, d should be in registers -// c passed via sse registers -// e, f should be on the stack -// s should be on the stack (treated as 2 i64's) -void split_rect_with_floats(int32_t a, int32_t b, float c, - int32_t d, float e, int32_t f, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(c == 3.); - assert(d == 4); - assert(e == 5.); - assert(f == 6); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); -} - -// System V x86_64 & Win64 ABI: -// a, b, c should be in registers -// s should be split across 2 registers -// t should be a byval pointer -void split_and_byval_rect(int32_t a, int32_t b, int32_t c, struct Rect s, struct Rect t) { - assert(a == 1); - assert(b == 2); - assert(c == 3); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); - assert(t.a == 553); - assert(t.b == 554); - assert(t.c == 555); - assert(t.d == 556); -} - -// System V x86_64 & Win64 ABI: -// a, b should in registers -// s and return should be split across 2 registers -struct Rect split_ret_byval_struct(int32_t a, int32_t b, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); - return s; -} - -// System V x86_64 & Win64 ABI: -// a, b, c, d should be in registers -// return should be in a hidden sret pointer -// s should be a byval pointer -struct BiggerRect sret_byval_struct(int32_t a, int32_t b, int32_t c, int32_t d, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(c == 3); - assert(d == 4); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); - - struct BiggerRect t; - t.s = s; t.a = 27834; t.b = 7657; - return t; -} - -// System V x86_64 & Win64 ABI: -// a, b should be in registers -// return should be in a hidden sret pointer -// s should be split across 2 registers -struct BiggerRect sret_split_struct(int32_t a, int32_t b, struct Rect s) { - assert(a == 1); - assert(b == 2); - assert(s.a == 553); - assert(s.b == 554); - assert(s.c == 555); - assert(s.d == 556); - - struct BiggerRect t; - t.s = s; t.a = 27834; t.b = 7657; - return t; -} - -// System V x86_64 & Win64 ABI: -// s should be byval pointer (since sizeof(s) > 16) -// return should in a hidden sret pointer -struct Huge huge_struct(struct Huge s) { - assert(s.a == 5647); - assert(s.b == 5648); - assert(s.c == 5649); - assert(s.d == 5650); - assert(s.e == 5651); - - return s; -} - -// System V x86_64 ABI: -// p should be in registers -// return should be in registers -// -// Win64 ABI and 64-bit PowerPC ELFv1 ABI: -// p should be a byval pointer -// return should be in a hidden sret pointer -struct FloatPoint float_point(struct FloatPoint p) { - assert(p.x == 5.); - assert(p.y == -3.); - - return p; -} - -// 64-bit PowerPC ELFv1 ABI: -// f1 should be in a register -// return should be in a hidden sret pointer -struct FloatOne float_one(struct FloatOne f1) { - assert(f1.x == 7.); - - return f1; -} - -// 64-bit PowerPC ELFv1 ABI: -// i should be in the least-significant bits of a register -// return should be in a hidden sret pointer -struct IntOdd int_odd(struct IntOdd i) { - assert(i.a == 1); - assert(i.b == 2); - assert(i.c == 3); - - return i; -} diff --git a/tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs b/tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs deleted file mode 100644 index afe0f52ef0b..00000000000 --- a/tests/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs +++ /dev/null @@ -1,138 +0,0 @@ -// Passing structs via FFI should work regardless of whether -// they get passed in multiple registers, byval pointers or the stack - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct Rect { - a: i32, - b: i32, - c: i32, - d: i32, -} - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct BiggerRect { - s: Rect, - a: i32, - b: i32, -} - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct FloatRect { - a: i32, - b: i32, - c: f64, -} - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct Huge { - a: i32, - b: i32, - c: i32, - d: i32, - e: i32, -} - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct FloatPoint { - x: f64, - y: f64, -} - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct FloatOne { - x: f64, -} - -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(C)] -struct IntOdd { - a: i8, - b: i8, - c: i8, -} - -#[link(name = "test", kind = "static")] -extern "C" { - fn byval_rect(a: i32, b: i32, c: i32, d: i32, e: i32, s: Rect); - - fn byval_many_rect(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, s: Rect); - - fn byval_rect_floats( - a: f32, - b: f32, - c: f64, - d: f32, - e: f32, - f: f32, - g: f64, - s: Rect, - t: FloatRect, - ); - - fn byval_rect_with_float(a: i32, b: i32, c: f32, d: i32, e: i32, f: i32, s: Rect); - - fn byval_rect_with_many_huge(a: Huge, b: Huge, c: Huge, d: Huge, e: Huge, f: Huge, g: Rect); - - fn split_rect(a: i32, b: i32, s: Rect); - - fn split_rect_floats(a: f32, b: f32, s: FloatRect); - - fn split_rect_with_floats(a: i32, b: i32, c: f32, d: i32, e: f32, f: i32, s: Rect); - - fn split_and_byval_rect(a: i32, b: i32, c: i32, s: Rect, t: Rect); - - fn split_ret_byval_struct(a: i32, b: i32, s: Rect) -> Rect; - - fn sret_byval_struct(a: i32, b: i32, c: i32, d: i32, s: Rect) -> BiggerRect; - - fn sret_split_struct(a: i32, b: i32, s: Rect) -> BiggerRect; - - fn huge_struct(s: Huge) -> Huge; - - fn float_point(p: FloatPoint) -> FloatPoint; - - fn float_one(f: FloatOne) -> FloatOne; - - fn int_odd(i: IntOdd) -> IntOdd; -} - -fn main() { - let s = Rect { a: 553, b: 554, c: 555, d: 556 }; - let t = BiggerRect { s: s, a: 27834, b: 7657 }; - let u = FloatRect { a: 3489, b: 3490, c: 8. }; - let v = Huge { a: 5647, b: 5648, c: 5649, d: 5650, e: 5651 }; - let p = FloatPoint { x: 5., y: -3. }; - let f1 = FloatOne { x: 7. }; - let i = IntOdd { a: 1, b: 2, c: 3 }; - - unsafe { - byval_rect(1, 2, 3, 4, 5, s); - byval_many_rect(1, 2, 3, 4, 5, 6, s); - byval_rect_floats(1., 2., 3., 4., 5., 6., 7., s, u); - byval_rect_with_float(1, 2, 3.0, 4, 5, 6, s); - byval_rect_with_many_huge(v, v, v, v, v, v, Rect { a: 123, b: 456, c: 789, d: 420 }); - split_rect(1, 2, s); - split_rect_floats(1., 2., u); - split_rect_with_floats(1, 2, 3.0, 4, 5.0, 6, s); - split_and_byval_rect(1, 2, 3, s, s); - split_rect(1, 2, s); - assert_eq!(huge_struct(v), v); - assert_eq!(split_ret_byval_struct(1, 2, s), s); - assert_eq!(sret_byval_struct(1, 2, 3, 4, s), t); - assert_eq!(sret_split_struct(1, 2, s), t); - assert_eq!(float_point(p), p); - assert_eq!(int_odd(i), i); - - // MSVC/GCC/Clang are not consistent in the ABI of single-float aggregates. - // x86_64: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82028 - // i686: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82041 - #[cfg(not(all(windows, target_env = "gnu")))] - assert_eq!(float_one(f1), f1); - } -} diff --git a/tests/run-make-fulldeps/extern-fn-with-extern-types/Makefile b/tests/run-make-fulldeps/extern-fn-with-extern-types/Makefile deleted file mode 100644 index 1fa708950d4..00000000000 --- a/tests/run-make-fulldeps/extern-fn-with-extern-types/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,ctest) - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/extern-fn-with-extern-types/ctest.c b/tests/run-make-fulldeps/extern-fn-with-extern-types/ctest.c deleted file mode 100644 index 3b6fb4cfce9..00000000000 --- a/tests/run-make-fulldeps/extern-fn-with-extern-types/ctest.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -typedef struct data { - uint32_t magic; -} data; - -data* data_create(uint32_t magic) { - static data d; - d.magic = magic; - return &d; -} - -uint32_t data_get(data* p) { - return p->magic; -} diff --git a/tests/run-make-fulldeps/extern-fn-with-extern-types/test.rs b/tests/run-make-fulldeps/extern-fn-with-extern-types/test.rs deleted file mode 100644 index 90a6ebaf1aa..00000000000 --- a/tests/run-make-fulldeps/extern-fn-with-extern-types/test.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(extern_types)] - -#[link(name = "ctest", kind = "static")] -extern "C" { - type data; - - fn data_create(magic: u32) -> *mut data; - fn data_get(data: *mut data) -> u32; -} - -const MAGIC: u32 = 0xdeadbeef; -fn main() { - unsafe { - let data = data_create(MAGIC); - assert_eq!(data_get(data), MAGIC); - } -} diff --git a/tests/run-make-fulldeps/extern-fn-with-packed-struct/Makefile b/tests/run-make-fulldeps/extern-fn-with-packed-struct/Makefile deleted file mode 100644 index 4f5d026f213..00000000000 --- a/tests/run-make-fulldeps/extern-fn-with-packed-struct/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/extern-fn-with-packed-struct/test.c b/tests/run-make-fulldeps/extern-fn-with-packed-struct/test.c deleted file mode 100644 index c89f8272b1e..00000000000 --- a/tests/run-make-fulldeps/extern-fn-with-packed-struct/test.c +++ /dev/null @@ -1,26 +0,0 @@ -// Pragma needed cause of gcc bug on windows: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 - -#include - -#ifdef _MSC_VER -#pragma pack(push,1) -struct Foo { - char a; - short b; - char c; -}; -#else -#pragma pack(1) -struct __attribute__((packed)) Foo { - char a; - short b; - char c; -}; -#endif - -struct Foo foo(struct Foo foo) { - assert(foo.a == 1); - assert(foo.b == 2); - assert(foo.c == 3); - return foo; -} diff --git a/tests/run-make-fulldeps/extern-fn-with-packed-struct/test.rs b/tests/run-make-fulldeps/extern-fn-with-packed-struct/test.rs deleted file mode 100644 index 2f261efb510..00000000000 --- a/tests/run-make-fulldeps/extern-fn-with-packed-struct/test.rs +++ /dev/null @@ -1,20 +0,0 @@ -#[repr(C, packed)] -#[derive(Copy, Clone, Debug, PartialEq)] -struct Foo { - a: i8, - b: i16, - c: i8, -} - -#[link(name = "test", kind = "static")] -extern "C" { - fn foo(f: Foo) -> Foo; -} - -fn main() { - unsafe { - let a = Foo { a: 1, b: 2, c: 3 }; - let b = foo(a); - assert_eq!(a, b); - } -} diff --git a/tests/run-make-fulldeps/extern-fn-with-union/Makefile b/tests/run-make-fulldeps/extern-fn-with-union/Makefile deleted file mode 100644 index 40bae923e30..00000000000 --- a/tests/run-make-fulldeps/extern-fn-with-union/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,ctest) - $(RUSTC) testcrate.rs - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/extern-fn-with-union/ctest.c b/tests/run-make-fulldeps/extern-fn-with-union/ctest.c deleted file mode 100644 index 86cb6453723..00000000000 --- a/tests/run-make-fulldeps/extern-fn-with-union/ctest.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -typedef union TestUnion { - uint64_t bits; -} TestUnion; - -uint64_t give_back(TestUnion tu) { - return tu.bits; -} diff --git a/tests/run-make-fulldeps/extern-fn-with-union/test.rs b/tests/run-make-fulldeps/extern-fn-with-union/test.rs deleted file mode 100644 index 438fbddf31f..00000000000 --- a/tests/run-make-fulldeps/extern-fn-with-union/test.rs +++ /dev/null @@ -1,19 +0,0 @@ -extern crate testcrate; - -use std::mem; - -extern "C" { - fn give_back(tu: testcrate::TestUnion) -> u64; -} - -fn main() { - let magic: u64 = 0xDEADBEEF; - - // Let's test calling it cross crate - let back = unsafe { testcrate::give_back(mem::transmute(magic)) }; - assert_eq!(magic, back); - - // And just within this crate - let back = unsafe { give_back(mem::transmute(magic)) }; - assert_eq!(magic, back); -} diff --git a/tests/run-make-fulldeps/extern-fn-with-union/testcrate.rs b/tests/run-make-fulldeps/extern-fn-with-union/testcrate.rs deleted file mode 100644 index 28d91ff37c3..00000000000 --- a/tests/run-make-fulldeps/extern-fn-with-union/testcrate.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![crate_type = "lib"] - -#[repr(C)] -pub struct TestUnion { - _val: u64, -} - -#[link(name = "ctest", kind = "static")] -extern "C" { - pub fn give_back(tu: TestUnion) -> u64; -} diff --git a/tests/run-make-fulldeps/extern-multiple-copies/Makefile b/tests/run-make-fulldeps/extern-multiple-copies/Makefile deleted file mode 100644 index 00668a6bc88..00000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo1.rs - $(RUSTC) foo2.rs - mkdir $(TMPDIR)/foo - cp $(TMPDIR)/libfoo1.rlib $(TMPDIR)/foo/libfoo1.rlib - $(RUSTC) bar.rs --extern foo1=$(TMPDIR)/libfoo1.rlib -L $(TMPDIR)/foo diff --git a/tests/run-make-fulldeps/extern-multiple-copies/bar.rs b/tests/run-make-fulldeps/extern-multiple-copies/bar.rs deleted file mode 100644 index c6b3595f677..00000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies/bar.rs +++ /dev/null @@ -1,6 +0,0 @@ -extern crate foo2; // foo2 first to exhibit the bug -extern crate foo1; - -fn main() { - /* ... */ -} diff --git a/tests/run-make-fulldeps/extern-multiple-copies/foo1.rs b/tests/run-make-fulldeps/extern-multiple-copies/foo1.rs deleted file mode 100644 index c1bfaa6cab5..00000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies/foo1.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/extern-multiple-copies/foo2.rs b/tests/run-make-fulldeps/extern-multiple-copies/foo2.rs deleted file mode 100644 index c1bfaa6cab5..00000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies/foo2.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/extern-multiple-copies2/Makefile b/tests/run-make-fulldeps/extern-multiple-copies2/Makefile deleted file mode 100644 index 84de2ebf34d..00000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies2/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo1.rs - $(RUSTC) foo2.rs - mkdir $(TMPDIR)/foo - cp $(TMPDIR)/libfoo1.rlib $(TMPDIR)/foo/libfoo1.rlib - $(RUSTC) bar.rs \ - --extern foo1=$(TMPDIR)/foo/libfoo1.rlib \ - --extern foo2=$(TMPDIR)/libfoo2.rlib diff --git a/tests/run-make-fulldeps/extern-multiple-copies2/bar.rs b/tests/run-make-fulldeps/extern-multiple-copies2/bar.rs deleted file mode 100644 index b3088152d6a..00000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies2/bar.rs +++ /dev/null @@ -1,8 +0,0 @@ -#[macro_use] -extern crate foo2; // foo2 first to exhibit the bug -#[macro_use] -extern crate foo1; - -fn main() { - foo2::foo2(foo1::A); -} diff --git a/tests/run-make-fulldeps/extern-multiple-copies2/foo1.rs b/tests/run-make-fulldeps/extern-multiple-copies2/foo1.rs deleted file mode 100644 index 4c778e52ff4..00000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies2/foo1.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type = "rlib"] - -pub struct A; - -pub fn foo1(a: A) { - drop(a); -} diff --git a/tests/run-make-fulldeps/extern-multiple-copies2/foo2.rs b/tests/run-make-fulldeps/extern-multiple-copies2/foo2.rs deleted file mode 100644 index 2be103507df..00000000000 --- a/tests/run-make-fulldeps/extern-multiple-copies2/foo2.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type = "rlib"] - -#[macro_use] -extern crate foo1; - -pub fn foo2(a: foo1::A) { - foo1::foo1(a); -} diff --git a/tests/run-make-fulldeps/extern-overrides-distribution/Makefile b/tests/run-make-fulldeps/extern-overrides-distribution/Makefile deleted file mode 100644 index c57b062cd5d..00000000000 --- a/tests/run-make-fulldeps/extern-overrides-distribution/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) libc.rs -Cmetadata=foo - $(RUSTC) main.rs --extern libc=$(TMPDIR)/liblibc.rlib diff --git a/tests/run-make-fulldeps/extern-overrides-distribution/libc.rs b/tests/run-make-fulldeps/extern-overrides-distribution/libc.rs deleted file mode 100644 index ee51ae32886..00000000000 --- a/tests/run-make-fulldeps/extern-overrides-distribution/libc.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "lib"] - -pub fn foo() {} diff --git a/tests/run-make-fulldeps/extern-overrides-distribution/main.rs b/tests/run-make-fulldeps/extern-overrides-distribution/main.rs deleted file mode 100644 index 1290a8c5670..00000000000 --- a/tests/run-make-fulldeps/extern-overrides-distribution/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate libc; - -fn main() { - libc::foo(); -} diff --git a/tests/run-make-fulldeps/extra-filename-with-temp-outputs/Makefile b/tests/run-make-fulldeps/extra-filename-with-temp-outputs/Makefile deleted file mode 100644 index 470448cf50c..00000000000 --- a/tests/run-make-fulldeps/extra-filename-with-temp-outputs/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) -C extra-filename=bar foo.rs -C save-temps - rm $(TMPDIR)/foobar.foo*0.rcgu.o - rm $(TMPDIR)/$(call BIN,foobar) diff --git a/tests/run-make-fulldeps/extra-filename-with-temp-outputs/foo.rs b/tests/run-make-fulldeps/extra-filename-with-temp-outputs/foo.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/extra-filename-with-temp-outputs/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/foreign-double-unwind/Makefile b/tests/run-make-fulldeps/foreign-double-unwind/Makefile deleted file mode 100644 index ea2fe9ff881..00000000000 --- a/tests/run-make-fulldeps/foreign-double-unwind/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -all: foo - $(call RUN,foo) | $(CGREP) -v unreachable - -foo: foo.rs $(call NATIVE_STATICLIB,foo) - $(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS) - -$(TMPDIR)/libfoo.o: foo.cpp - $(call COMPILE_OBJ_CXX,$@,$<) diff --git a/tests/run-make-fulldeps/foreign-double-unwind/foo.cpp b/tests/run-make-fulldeps/foreign-double-unwind/foo.cpp deleted file mode 100644 index 69a8f11c2db..00000000000 --- a/tests/run-make-fulldeps/foreign-double-unwind/foo.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include - -void println(const char* s) { - puts(s); - fflush(stdout); -} - -struct outer_exception {}; -struct inner_exception {}; - -extern "C" { - void throw_cxx_exception() { - if (std::uncaught_exception()) { - println("throwing inner C++ exception"); - throw inner_exception(); - } else { - println("throwing outer C++ exception"); - throw outer_exception(); - } - } - - void cxx_catch_callback(void (*cb)()) { - try { - cb(); - println("unreachable: callback returns"); - } catch (outer_exception) { - println("unreachable: caught outer exception in catch (...)"); - } catch (inner_exception) { - println("unreachable: caught inner exception in catch (...)"); - } - } -} diff --git a/tests/run-make-fulldeps/foreign-double-unwind/foo.rs b/tests/run-make-fulldeps/foreign-double-unwind/foo.rs deleted file mode 100644 index cae8aa9402d..00000000000 --- a/tests/run-make-fulldeps/foreign-double-unwind/foo.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Tests that C++ double unwinding through Rust code will be properly guarded -// against instead of exhibiting undefined behaviour. - -#![feature(c_unwind)] - -extern "C-unwind" { - fn throw_cxx_exception(); - fn cxx_catch_callback(cb: extern "C-unwind" fn()); -} - -struct ThrowOnDrop; - -impl Drop for ThrowOnDrop { - fn drop(&mut self) { - unsafe { throw_cxx_exception() }; - } -} - -extern "C-unwind" fn test_double_unwind() { - let _a = ThrowOnDrop; - let _b = ThrowOnDrop; -} - -fn main() { - unsafe { cxx_catch_callback(test_double_unwind) }; -} diff --git a/tests/run-make-fulldeps/foreign-exceptions/Makefile b/tests/run-make-fulldeps/foreign-exceptions/Makefile deleted file mode 100644 index 38fe2773df2..00000000000 --- a/tests/run-make-fulldeps/foreign-exceptions/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -all: foo - $(call RUN,foo) - -foo: foo.rs $(call NATIVE_STATICLIB,foo) - $(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS) - -$(TMPDIR)/libfoo.o: foo.cpp - $(call COMPILE_OBJ_CXX,$@,$<) diff --git a/tests/run-make-fulldeps/foreign-exceptions/foo.cpp b/tests/run-make-fulldeps/foreign-exceptions/foo.cpp deleted file mode 100644 index 8182021a2cc..00000000000 --- a/tests/run-make-fulldeps/foreign-exceptions/foo.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include - -void println(const char* s) { - puts(s); - fflush(stdout); -} - -struct exception {}; -struct rust_panic {}; - -struct drop_check { - bool* ok; - ~drop_check() { - println("~drop_check"); - - if (ok) - *ok = true; - } -}; - -extern "C" { - void rust_catch_callback(void (*cb)(), bool* rust_ok); - - void throw_cxx_exception() { - println("throwing C++ exception"); - throw exception(); - } - - void test_cxx_exception() { - bool rust_ok = false; - try { - rust_catch_callback(throw_cxx_exception, &rust_ok); - assert(false && "unreachable"); - } catch (exception e) { - println("caught C++ exception"); - assert(rust_ok); - return; - } - assert(false && "did not catch thrown C++ exception"); - } - - void cxx_catch_callback(void (*cb)(), bool* cxx_ok) { - drop_check x; - x.ok = NULL; - try { - cb(); - } catch (rust_panic e) { - assert(false && "shouldn't be able to catch a rust panic"); - } catch (...) { - println("caught foreign exception in catch (...)"); - // Foreign exceptions are caught by catch (...). We only set the ok - // flag if we successfully caught the panic. The destructor of - // drop_check will then set the flag to true if it is executed. - x.ok = cxx_ok; - throw; - } - } -} diff --git a/tests/run-make-fulldeps/foreign-exceptions/foo.rs b/tests/run-make-fulldeps/foreign-exceptions/foo.rs deleted file mode 100644 index dd3b7c76f28..00000000000 --- a/tests/run-make-fulldeps/foreign-exceptions/foo.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Tests that C++ exceptions can unwind through Rust code run destructors and -// are caught by catch_unwind. Also tests that Rust panics can unwind through -// C++ code. - -#![feature(c_unwind)] - -use std::panic::{catch_unwind, AssertUnwindSafe}; - -struct DropCheck<'a>(&'a mut bool); -impl<'a> Drop for DropCheck<'a> { - fn drop(&mut self) { - println!("DropCheck::drop"); - *self.0 = true; - } -} - -extern "C" { - fn test_cxx_exception(); -} - -extern "C-unwind" { - fn cxx_catch_callback(cb: extern "C-unwind" fn(), ok: *mut bool); -} - -#[no_mangle] -extern "C-unwind" fn rust_catch_callback(cb: extern "C-unwind" fn(), rust_ok: &mut bool) { - let _drop = DropCheck(rust_ok); - cb(); - unreachable!("should have unwound instead of returned"); -} - -fn test_rust_panic() { - extern "C-unwind" fn callback() { - println!("throwing rust panic"); - panic!(1234i32); - } - - let mut dropped = false; - let mut cxx_ok = false; - let caught_unwind = catch_unwind(AssertUnwindSafe(|| { - let _drop = DropCheck(&mut dropped); - unsafe { - cxx_catch_callback(callback, &mut cxx_ok); - } - unreachable!("should have unwound instead of returned"); - })); - println!("caught rust panic"); - assert!(dropped); - assert!(caught_unwind.is_err()); - let panic_obj = caught_unwind.unwrap_err(); - let panic_int = *panic_obj.downcast_ref::().unwrap(); - assert_eq!(panic_int, 1234); - assert!(cxx_ok); -} - -fn main() { - unsafe { test_cxx_exception() }; - test_rust_panic(); -} diff --git a/tests/run-make-fulldeps/foreign-rust-exceptions/Makefile b/tests/run-make-fulldeps/foreign-rust-exceptions/Makefile deleted file mode 100644 index 50fca7f24e6..00000000000 --- a/tests/run-make-fulldeps/foreign-rust-exceptions/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# ignore-i686-pc-windows-gnu - -# This test doesn't work on 32-bit MinGW as cdylib has its own copy of unwinder -# so cross-DLL unwinding does not work. - -include ../tools.mk - -all: - $(RUSTC) bar.rs --crate-type=cdylib - $(RUSTC) foo.rs - $(call RUN,foo) 2>&1 | $(CGREP) "Rust cannot catch foreign exceptions" diff --git a/tests/run-make-fulldeps/foreign-rust-exceptions/bar.rs b/tests/run-make-fulldeps/foreign-rust-exceptions/bar.rs deleted file mode 100644 index 5f9efe32360..00000000000 --- a/tests/run-make-fulldeps/foreign-rust-exceptions/bar.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type = "cdylib"] -#![feature(c_unwind)] - -#[no_mangle] -extern "C-unwind" fn panic() { - panic!(); -} diff --git a/tests/run-make-fulldeps/foreign-rust-exceptions/foo.rs b/tests/run-make-fulldeps/foreign-rust-exceptions/foo.rs deleted file mode 100644 index 266987c5b6d..00000000000 --- a/tests/run-make-fulldeps/foreign-rust-exceptions/foo.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(c_unwind)] - -#[cfg_attr(not(windows), link(name = "bar"))] -#[cfg_attr(windows, link(name = "bar.dll"))] -extern "C-unwind" { - fn panic(); -} - -fn main() { - let _ = std::panic::catch_unwind(|| { - unsafe { panic() }; - }); -} diff --git a/tests/run-make-fulldeps/fpic/Makefile b/tests/run-make-fulldeps/fpic/Makefile deleted file mode 100644 index 5986de3666f..00000000000 --- a/tests/run-make-fulldeps/fpic/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -# ignore-windows -# ignore-macos - -# Test for #39529. -# `-z text` causes ld to error if there are any non-PIC sections - -all: - $(RUSTC) hello.rs -C link-args=-Wl,-z,text diff --git a/tests/run-make-fulldeps/fpic/hello.rs b/tests/run-make-fulldeps/fpic/hello.rs deleted file mode 100644 index 45590d86ba6..00000000000 --- a/tests/run-make-fulldeps/fpic/hello.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { } diff --git a/tests/run-make-fulldeps/glibc-staticlib-args/Makefile b/tests/run-make-fulldeps/glibc-staticlib-args/Makefile deleted file mode 100644 index 39e64bacf58..00000000000 --- a/tests/run-make-fulldeps/glibc-staticlib-args/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# only-gnu -# only-linux - -include ../tools.mk - -# This ensures that std::env::args works in a library called from C on glibc Linux. - -all: - $(RUSTC) --crate-type=staticlib library.rs - $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(call RUN,program) diff --git a/tests/run-make-fulldeps/glibc-staticlib-args/library.rs b/tests/run-make-fulldeps/glibc-staticlib-args/library.rs deleted file mode 100644 index 5ab627a2ac1..00000000000 --- a/tests/run-make-fulldeps/glibc-staticlib-args/library.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[no_mangle] -pub extern "C" fn args_check() { - assert_ne!(std::env::args_os().count(), 0); -} diff --git a/tests/run-make-fulldeps/glibc-staticlib-args/program.c b/tests/run-make-fulldeps/glibc-staticlib-args/program.c deleted file mode 100644 index 30f6974b750..00000000000 --- a/tests/run-make-fulldeps/glibc-staticlib-args/program.c +++ /dev/null @@ -1,6 +0,0 @@ -void args_check(); - -int main() { - args_check(); - return 0; -} diff --git a/tests/run-make-fulldeps/hir-tree/Makefile b/tests/run-make-fulldeps/hir-tree/Makefile deleted file mode 100644 index b0450ea4bc5..00000000000 --- a/tests/run-make-fulldeps/hir-tree/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -# Test that hir-tree output doesn't crash and includes -# the string constant we would expect to see. - -all: - $(RUSTC) -o $(TMPDIR)/input.hir -Z unpretty=hir-tree input.rs - $(CGREP) '"Hello, Rustaceans!\n"' < $(TMPDIR)/input.hir diff --git a/tests/run-make-fulldeps/hir-tree/input.rs b/tests/run-make-fulldeps/hir-tree/input.rs deleted file mode 100644 index 9d1a4e9e47d..00000000000 --- a/tests/run-make-fulldeps/hir-tree/input.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, Rustaceans!"); -} diff --git a/tests/run-make-fulldeps/hotplug_codegen_backend/Makefile b/tests/run-make-fulldeps/hotplug_codegen_backend/Makefile deleted file mode 100644 index 4cda243ffb5..00000000000 --- a/tests/run-make-fulldeps/hotplug_codegen_backend/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include ../tools.mk - -# ignore-stage1 - -# This test both exists as a check that -Zcodegen-backend is capable of loading external codegen -# backends and that this external codegen backend is only included in the dep info if -# -Zbinary-dep-depinfo is used. - -all: - /bin/echo || exit 0 # This test requires /bin/echo to exist - $(RUSTC) the_backend.rs --crate-name the_backend --crate-type dylib \ - -o $(TMPDIR)/the_backend.dylib - - $(RUSTC) some_crate.rs --crate-name some_crate --crate-type lib -o $(TMPDIR)/some_crate \ - -Z codegen-backend=$(TMPDIR)/the_backend.dylib -Z unstable-options \ - --emit link,dep-info - grep -x "This has been \"compiled\" successfully." $(TMPDIR)/libsome_crate.rlib - # don't declare a dependency on the codegen backend if -Zbinary-dep-depinfo isn't used. - grep -v "the_backend.dylib" $(TMPDIR)/some_crate.d - - $(RUSTC) some_crate.rs --crate-name some_crate --crate-type lib -o $(TMPDIR)/some_crate \ - -Z codegen-backend=$(TMPDIR)/the_backend.dylib -Z unstable-options \ - --emit link,dep-info -Zbinary-dep-depinfo - grep -x "This has been \"compiled\" successfully." $(TMPDIR)/libsome_crate.rlib - # but declare a dependency on the codegen backend if -Zbinary-dep-depinfo it used. - grep "the_backend.dylib" $(TMPDIR)/some_crate.d diff --git a/tests/run-make-fulldeps/hotplug_codegen_backend/some_crate.rs b/tests/run-make-fulldeps/hotplug_codegen_backend/some_crate.rs deleted file mode 100644 index da27b7f3463..00000000000 --- a/tests/run-make-fulldeps/hotplug_codegen_backend/some_crate.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![feature(no_core)] -#![no_core] diff --git a/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs deleted file mode 100644 index 8dac53c2a62..00000000000 --- a/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ /dev/null @@ -1,84 +0,0 @@ -#![feature(rustc_private)] -#![deny(warnings)] - -extern crate rustc_codegen_ssa; -extern crate rustc_data_structures; -extern crate rustc_driver; -extern crate rustc_errors; -extern crate rustc_hir; -extern crate rustc_metadata; -extern crate rustc_middle; -extern crate rustc_session; -extern crate rustc_span; -extern crate rustc_symbol_mangling; -extern crate rustc_target; - -use rustc_codegen_ssa::traits::CodegenBackend; -use rustc_codegen_ssa::{CodegenResults, CrateInfo}; -use rustc_data_structures::fx::FxHashMap; -use rustc_errors::ErrorGuaranteed; -use rustc_metadata::EncodedMetadata; -use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; -use rustc_middle::ty::TyCtxt; -use rustc_session::config::OutputFilenames; -use rustc_session::Session; -use std::any::Any; - -struct TheBackend; - -impl CodegenBackend for TheBackend { - fn locale_resource(&self) -> &'static str { "" } - - fn codegen_crate<'a, 'tcx>( - &self, - tcx: TyCtxt<'tcx>, - metadata: EncodedMetadata, - _need_metadata_module: bool, - ) -> Box { - Box::new(CodegenResults { - modules: vec![], - allocator_module: None, - metadata_module: None, - metadata, - crate_info: CrateInfo::new(tcx, "fake_target_cpu".to_string()), - }) - } - - fn join_codegen( - &self, - ongoing_codegen: Box, - _sess: &Session, - _outputs: &OutputFilenames, - ) -> Result<(CodegenResults, FxHashMap), ErrorGuaranteed> { - let codegen_results = ongoing_codegen - .downcast::() - .expect("in join_codegen: ongoing_codegen is not a CodegenResults"); - Ok((*codegen_results, FxHashMap::default())) - } - - fn link( - &self, - sess: &Session, - codegen_results: CodegenResults, - outputs: &OutputFilenames, - ) -> Result<(), ErrorGuaranteed> { - use rustc_session::{config::CrateType, output::out_filename}; - use std::io::Write; - let crate_name = codegen_results.crate_info.local_crate_name; - for &crate_type in sess.opts.crate_types.iter() { - if crate_type != CrateType::Rlib { - sess.fatal(&format!("Crate type is {:?}", crate_type)); - } - let output_name = out_filename(sess, crate_type, &outputs, crate_name); - let mut out_file = ::std::fs::File::create(output_name).unwrap(); - write!(out_file, "This has been \"compiled\" successfully.").unwrap(); - } - Ok(()) - } -} - -/// This is the entrypoint for a hot plugged rustc_codegen_llvm -#[no_mangle] -pub fn __rustc_codegen_backend() -> Box { - Box::new(TheBackend) -} diff --git a/tests/run-make-fulldeps/include_bytes_deps/Makefile b/tests/run-make-fulldeps/include_bytes_deps/Makefile deleted file mode 100644 index 696dfd207bb..00000000000 --- a/tests/run-make-fulldeps/include_bytes_deps/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -# ignore-freebsd - -all: - $(RUSTC) --emit dep-info main.rs - $(CGREP) "input.txt" "input.bin" "input.md" < $(TMPDIR)/main.d diff --git a/tests/run-make-fulldeps/include_bytes_deps/input.bin b/tests/run-make-fulldeps/include_bytes_deps/input.bin deleted file mode 100644 index cd0875583aa..00000000000 --- a/tests/run-make-fulldeps/include_bytes_deps/input.bin +++ /dev/null @@ -1 +0,0 @@ -Hello world! diff --git a/tests/run-make-fulldeps/include_bytes_deps/input.md b/tests/run-make-fulldeps/include_bytes_deps/input.md deleted file mode 100644 index 2a19b7405f7..00000000000 --- a/tests/run-make-fulldeps/include_bytes_deps/input.md +++ /dev/null @@ -1 +0,0 @@ -# Hello, world! diff --git a/tests/run-make-fulldeps/include_bytes_deps/input.txt b/tests/run-make-fulldeps/include_bytes_deps/input.txt deleted file mode 100644 index cd0875583aa..00000000000 --- a/tests/run-make-fulldeps/include_bytes_deps/input.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! diff --git a/tests/run-make-fulldeps/include_bytes_deps/main.rs b/tests/run-make-fulldeps/include_bytes_deps/main.rs deleted file mode 100644 index 2fd55699d44..00000000000 --- a/tests/run-make-fulldeps/include_bytes_deps/main.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[doc = include_str!("input.md")] -pub struct SomeStruct; - -pub fn main() { - const INPUT_TXT: &'static str = include_str!("input.txt"); - const INPUT_BIN: &'static [u8] = include_bytes!("input.bin"); - - println!("{}", INPUT_TXT); - println!("{:?}", INPUT_BIN); -} diff --git a/tests/run-make-fulldeps/incr-add-rust-src-component/Makefile b/tests/run-make-fulldeps/incr-add-rust-src-component/Makefile deleted file mode 100644 index 5c1d953cc05..00000000000 --- a/tests/run-make-fulldeps/incr-add-rust-src-component/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -include ../tools.mk - -# rust-lang/rust#70924: Test that if we add rust-src component in between two -# incremental compiles, the compiler does not ICE on the second. - -# This test uses `ln -s` rather than copying to save testing time, but its -# usage doesn't work on windows. So ignore windows. - -# ignore-windows - -SYSROOT:=$(shell $(RUSTC) --print sysroot) -FAKEROOT=$(TMPDIR)/fakeroot -INCR=$(TMPDIR)/incr - -# Make a local copy of the sysroot; then remove the rust-src part of it, if -# present, for the *first* build. Then put in a facsimile of the rust-src -# component for the second build, in order to expose the ICE from issue #70924. -# -# Note that it is much easier to just do `cp -a $(SYSROOT)/* $(FAKEROOT)` as a -# first step, but I am concerned that would be too expensive in a unit test -# compared to making symbolic links. -# -# Anyway, the pattern you'll see here is: For every prefix in -# root/lib/rustlib/src, link all of prefix parent content, then remove the -# prefix, then loop on the next prefix. This way, we basically create a copy of -# the context around root/lib/rustlib/src, and can freely add/remove the src -# component itself. -all: - mkdir $(FAKEROOT) - ln -s $(SYSROOT)/* $(FAKEROOT) - rm -f $(FAKEROOT)/lib - mkdir $(FAKEROOT)/lib - ln -s $(SYSROOT)/lib/* $(FAKEROOT)/lib - rm -f $(FAKEROOT)/lib/rustlib - mkdir $(FAKEROOT)/lib/rustlib - ln -s $(SYSROOT)/lib/rustlib/* $(FAKEROOT)/lib/rustlib - rm -f $(FAKEROOT)/lib/rustlib/src - mkdir $(FAKEROOT)/lib/rustlib/src - ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src - rm -f $(FAKEROOT)/lib/rustlib/src/rust - $(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs - mkdir -p $(FAKEROOT)/lib/rustlib/src/rust/src/libstd - touch $(FAKEROOT)/lib/rustlib/src/rust/src/libstd/lib.rs - $(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs diff --git a/tests/run-make-fulldeps/incr-add-rust-src-component/main.rs b/tests/run-make-fulldeps/incr-add-rust-src-component/main.rs deleted file mode 100644 index f6320bcb04a..00000000000 --- a/tests/run-make-fulldeps/incr-add-rust-src-component/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello World"); -} diff --git a/tests/run-make-fulldeps/inline-always-many-cgu/Makefile b/tests/run-make-fulldeps/inline-always-many-cgu/Makefile deleted file mode 100644 index 9945821db28..00000000000 --- a/tests/run-make-fulldeps/inline-always-many-cgu/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs --emit llvm-ir -C codegen-units=2 - if cat $(TMPDIR)/*.ll | $(CGREP) -e '\bcall\b'; then \ - echo "found call instruction when one wasn't expected"; \ - exit 1; \ - fi diff --git a/tests/run-make-fulldeps/inline-always-many-cgu/foo.rs b/tests/run-make-fulldeps/inline-always-many-cgu/foo.rs deleted file mode 100644 index 65fe69c16fe..00000000000 --- a/tests/run-make-fulldeps/inline-always-many-cgu/foo.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![crate_type = "lib"] - -pub mod a { - #[inline(always)] - pub fn foo() { - } - - pub fn bar() { - } -} - -#[no_mangle] -pub fn bar() { - a::foo(); -} diff --git a/tests/run-make-fulldeps/interdependent-c-libraries/Makefile b/tests/run-make-fulldeps/interdependent-c-libraries/Makefile deleted file mode 100644 index dc5b55a9925..00000000000 --- a/tests/run-make-fulldeps/interdependent-c-libraries/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -include ../tools.mk - -# The rust crate foo will link to the native library foo, while the rust crate -# bar will link to the native library bar. There is also a dependency between -# the native library bar to the natibe library foo. -# -# This test ensures that the ordering of -lfoo and -lbar on the command line is -# correct to complete the linkage. If passed as "-lfoo -lbar", then the 'foo' -# library will be stripped out, and the linkage will fail. - -all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar) - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(RUSTC) main.rs --print link-args diff --git a/tests/run-make-fulldeps/interdependent-c-libraries/bar.c b/tests/run-make-fulldeps/interdependent-c-libraries/bar.c deleted file mode 100644 index 812c9753528..00000000000 --- a/tests/run-make-fulldeps/interdependent-c-libraries/bar.c +++ /dev/null @@ -1,3 +0,0 @@ -void foo(); - -void bar() { foo(); } diff --git a/tests/run-make-fulldeps/interdependent-c-libraries/bar.rs b/tests/run-make-fulldeps/interdependent-c-libraries/bar.rs deleted file mode 100644 index 3c2c3f21814..00000000000 --- a/tests/run-make-fulldeps/interdependent-c-libraries/bar.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_type = "rlib"] - -extern crate foo; - -#[link(name = "bar", kind = "static")] -extern "C" { - fn bar(); -} - -pub fn doit() { - unsafe { - bar(); - } -} diff --git a/tests/run-make-fulldeps/interdependent-c-libraries/foo.c b/tests/run-make-fulldeps/interdependent-c-libraries/foo.c deleted file mode 100644 index 85e6cd8c390..00000000000 --- a/tests/run-make-fulldeps/interdependent-c-libraries/foo.c +++ /dev/null @@ -1 +0,0 @@ -void foo() {} diff --git a/tests/run-make-fulldeps/interdependent-c-libraries/foo.rs b/tests/run-make-fulldeps/interdependent-c-libraries/foo.rs deleted file mode 100644 index a69809726c6..00000000000 --- a/tests/run-make-fulldeps/interdependent-c-libraries/foo.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "foo", kind = "static")] -extern "C" { - fn foo(); -} - -pub fn doit() { - unsafe { - foo(); - } -} diff --git a/tests/run-make-fulldeps/interdependent-c-libraries/main.rs b/tests/run-make-fulldeps/interdependent-c-libraries/main.rs deleted file mode 100644 index 2aba427df47..00000000000 --- a/tests/run-make-fulldeps/interdependent-c-libraries/main.rs +++ /dev/null @@ -1,6 +0,0 @@ -extern crate foo; -extern crate bar; - -fn main() { - bar::doit(); -} diff --git a/tests/run-make-fulldeps/intrinsic-unreachable/Makefile b/tests/run-make-fulldeps/intrinsic-unreachable/Makefile deleted file mode 100644 index ff9cc57098c..00000000000 --- a/tests/run-make-fulldeps/intrinsic-unreachable/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -# needs-asm-support -# ignore-windows-msvc -# -# Because of Windows exception handling, the code is not necessarily any shorter. -# https://github.com/llvm-mirror/llvm/commit/64b2297786f7fd6f5fa24cdd4db0298fbf211466 - -all: - $(RUSTC) -O --emit asm exit-ret.rs - $(RUSTC) -O --emit asm exit-unreachable.rs - test `wc -l < $(TMPDIR)/exit-unreachable.s` -lt `wc -l < $(TMPDIR)/exit-ret.s` diff --git a/tests/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs b/tests/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs deleted file mode 100644 index e7b9694d9f2..00000000000 --- a/tests/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_type="lib"] -use std::arch::asm; - -#[deny(unreachable_code)] -pub fn exit(n: usize) -> i32 { - unsafe { - // Pretend this asm is an exit() syscall. - asm!("/*{0}*/", in(reg) n); - } - // This return value is just here to generate some extra code for a return - // value, making it easier for the test script to detect whether the - // compiler deleted it. - 42 -} diff --git a/tests/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs b/tests/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs deleted file mode 100644 index ec85db733df..00000000000 --- a/tests/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs +++ /dev/null @@ -1,18 +0,0 @@ -#![feature(core_intrinsics)] -#![crate_type="lib"] -use std::arch::asm; - -use std::intrinsics; - -#[allow(unreachable_code)] -pub fn exit(n: usize) -> i32 { - unsafe { - // Pretend this asm is an exit() syscall. - asm!("/*{0}*/", in(reg) n); - intrinsics::unreachable() - } - // This return value is just here to generate some extra code for a return - // value, making it easier for the test script to detect whether the - // compiler deleted it. - 42 -} diff --git a/tests/run-make-fulldeps/invalid-library/Makefile b/tests/run-make-fulldeps/invalid-library/Makefile deleted file mode 100644 index 910d9af7b05..00000000000 --- a/tests/run-make-fulldeps/invalid-library/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - touch $(TMPDIR)/lib.rmeta - $(AR) crus $(TMPDIR)/libfoo-ffffffff-1.0.rlib $(TMPDIR)/lib.rmeta - $(RUSTC) foo.rs 2>&1 | $(CGREP) "found invalid metadata" diff --git a/tests/run-make-fulldeps/invalid-library/foo.rs b/tests/run-make-fulldeps/invalid-library/foo.rs deleted file mode 100644 index bb7b36c496e..00000000000 --- a/tests/run-make-fulldeps/invalid-library/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate foo; - -fn main() {} diff --git a/tests/run-make-fulldeps/invalid-staticlib/Makefile b/tests/run-make-fulldeps/invalid-staticlib/Makefile deleted file mode 100644 index 3f0f74ce3cb..00000000000 --- a/tests/run-make-fulldeps/invalid-staticlib/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - touch $(TMPDIR)/libfoo.a - echo | $(RUSTC) - --crate-type=rlib -lstatic=foo 2>&1 | $(CGREP) "failed to add native library" diff --git a/tests/run-make-fulldeps/issue-11908/Makefile b/tests/run-make-fulldeps/issue-11908/Makefile deleted file mode 100644 index 47005537e41..00000000000 --- a/tests/run-make-fulldeps/issue-11908/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# This test ensures that if you have the same rlib or dylib at two locations -# in the same path that you don't hit an assertion in the compiler. -# -# Note that this relies on `liburl` to be in the path somewhere else, -# and then our aux-built libraries will collide with liburl (they have -# the same version listed) - -include ../tools.mk - -all: - mkdir $(TMPDIR)/other - $(RUSTC) foo.rs --crate-type=dylib -C prefer-dynamic - mv $(call DYLIB,foo) $(TMPDIR)/other - $(RUSTC) foo.rs --crate-type=dylib -C prefer-dynamic - $(RUSTC) bar.rs -L $(TMPDIR)/other - rm -rf $(TMPDIR) - mkdir -p $(TMPDIR)/other - $(RUSTC) foo.rs --crate-type=rlib - mv $(TMPDIR)/libfoo.rlib $(TMPDIR)/other - $(RUSTC) foo.rs --crate-type=rlib - $(RUSTC) bar.rs -L $(TMPDIR)/other diff --git a/tests/run-make-fulldeps/issue-11908/bar.rs b/tests/run-make-fulldeps/issue-11908/bar.rs deleted file mode 100644 index bb7b36c496e..00000000000 --- a/tests/run-make-fulldeps/issue-11908/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate foo; - -fn main() {} diff --git a/tests/run-make-fulldeps/issue-11908/foo.rs b/tests/run-make-fulldeps/issue-11908/foo.rs deleted file mode 100644 index 82b2dfe9fdb..00000000000 --- a/tests/run-make-fulldeps/issue-11908/foo.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_name = "foo"] diff --git a/tests/run-make-fulldeps/issue-14500/Makefile b/tests/run-make-fulldeps/issue-14500/Makefile deleted file mode 100644 index 52550e57018..00000000000 --- a/tests/run-make-fulldeps/issue-14500/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../tools.mk - -# Test to make sure that reachable extern fns are always available in final -# productcs, including when LTO is used. In this test, the `foo` crate has a -# reahable symbol, and is a dependency of the `bar` crate. When the `bar` crate -# is compiled with LTO, it shouldn't strip the symbol from `foo`, and that's the -# only way that `foo.c` will successfully compile. - -all: - $(RUSTC) foo.rs --crate-type=rlib - $(RUSTC) bar.rs --crate-type=staticlib -C lto -L. -o $(TMPDIR)/libbar.a - $(CC) foo.c $(TMPDIR)/libbar.a $(EXTRACFLAGS) $(call OUT_EXE,foo) - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/issue-14500/bar.rs b/tests/run-make-fulldeps/issue-14500/bar.rs deleted file mode 100644 index 49af74e1b74..00000000000 --- a/tests/run-make-fulldeps/issue-14500/bar.rs +++ /dev/null @@ -1 +0,0 @@ -extern crate foo; diff --git a/tests/run-make-fulldeps/issue-14500/foo.c b/tests/run-make-fulldeps/issue-14500/foo.c deleted file mode 100644 index 2353d400df3..00000000000 --- a/tests/run-make-fulldeps/issue-14500/foo.c +++ /dev/null @@ -1,7 +0,0 @@ -extern void foo(); -extern char FOO_STATIC; - -int main() { - foo(); - return (int)FOO_STATIC; -} diff --git a/tests/run-make-fulldeps/issue-14500/foo.rs b/tests/run-make-fulldeps/issue-14500/foo.rs deleted file mode 100644 index 7c19c1f2c67..00000000000 --- a/tests/run-make-fulldeps/issue-14500/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[no_mangle] -pub extern "C" fn foo() {} - -#[no_mangle] -pub static FOO_STATIC: u8 = 0; diff --git a/tests/run-make-fulldeps/issue-14698/Makefile b/tests/run-make-fulldeps/issue-14698/Makefile deleted file mode 100644 index a1cfb5abab5..00000000000 --- a/tests/run-make-fulldeps/issue-14698/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - TMP=fake TMPDIR=fake $(RUSTC) foo.rs 2>&1 | $(CGREP) "couldn't create a temp dir:" diff --git a/tests/run-make-fulldeps/issue-14698/foo.rs b/tests/run-make-fulldeps/issue-14698/foo.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/issue-14698/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/issue-15460/Makefile b/tests/run-make-fulldeps/issue-15460/Makefile deleted file mode 100644 index 1648d0c0c9b..00000000000 --- a/tests/run-make-fulldeps/issue-15460/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,foo) - $(RUSTC) foo.rs -C extra-filename=-383hf8 -C prefer-dynamic - $(RUSTC) bar.rs - $(call RUN,bar) diff --git a/tests/run-make-fulldeps/issue-15460/bar.rs b/tests/run-make-fulldeps/issue-15460/bar.rs deleted file mode 100644 index e66aeb6bd39..00000000000 --- a/tests/run-make-fulldeps/issue-15460/bar.rs +++ /dev/null @@ -1,4 +0,0 @@ -extern crate foo; -fn main() { - unsafe { foo::foo() } -} diff --git a/tests/run-make-fulldeps/issue-15460/foo.c b/tests/run-make-fulldeps/issue-15460/foo.c deleted file mode 100644 index fdf595b574e..00000000000 --- a/tests/run-make-fulldeps/issue-15460/foo.c +++ /dev/null @@ -1,6 +0,0 @@ -// ignore-license - -#ifdef _WIN32 -__declspec(dllexport) -#endif -void foo() {} diff --git a/tests/run-make-fulldeps/issue-15460/foo.rs b/tests/run-make-fulldeps/issue-15460/foo.rs deleted file mode 100644 index b4eaa0b31c5..00000000000 --- a/tests/run-make-fulldeps/issue-15460/foo.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "dylib"] - -#[link(name = "foo", kind = "static")] -extern "C" { - pub fn foo(); -} diff --git a/tests/run-make-fulldeps/issue-18943/Makefile b/tests/run-make-fulldeps/issue-18943/Makefile deleted file mode 100644 index fc40d756d6f..00000000000 --- a/tests/run-make-fulldeps/issue-18943/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -# Regression test for ICE #18943 when compiling as lib - -all: - $(RUSTC) foo.rs --crate-type lib - $(call REMOVE_RLIBS,foo) && exit 0 || exit 1 diff --git a/tests/run-make-fulldeps/issue-18943/foo.rs b/tests/run-make-fulldeps/issue-18943/foo.rs deleted file mode 100644 index d18400dd3a5..00000000000 --- a/tests/run-make-fulldeps/issue-18943/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -trait Foo { } - -trait Bar { } - -impl<'a> Foo for Bar + 'a { } diff --git a/tests/run-make-fulldeps/issue-20626/Makefile b/tests/run-make-fulldeps/issue-20626/Makefile deleted file mode 100644 index f76f31e794a..00000000000 --- a/tests/run-make-fulldeps/issue-20626/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -# Test output to be four -# The original error only occurred when printing, not when comparing using assert! - -all: - $(RUSTC) foo.rs -O - [ `$(call RUN,foo)` = "4" ] diff --git a/tests/run-make-fulldeps/issue-20626/foo.rs b/tests/run-make-fulldeps/issue-20626/foo.rs deleted file mode 100644 index a474e234e72..00000000000 --- a/tests/run-make-fulldeps/issue-20626/foo.rs +++ /dev/null @@ -1,13 +0,0 @@ -fn identity(a: &u32) -> &u32 { a } - -fn print_foo(f: &fn(&u32) -> &u32, x: &u32) { - print!("{}", (*f)(x)); -} - -fn main() { - let x = &4; - let f: fn(&u32) -> &u32 = identity; - - // Didn't print 4 on optimized builds - print_foo(&f, x); -} diff --git a/tests/run-make-fulldeps/issue-22131/Makefile b/tests/run-make-fulldeps/issue-22131/Makefile deleted file mode 100644 index 770f4b04ec3..00000000000 --- a/tests/run-make-fulldeps/issue-22131/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: foo.rs - $(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs - $(RUSTDOC) --test --cfg 'feature="bar"' \ - -L $(TMPDIR) foo.rs |\ - $(CGREP) 'foo.rs - foo (line 1) ... ok' diff --git a/tests/run-make-fulldeps/issue-22131/foo.rs b/tests/run-make-fulldeps/issue-22131/foo.rs deleted file mode 100644 index 33255d76879..00000000000 --- a/tests/run-make-fulldeps/issue-22131/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -/// ```rust -/// assert_eq!(foo::foo(), 1); -/// ``` -#[cfg(feature = "bar")] -pub fn foo() -> i32 { 1 } diff --git a/tests/run-make-fulldeps/issue-24445/Makefile b/tests/run-make-fulldeps/issue-24445/Makefile deleted file mode 100644 index 2a12226a6c0..00000000000 --- a/tests/run-make-fulldeps/issue-24445/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -# only-linux - -all: - $(RUSTC) foo.rs - $(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -o $(TMPDIR)/foo - $(call RUN,foo) - $(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -pie -fPIC -o $(TMPDIR)/foo - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/issue-24445/foo.c b/tests/run-make-fulldeps/issue-24445/foo.c deleted file mode 100644 index bb4036b06e1..00000000000 --- a/tests/run-make-fulldeps/issue-24445/foo.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo(); - -int main() { - foo(); - return 0; -} diff --git a/tests/run-make-fulldeps/issue-24445/foo.rs b/tests/run-make-fulldeps/issue-24445/foo.rs deleted file mode 100644 index b67f3847cd4..00000000000 --- a/tests/run-make-fulldeps/issue-24445/foo.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![crate_type = "staticlib"] - -struct Destroy; -impl Drop for Destroy { - fn drop(&mut self) { println!("drop"); } -} - -thread_local! { - static X: Destroy = Destroy -} - -#[no_mangle] -pub extern "C" fn foo() { - X.with(|_| ()); -} diff --git a/tests/run-make-fulldeps/issue-25581/Makefile b/tests/run-make-fulldeps/issue-25581/Makefile deleted file mode 100644 index 4f5d026f213..00000000000 --- a/tests/run-make-fulldeps/issue-25581/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) test.rs - $(call RUN,test) || exit 1 diff --git a/tests/run-make-fulldeps/issue-25581/test.c b/tests/run-make-fulldeps/issue-25581/test.c deleted file mode 100644 index 52fbf78510a..00000000000 --- a/tests/run-make-fulldeps/issue-25581/test.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include - -struct ByteSlice { - uint8_t *data; - size_t len; -}; - -size_t slice_len(struct ByteSlice bs) { - return bs.len; -} - -uint8_t slice_elem(struct ByteSlice bs, size_t idx) { - return bs.data[idx]; -} diff --git a/tests/run-make-fulldeps/issue-25581/test.rs b/tests/run-make-fulldeps/issue-25581/test.rs deleted file mode 100644 index ba6749c9722..00000000000 --- a/tests/run-make-fulldeps/issue-25581/test.rs +++ /dev/null @@ -1,18 +0,0 @@ -#[link(name = "test", kind = "static")] -extern "C" { - fn slice_len(s: &[u8]) -> usize; - fn slice_elem(s: &[u8], idx: usize) -> u8; -} - -fn main() { - let data = [1, 2, 3, 4, 5]; - - unsafe { - assert_eq!(data.len(), slice_len(&data) as usize); - assert_eq!(data[0], slice_elem(&data, 0)); - assert_eq!(data[1], slice_elem(&data, 1)); - assert_eq!(data[2], slice_elem(&data, 2)); - assert_eq!(data[3], slice_elem(&data, 3)); - assert_eq!(data[4], slice_elem(&data, 4)); - } -} diff --git a/tests/run-make-fulldeps/issue-26006/Makefile b/tests/run-make-fulldeps/issue-26006/Makefile deleted file mode 100644 index 0ff07302002..00000000000 --- a/tests/run-make-fulldeps/issue-26006/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -include ../tools.mk - -# ignore-windows - -OUT := $(TMPDIR)/out - -all: time - -time: libc - mkdir -p $(OUT)/time $(OUT)/time/deps - ln -sf $(OUT)/libc/liblibc.rlib $(OUT)/time/deps/ - $(RUSTC) in/time/lib.rs -Ldependency=$(OUT)/time/deps/ - -libc: - mkdir -p $(OUT)/libc - $(RUSTC) in/libc/lib.rs --crate-name=libc -Cmetadata=foo -o $(OUT)/libc/liblibc.rlib diff --git a/tests/run-make-fulldeps/issue-26006/in/libc/lib.rs b/tests/run-make-fulldeps/issue-26006/in/libc/lib.rs deleted file mode 100644 index 23f2bf51800..00000000000 --- a/tests/run-make-fulldeps/issue-26006/in/libc/lib.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type="rlib"] - -pub fn something(){} diff --git a/tests/run-make-fulldeps/issue-26006/in/time/lib.rs b/tests/run-make-fulldeps/issue-26006/in/time/lib.rs deleted file mode 100644 index 87f2f824a36..00000000000 --- a/tests/run-make-fulldeps/issue-26006/in/time/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![feature(rustc_private)] -extern crate libc; - -fn main(){} diff --git a/tests/run-make-fulldeps/issue-26092/Makefile b/tests/run-make-fulldeps/issue-26092/Makefile deleted file mode 100644 index 96822e7690b..00000000000 --- a/tests/run-make-fulldeps/issue-26092/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -# This test ensures that rustc does not panic with `-o ""` option. - -all: - $(RUSTC) -o "" blank.rs 2>&1 | $(CGREP) -i 'panic' && exit 1 || exit 0 diff --git a/tests/run-make-fulldeps/issue-26092/blank.rs b/tests/run-make-fulldeps/issue-26092/blank.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/issue-26092/blank.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/issue-28595/Makefile b/tests/run-make-fulldeps/issue-28595/Makefile deleted file mode 100644 index 30a1d9c560a..00000000000 --- a/tests/run-make-fulldeps/issue-28595/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,a) $(call NATIVE_STATICLIB,b) - $(RUSTC) a.rs - $(RUSTC) b.rs - $(call RUN,b) diff --git a/tests/run-make-fulldeps/issue-28595/a.c b/tests/run-make-fulldeps/issue-28595/a.c deleted file mode 100644 index 7bfd83cca21..00000000000 --- a/tests/run-make-fulldeps/issue-28595/a.c +++ /dev/null @@ -1 +0,0 @@ -void a(void) {} diff --git a/tests/run-make-fulldeps/issue-28595/a.rs b/tests/run-make-fulldeps/issue-28595/a.rs deleted file mode 100644 index 07863cf64d6..00000000000 --- a/tests/run-make-fulldeps/issue-28595/a.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "a", kind = "static")] -extern "C" { - pub fn a(); -} diff --git a/tests/run-make-fulldeps/issue-28595/b.c b/tests/run-make-fulldeps/issue-28595/b.c deleted file mode 100644 index 6aecb5f9e04..00000000000 --- a/tests/run-make-fulldeps/issue-28595/b.c +++ /dev/null @@ -1,5 +0,0 @@ -extern void a(void); - -void b(void) { - a(); -} diff --git a/tests/run-make-fulldeps/issue-28595/b.rs b/tests/run-make-fulldeps/issue-28595/b.rs deleted file mode 100644 index 1f389859fad..00000000000 --- a/tests/run-make-fulldeps/issue-28595/b.rs +++ /dev/null @@ -1,12 +0,0 @@ -extern crate a; - -#[link(name = "b", kind = "static")] -extern "C" { - pub fn b(); -} - -fn main() { - unsafe { - b(); - } -} diff --git a/tests/run-make-fulldeps/issue-28766/Makefile b/tests/run-make-fulldeps/issue-28766/Makefile deleted file mode 100644 index 96d0bdc2b2a..00000000000 --- a/tests/run-make-fulldeps/issue-28766/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) -O foo.rs - $(RUSTC) -O -L $(TMPDIR) main.rs diff --git a/tests/run-make-fulldeps/issue-28766/foo.rs b/tests/run-make-fulldeps/issue-28766/foo.rs deleted file mode 100644 index 1dcabe42dc1..00000000000 --- a/tests/run-make-fulldeps/issue-28766/foo.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type="lib"] -pub struct Foo(()); - -impl Foo { - pub fn new() -> Foo { - Foo(()) - } -} diff --git a/tests/run-make-fulldeps/issue-28766/main.rs b/tests/run-make-fulldeps/issue-28766/main.rs deleted file mode 100644 index de12b1fd9dc..00000000000 --- a/tests/run-make-fulldeps/issue-28766/main.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type="lib"] -extern crate foo; -use foo::Foo; - -pub fn crash() -> Box { - Box::new(Foo::new()) -} diff --git a/tests/run-make-fulldeps/issue-30063/Makefile b/tests/run-make-fulldeps/issue-30063/Makefile deleted file mode 100644 index e4ede598f7b..00000000000 --- a/tests/run-make-fulldeps/issue-30063/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -include ../tools.mk - -all: - rm -f $(TMPDIR)/foo-output - $(RUSTC) -C codegen-units=4 -o $(TMPDIR)/foo-output foo.rs - rm $(TMPDIR)/foo-output - - rm -f $(TMPDIR)/asm-output - $(RUSTC) -C codegen-units=4 --emit=asm -o $(TMPDIR)/asm-output foo.rs - rm $(TMPDIR)/asm-output - - rm -f $(TMPDIR)/bc-output - $(RUSTC) -C codegen-units=4 --emit=llvm-bc -o $(TMPDIR)/bc-output foo.rs - rm $(TMPDIR)/bc-output - - rm -f $(TMPDIR)/ir-output - $(RUSTC) -C codegen-units=4 --emit=llvm-ir -o $(TMPDIR)/ir-output foo.rs - rm $(TMPDIR)/ir-output - - rm -f $(TMPDIR)/link-output - $(RUSTC) -C codegen-units=4 --emit=link -o $(TMPDIR)/link-output foo.rs - rm $(TMPDIR)/link-output - - rm -f $(TMPDIR)/obj-output - $(RUSTC) -C codegen-units=4 --emit=obj -o $(TMPDIR)/obj-output foo.rs - rm $(TMPDIR)/obj-output - - rm -f $(TMPDIR)/dep-output - $(RUSTC) -C codegen-units=4 --emit=dep-info -o $(TMPDIR)/dep-output foo.rs - rm $(TMPDIR)/dep-output - -# # (This case doesn't work yet, and may be fundamentally wrong-headed anyway.) -# rm -f $(TMPDIR)/multi-output -# $(RUSTC) -C codegen-units=4 --emit=asm,obj -o $(TMPDIR)/multi-output foo.rs -# rm $(TMPDIR)/multi-output diff --git a/tests/run-make-fulldeps/issue-30063/foo.rs b/tests/run-make-fulldeps/issue-30063/foo.rs deleted file mode 100644 index 45590d86ba6..00000000000 --- a/tests/run-make-fulldeps/issue-30063/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { } diff --git a/tests/run-make-fulldeps/issue-33329/Makefile b/tests/run-make-fulldeps/issue-33329/Makefile deleted file mode 100644 index 9c149440d8e..00000000000 --- a/tests/run-make-fulldeps/issue-33329/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --target x86_64_unknown-linux-musl main.rs 2>&1 | $(CGREP) \ - "error: Error loading target specification: Could not find specification for target" diff --git a/tests/run-make-fulldeps/issue-33329/main.rs b/tests/run-make-fulldeps/issue-33329/main.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/issue-33329/main.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/issue-35164/Makefile b/tests/run-make-fulldeps/issue-35164/Makefile deleted file mode 100644 index 38aa6f1265f..00000000000 --- a/tests/run-make-fulldeps/issue-35164/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) main.rs --error-format json 2>&1 | $(CGREP) -e '"byte_start":23\b' '"byte_end":29\b' diff --git a/tests/run-make-fulldeps/issue-35164/main.rs b/tests/run-make-fulldeps/issue-35164/main.rs deleted file mode 100644 index 1333d63224c..00000000000 --- a/tests/run-make-fulldeps/issue-35164/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod submodule; - -fn main() { - submodule::foo(); -} diff --git a/tests/run-make-fulldeps/issue-35164/submodule/mod.rs b/tests/run-make-fulldeps/issue-35164/submodule/mod.rs deleted file mode 100644 index a9045b242fb..00000000000 --- a/tests/run-make-fulldeps/issue-35164/submodule/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn foo() { - let _MyFoo = 2; -} diff --git a/tests/run-make-fulldeps/issue-37839/Makefile b/tests/run-make-fulldeps/issue-37839/Makefile deleted file mode 100644 index de50bd71379..00000000000 --- a/tests/run-make-fulldeps/issue-37839/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) a.rs && $(RUSTC) b.rs - $(BARE_RUSTC) c.rs -L dependency=$(TMPDIR) --extern b=$(TMPDIR)/libb.rlib \ - --out-dir=$(TMPDIR) diff --git a/tests/run-make-fulldeps/issue-37839/a.rs b/tests/run-make-fulldeps/issue-37839/a.rs deleted file mode 100644 index b5dffac3ff6..00000000000 --- a/tests/run-make-fulldeps/issue-37839/a.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![allow(unused)] -#![crate_type = "proc-macro"] diff --git a/tests/run-make-fulldeps/issue-37839/b.rs b/tests/run-make-fulldeps/issue-37839/b.rs deleted file mode 100644 index 355d2b16527..00000000000 --- a/tests/run-make-fulldeps/issue-37839/b.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -#[macro_use] extern crate a; diff --git a/tests/run-make-fulldeps/issue-37839/c.rs b/tests/run-make-fulldeps/issue-37839/c.rs deleted file mode 100644 index 4c7ce01b6a0..00000000000 --- a/tests/run-make-fulldeps/issue-37839/c.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -extern crate b; diff --git a/tests/run-make-fulldeps/issue-37893/Makefile b/tests/run-make-fulldeps/issue-37893/Makefile deleted file mode 100644 index 33a60830e5d..00000000000 --- a/tests/run-make-fulldeps/issue-37893/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) a.rs && $(RUSTC) b.rs && $(RUSTC) c.rs diff --git a/tests/run-make-fulldeps/issue-37893/a.rs b/tests/run-make-fulldeps/issue-37893/a.rs deleted file mode 100644 index b5dffac3ff6..00000000000 --- a/tests/run-make-fulldeps/issue-37893/a.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![allow(unused)] -#![crate_type = "proc-macro"] diff --git a/tests/run-make-fulldeps/issue-37893/b.rs b/tests/run-make-fulldeps/issue-37893/b.rs deleted file mode 100644 index 355d2b16527..00000000000 --- a/tests/run-make-fulldeps/issue-37893/b.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -#[macro_use] extern crate a; diff --git a/tests/run-make-fulldeps/issue-37893/c.rs b/tests/run-make-fulldeps/issue-37893/c.rs deleted file mode 100644 index b9c2155728c..00000000000 --- a/tests/run-make-fulldeps/issue-37893/c.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "staticlib"] -extern crate b; -extern crate a; diff --git a/tests/run-make-fulldeps/issue-38237/Makefile b/tests/run-make-fulldeps/issue-38237/Makefile deleted file mode 100644 index 75121d04012..00000000000 --- a/tests/run-make-fulldeps/issue-38237/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs; $(RUSTC) bar.rs - $(RUSTDOC) baz.rs -L $(TMPDIR) -o $(TMPDIR) diff --git a/tests/run-make-fulldeps/issue-38237/bar.rs b/tests/run-make-fulldeps/issue-38237/bar.rs deleted file mode 100644 index 2b839f3a3b3..00000000000 --- a/tests/run-make-fulldeps/issue-38237/bar.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "lib"] - -#[derive(Debug)] -pub struct S; diff --git a/tests/run-make-fulldeps/issue-38237/baz.rs b/tests/run-make-fulldeps/issue-38237/baz.rs deleted file mode 100644 index cd2425f9b69..00000000000 --- a/tests/run-make-fulldeps/issue-38237/baz.rs +++ /dev/null @@ -1,8 +0,0 @@ -extern crate foo; -extern crate bar; - -pub struct Bar; -impl ::std::ops::Deref for Bar { - type Target = bar::S; - fn deref(&self) -> &Self::Target { unimplemented!() } -} diff --git a/tests/run-make-fulldeps/issue-38237/foo.rs b/tests/run-make-fulldeps/issue-38237/foo.rs deleted file mode 100644 index a106e4fde5c..00000000000 --- a/tests/run-make-fulldeps/issue-38237/foo.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -#[proc_macro_derive(A)] -pub fn derive(ts: proc_macro::TokenStream) -> proc_macro::TokenStream { ts } - -#[derive(Debug)] -struct S; diff --git a/tests/run-make-fulldeps/issue-40535/Makefile b/tests/run-make-fulldeps/issue-40535/Makefile deleted file mode 100644 index 155c8825214..00000000000 --- a/tests/run-make-fulldeps/issue-40535/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../tools.mk - -# The ICE occurred in the following situation: -# * `foo` declares `extern crate bar, baz`, depends only on `bar` (forgetting `baz` in `Cargo.toml`) -# * `bar` declares and depends on `extern crate baz` -# * All crates built in metadata-only mode (`cargo check`) -all: - # cc https://github.com/rust-lang/rust/issues/40623 - $(RUSTC) baz.rs --emit=metadata - $(RUSTC) bar.rs --emit=metadata --extern baz=$(TMPDIR)/libbaz.rmeta - $(RUSTC) foo.rs --emit=metadata --extern bar=$(TMPDIR)/libbar.rmeta 2>&1 | \ - $(CGREP) -v "unexpectedly panicked" - # ^ Succeeds if it doesn't find the ICE message diff --git a/tests/run-make-fulldeps/issue-40535/bar.rs b/tests/run-make-fulldeps/issue-40535/bar.rs deleted file mode 100644 index b02b28f59d9..00000000000 --- a/tests/run-make-fulldeps/issue-40535/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "lib"] - -extern crate baz; diff --git a/tests/run-make-fulldeps/issue-40535/baz.rs b/tests/run-make-fulldeps/issue-40535/baz.rs deleted file mode 100644 index 83be6e807e0..00000000000 --- a/tests/run-make-fulldeps/issue-40535/baz.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "lib"] diff --git a/tests/run-make-fulldeps/issue-40535/foo.rs b/tests/run-make-fulldeps/issue-40535/foo.rs deleted file mode 100644 index 27020266425..00000000000 --- a/tests/run-make-fulldeps/issue-40535/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "lib"] - -extern crate bar; -extern crate baz; diff --git a/tests/run-make-fulldeps/issue-46239/Makefile b/tests/run-make-fulldeps/issue-46239/Makefile deleted file mode 100644 index a93ef321298..00000000000 --- a/tests/run-make-fulldeps/issue-46239/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) main.rs -C opt-level=1 - $(call RUN,main) diff --git a/tests/run-make-fulldeps/issue-46239/main.rs b/tests/run-make-fulldeps/issue-46239/main.rs deleted file mode 100644 index b7df5cf4d81..00000000000 --- a/tests/run-make-fulldeps/issue-46239/main.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn project(x: &(T,)) -> &T { &x.0 } - -fn dummy() {} - -fn main() { - let f = (dummy as fn(),); - (*project(&f))(); -} diff --git a/tests/run-make-fulldeps/issue-47551/Makefile b/tests/run-make-fulldeps/issue-47551/Makefile deleted file mode 100644 index 5a6ac725701..00000000000 --- a/tests/run-make-fulldeps/issue-47551/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# only-linux -# ignore-32bit - -include ../tools.mk - -all: - $(RUSTC) eh_frame-terminator.rs - $(call RUN,eh_frame-terminator) | $(CGREP) '1122334455667788' - objdump --dwarf=frames $(TMPDIR)/eh_frame-terminator | $(CGREP) 'ZERO terminator' diff --git a/tests/run-make-fulldeps/issue-47551/eh_frame-terminator.rs b/tests/run-make-fulldeps/issue-47551/eh_frame-terminator.rs deleted file mode 100644 index a2c7a31b7c3..00000000000 --- a/tests/run-make-fulldeps/issue-47551/eh_frame-terminator.rs +++ /dev/null @@ -1,22 +0,0 @@ -// run-pass - -#[derive(Clone, Copy)] -struct Foo { - array: [u64; 10240], -} - -impl Foo { - const fn new() -> Self { - Self { - array: [0x1122_3344_5566_7788; 10240] - } - } -} - -static BAR: [Foo; 10240] = [Foo::new(); 10240]; - -fn main() { - let bt = std::backtrace::Backtrace::force_capture(); - println!("Hello, world! {:?}", bt); - println!("{:x}", BAR[0].array[0]); -} diff --git a/tests/run-make-fulldeps/issue-51671/Makefile b/tests/run-make-fulldeps/issue-51671/Makefile deleted file mode 100644 index c9364536992..00000000000 --- a/tests/run-make-fulldeps/issue-51671/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# ignore-windows-msvc - -all: - $(RUSTC) --emit=obj app.rs - nm $(TMPDIR)/app.o | $(CGREP) rust_begin_unwind - nm $(TMPDIR)/app.o | $(CGREP) rust_eh_personality - nm $(TMPDIR)/app.o | $(CGREP) __rg_oom diff --git a/tests/run-make-fulldeps/issue-51671/app.rs b/tests/run-make-fulldeps/issue-51671/app.rs deleted file mode 100644 index e9dc1e9744f..00000000000 --- a/tests/run-make-fulldeps/issue-51671/app.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![crate_type = "bin"] -#![feature(lang_items, alloc_error_handler)] -#![no_main] -#![no_std] - -use core::alloc::Layout; -use core::panic::PanicInfo; - -#[panic_handler] -fn panic(_: &PanicInfo) -> ! { - loop {} -} - -#[lang = "eh_personality"] -fn eh() {} - -#[alloc_error_handler] -fn oom(_: Layout) -> ! { - loop {} -} diff --git a/tests/run-make-fulldeps/issue-53964/Makefile b/tests/run-make-fulldeps/issue-53964/Makefile deleted file mode 100644 index 6bd83021374..00000000000 --- a/tests/run-make-fulldeps/issue-53964/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) panic.rs - $(RUSTC) -C panic=abort --emit=obj app.rs -L $(TMPDIR) diff --git a/tests/run-make-fulldeps/issue-53964/app.rs b/tests/run-make-fulldeps/issue-53964/app.rs deleted file mode 100644 index 8127b9578bf..00000000000 --- a/tests/run-make-fulldeps/issue-53964/app.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type = "bin"] -#![no_main] -#![no_std] - -#![deny(unused_extern_crates)] - -// `panic` provides a `panic_handler` so it shouldn't trip the `unused_extern_crates` lint -extern crate panic; diff --git a/tests/run-make-fulldeps/issue-53964/panic.rs b/tests/run-make-fulldeps/issue-53964/panic.rs deleted file mode 100644 index a8781205071..00000000000 --- a/tests/run-make-fulldeps/issue-53964/panic.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "lib"] -#![feature(panic_handler)] -#![no_std] - -use core::panic::PanicInfo; - -#[panic_handler] -fn panic(_: &PanicInfo) -> ! { - loop {} -} diff --git a/tests/run-make-fulldeps/issue-64153/Makefile b/tests/run-make-fulldeps/issue-64153/Makefile deleted file mode 100644 index f42ea620fb9..00000000000 --- a/tests/run-make-fulldeps/issue-64153/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include ../tools.mk - -# `llvm-objdump`'s output looks different on windows than on other platforms. -# It should be enough to check on Unix platforms, so: -# ignore-windows - -# Staticlibs don't include Rust object files from upstream crates if the same -# code was already pulled into the lib via LTO. However, the bug described in -# https://github.com/rust-lang/rust/issues/64153 lead to this exclusion not -# working properly if the upstream crate was compiled with an explicit filename -# (via `-o`). -# -# This test makes sure that functions defined in the upstream crates do not -# appear twice in the final staticlib when listing all the symbols from it. - -all: - $(RUSTC) --crate-type rlib upstream.rs -o $(TMPDIR)/libupstream.rlib -Ccodegen-units=1 - $(RUSTC) --crate-type staticlib downstream.rs -Clto -Ccodegen-units=1 -o $(TMPDIR)/libdownstream.a - # Dump all the symbols from the staticlib into `syms` - "$(LLVM_BIN_DIR)"/llvm-objdump -t $(TMPDIR)/libdownstream.a > $(TMPDIR)/syms - # Count the global instances of `issue64153_test_function`. There'll be 2 - # if the `upstream` object file got erroneously included twice. - # The line we are testing for with the regex looks something like: - # 0000000000000000 g F .text.issue64153_test_function 00000023 issue64153_test_function - grep -c -e "[[:space:]]g[[:space:]]*F[[:space:]].*issue64153_test_function" $(TMPDIR)/syms > $(TMPDIR)/count - [ "$$(cat $(TMPDIR)/count)" -eq "1" ] diff --git a/tests/run-make-fulldeps/issue-64153/downstream.rs b/tests/run-make-fulldeps/issue-64153/downstream.rs deleted file mode 100644 index e03704665d4..00000000000 --- a/tests/run-make-fulldeps/issue-64153/downstream.rs +++ /dev/null @@ -1,6 +0,0 @@ -extern crate upstream; - -#[no_mangle] -pub extern "C" fn foo() { - print!("1 + 1 = {}", upstream::issue64153_test_function(1)); -} diff --git a/tests/run-make-fulldeps/issue-64153/upstream.rs b/tests/run-make-fulldeps/issue-64153/upstream.rs deleted file mode 100644 index 861a00298ea..00000000000 --- a/tests/run-make-fulldeps/issue-64153/upstream.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Make this function extern "C", public, and no-mangle, so that it gets -// exported from the downstream staticlib. -#[no_mangle] -pub extern "C" fn issue64153_test_function(x: u32) -> u32 { - x + 1 -} diff --git a/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/Makefile b/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/Makefile deleted file mode 100644 index 13983f4ffe0..00000000000 --- a/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# Regression test for issue #68794 -# -# Verify that no text relocations are accidentally introduced by linking a -# minimal rust staticlib. -# -# The test links a rust static library into a shared library, and checks that -# the linker doesn't have to flag the resulting file as containing TEXTRELs. - -include ../tools.mk - -# only-linux - -all: - $(RUSTC) foo.rs - $(CC) bar.c $(call STATICLIB,foo) -fPIC -shared -o $(call DYLIB,bar) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - readelf -d $(call DYLIB,bar) | grep TEXTREL; test $$? -eq 1 diff --git a/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/bar.c b/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/bar.c deleted file mode 100644 index bb4036b06e1..00000000000 --- a/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo(); - -int main() { - foo(); - return 0; -} diff --git a/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/foo.rs b/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/foo.rs deleted file mode 100644 index a3e865b638e..00000000000 --- a/tests/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/foo.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type = "staticlib"] - -#[no_mangle] -pub extern "C" fn foo(x: u32) { - // using the println! makes it so that enough code from the standard - // library is included (see issue #68794) - println!("foo: {}", x); -} diff --git a/tests/run-make-fulldeps/issue-69368/Makefile b/tests/run-make-fulldeps/issue-69368/Makefile deleted file mode 100644 index 41770475db0..00000000000 --- a/tests/run-make-fulldeps/issue-69368/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../tools.mk - -# Test that previously triggered a linker failure with root cause -# similar to one found in the issue #69368. -# -# The crate that provides oom lang item is missing some other lang -# items. Necessary to prevent the use of start-group / end-group. -# -# The weak lang items are defined in a separate compilation units, -# so that linker could omit them if not used. -# -# The crates that need those weak lang items are dependencies of -# crates that provide them. - -all: - $(RUSTC) a.rs - $(RUSTC) b.rs - $(RUSTC) c.rs diff --git a/tests/run-make-fulldeps/issue-69368/a.rs b/tests/run-make-fulldeps/issue-69368/a.rs deleted file mode 100644 index a54f429550e..00000000000 --- a/tests/run-make-fulldeps/issue-69368/a.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![crate_type = "rlib"] -#![feature(lang_items)] -#![feature(panic_unwind)] -#![no_std] - -extern crate panic_unwind; - -#[panic_handler] -pub fn panic_handler(_: &core::panic::PanicInfo) -> ! { - loop {} -} - -#[no_mangle] -extern "C" fn __rust_drop_panic() -> ! { - loop {} -} - -#[no_mangle] -extern "C" fn __rust_foreign_exception() -> ! { - loop {} -} - -#[lang = "eh_personality"] -fn eh_personality() { - loop {} -} diff --git a/tests/run-make-fulldeps/issue-69368/b.rs b/tests/run-make-fulldeps/issue-69368/b.rs deleted file mode 100644 index 4d6af026656..00000000000 --- a/tests/run-make-fulldeps/issue-69368/b.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type = "rlib"] -#![feature(alloc_error_handler)] -#![no_std] - -#[alloc_error_handler] -pub fn error_handler(_: core::alloc::Layout) -> ! { - panic!(); -} diff --git a/tests/run-make-fulldeps/issue-69368/c.rs b/tests/run-make-fulldeps/issue-69368/c.rs deleted file mode 100644 index 729c4249a05..00000000000 --- a/tests/run-make-fulldeps/issue-69368/c.rs +++ /dev/null @@ -1,34 +0,0 @@ -#![crate_type = "bin"] -#![feature(start)] -#![no_std] - -extern crate alloc; -extern crate a; -extern crate b; - -use alloc::vec::Vec; -use core::alloc::*; - -struct Allocator; - -unsafe impl GlobalAlloc for Allocator { - unsafe fn alloc(&self, _: Layout) -> *mut u8 { - loop {} - } - - unsafe fn dealloc(&self, _: *mut u8, _: Layout) { - loop {} - } -} - -#[global_allocator] -static ALLOCATOR: Allocator = Allocator; - -#[start] -fn main(argc: isize, _argv: *const *const u8) -> isize { - let mut v = Vec::new(); - for i in 0..argc { - v.push(i); - } - v.iter().sum() -} diff --git a/tests/run-make-fulldeps/issue-7349/Makefile b/tests/run-make-fulldeps/issue-7349/Makefile deleted file mode 100644 index dc073b77fe1..00000000000 --- a/tests/run-make-fulldeps/issue-7349/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# Test to make sure that inner functions within a polymorphic outer function -# don't get re-codegened when the outer function is monomorphized. The test -# code monomorphizes the outer functions several times, but the magic constants -# used in the inner functions should each appear only once in the generated IR. - -all: - $(RUSTC) foo.rs --emit=llvm-ir - [ "$$(grep -c 'ret i32 8675309' "$(TMPDIR)/foo.ll")" -eq "1" ] - [ "$$(grep -c 'ret i32 11235813' "$(TMPDIR)/foo.ll")" -eq "1" ] diff --git a/tests/run-make-fulldeps/issue-7349/foo.rs b/tests/run-make-fulldeps/issue-7349/foo.rs deleted file mode 100644 index 246a1259580..00000000000 --- a/tests/run-make-fulldeps/issue-7349/foo.rs +++ /dev/null @@ -1,22 +0,0 @@ -fn outer() { - #[allow(dead_code)] - fn inner() -> u32 { - 8675309 - } - inner(); -} - -extern "C" fn outer_foreign() { - #[allow(dead_code)] - fn inner() -> u32 { - 11235813 - } - inner(); -} - -fn main() { - outer::(); - outer::(); - outer_foreign::(); - outer_foreign::(); -} diff --git a/tests/run-make-fulldeps/issue-83045/Makefile b/tests/run-make-fulldeps/issue-83045/Makefile deleted file mode 100644 index fc180ccfe28..00000000000 --- a/tests/run-make-fulldeps/issue-83045/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -include ../../run-make-fulldeps/tools.mk - -# This test case creates a situation where the crate loader would run -# into an ICE when confronted with an invalid setup where it cannot -# find the dependency of a direct dependency. -# -# The test case makes sure that the compiler produces the expected -# error message but does not ICE immediately after. -# -# See https://github.com/rust-lang/rust/issues/83045 - -# This is a platform-independent issue, no need to waste time testing -# everywhere. -# only-x86_64 -# only-linux - -# NOTE: We use BARE_RUSTC below so that the compiler can't find liba.rlib -# If we used RUSTC the additional '-L TMPDIR' option would allow rustc to -# actually find the crate. -# -# We check that we get the expected error message -# But that we do not get an ICE - -all: - $(RUSTC) --crate-name=a --crate-type=rlib a.rs --verbose - $(RUSTC) --crate-name=b --crate-type=rlib --extern a=$(TMPDIR)/liba.rlib b.rs --verbose - $(BARE_RUSTC) --out-dir $(TMPDIR) \ - --extern b=$(TMPDIR)/libb.rlib \ - --crate-type=rlib \ - --edition=2018 \ - c.rs 2>&1 | tee $(TMPDIR)/output.txt || exit 0 - $(CGREP) E0519 < $(TMPDIR)/output.txt - $(CGREP) -v "internal compiler error" < $(TMPDIR)/output.txt diff --git a/tests/run-make-fulldeps/issue-83045/a.rs b/tests/run-make-fulldeps/issue-83045/a.rs deleted file mode 100644 index 66d9f758e9d..00000000000 --- a/tests/run-make-fulldeps/issue-83045/a.rs +++ /dev/null @@ -1 +0,0 @@ -// empty on purpose diff --git a/tests/run-make-fulldeps/issue-83045/b.rs b/tests/run-make-fulldeps/issue-83045/b.rs deleted file mode 100644 index f4876cfa457..00000000000 --- a/tests/run-make-fulldeps/issue-83045/b.rs +++ /dev/null @@ -1 +0,0 @@ -extern crate a; diff --git a/tests/run-make-fulldeps/issue-83045/c.rs b/tests/run-make-fulldeps/issue-83045/c.rs deleted file mode 100644 index e0c4525499e..00000000000 --- a/tests/run-make-fulldeps/issue-83045/c.rs +++ /dev/null @@ -1 +0,0 @@ -use b as _; diff --git a/tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/Makefile b/tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/Makefile deleted file mode 100644 index 879ce174339..00000000000 --- a/tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# needs-matching-clang - -# This test makes sure the embed bitcode in elf created with -# lto-embed-bitcode=optimized is valid llvm BC module. - -include ../../run-make-fulldeps/tools.mk - -all: - $(RUSTC) test.rs --target $(TARGET) -Clink-arg=-fuse-ld=lld -Clinker-plugin-lto -Clinker=$(CLANG) -Clink-arg=-Wl,--plugin-opt=-lto-embed-bitcode=optimized -Zemit-thin-lto=no - $(LLVM_BIN_DIR)/objcopy --dump-section .llvmbc=$(TMPDIR)/test.bc $(TMPDIR)/test - $(LLVM_BIN_DIR)/llvm-dis $(TMPDIR)/test.bc diff --git a/tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/test.rs b/tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/test.rs deleted file mode 100644 index 47ad8c63411..00000000000 --- a/tests/run-make-fulldeps/issue-84395-lto-embed-bitcode/test.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello World!"); -} diff --git a/tests/run-make-fulldeps/issue-97463-abi-param-passing/Makefile b/tests/run-make-fulldeps/issue-97463-abi-param-passing/Makefile deleted file mode 100644 index db1b53e152e..00000000000 --- a/tests/run-make-fulldeps/issue-97463-abi-param-passing/Makefile +++ /dev/null @@ -1,14 +0,0 @@ --include ../tools.mk - -# ignore-msvc - -# The issue exercised by this test, rust-lang/rust#97463, explicitly needs `-O` -# flags (like `-O3`) to reproduce. Thus, we call $(CC) instead of nicer -# alternatives provided by tools.mk like using `COMPILE_OBJ` or using a -# `NATIVE_STATICLIB` dependency. - -all: - $(CC) -c -O3 -o $(TMPDIR)/bad.o bad.c - $(AR) rcs $(TMPDIR)/libbad.a $(TMPDIR)/bad.o - $(RUSTC) param_passing.rs -L$(TMPDIR) -lbad -C opt-level=3 - $(call RUN,param_passing) diff --git a/tests/run-make-fulldeps/issue-97463-abi-param-passing/bad.c b/tests/run-make-fulldeps/issue-97463-abi-param-passing/bad.c deleted file mode 100644 index 013314ab20d..00000000000 --- a/tests/run-make-fulldeps/issue-97463-abi-param-passing/bad.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - - -struct bloc { - uint16_t a; - uint16_t b; - uint16_t c; -}; - -uint16_t c_read_value(uint32_t a, uint32_t b, uint32_t c) { - struct bloc *data = malloc(sizeof(struct bloc)); - - data->a = a & 0xFFFF; - data->b = b & 0xFFFF; - data->c = c & 0xFFFF; - - printf("C struct: a = %u, b = %u, c = %u\n", - (unsigned) data->a, (unsigned) data->b, (unsigned) data->c); - printf("C function returns %u\n", (unsigned) data->b); - - return data->b; /* leak data */ -} diff --git a/tests/run-make-fulldeps/issue-97463-abi-param-passing/param_passing.rs b/tests/run-make-fulldeps/issue-97463-abi-param-passing/param_passing.rs deleted file mode 100644 index c11f3cc72bd..00000000000 --- a/tests/run-make-fulldeps/issue-97463-abi-param-passing/param_passing.rs +++ /dev/null @@ -1,38 +0,0 @@ -// NOTE: Exposing the bug encoded in this test is sensitive to -// LLVM optimization choices. See additional note below for an -// example. - -#[link(name = "bad")] -extern "C" { - pub fn c_read_value(a: u32, b: u32, c: u32) -> u16; -} - -fn main() { - const C1: usize = 0x327b23c6; - const C2: usize = C1 & 0xFFFF; - - let r1: usize = 0x0; - let r2: usize = C1; - let r3: usize = 0x0; - let value: u16 = unsafe { c_read_value(r1 as u32, r2 as u32, r3 as u32) }; - - // NOTE: as an example of the sensitivity of this test to optimization choices, - // uncommenting this block of code makes the bug go away on pnkfelix's machine. - // (But observing via `dbg!` doesn't hide the bug. At least sometimes.) - /* - println!("{}", value); - println!("{}", value as usize); - println!("{}", usize::from(value)); - println!("{}", (value as usize) & 0xFFFF); - */ - - let d1 = value; - let d2 = value as usize; - let d3 = usize::from(value); - let d4 = (value as usize) & 0xFFFF; - - let d = (&d1, &d2, &d3, &d4); - let d_ = (d1, d2, d3, d4); - - assert_eq!(((&(C2 as u16), &C2, &C2, &C2), (C2 as u16, C2, C2, C2)), (d, d_)); -} diff --git a/tests/run-make-fulldeps/issue64319/Makefile b/tests/run-make-fulldeps/issue64319/Makefile deleted file mode 100644 index ee0d177abc9..00000000000 --- a/tests/run-make-fulldeps/issue64319/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -include ../../run-make-fulldeps/tools.mk - -# Different optimization levels imply different values for `-Zshare-generics`, -# so try out a whole bunch of combinations to make sure everything is compatible -all: - # First up, try some defaults - $(RUSTC) --crate-type rlib foo.rs - $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 - - # Next try mixing up some things explicitly - $(RUSTC) --crate-type rlib foo.rs -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -Z share-generics=no - $(RUSTC) --crate-type rlib foo.rs -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes - $(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -Z share-generics=no - $(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes - - # Now combine a whole bunch of options together - $(RUSTC) --crate-type rlib foo.rs - $(RUSTC) --crate-type dylib bar.rs - $(RUSTC) --crate-type dylib bar.rs -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -C opt-level=1 - $(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -C opt-level=2 - $(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 - $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -C opt-level=s - $(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=yes - $(RUSTC) --crate-type dylib bar.rs -C opt-level=z - $(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=no - $(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=yes diff --git a/tests/run-make-fulldeps/issue64319/bar.rs b/tests/run-make-fulldeps/issue64319/bar.rs deleted file mode 100644 index 3895c0b6cdb..00000000000 --- a/tests/run-make-fulldeps/issue64319/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -pub fn bar() { - foo::foo(); -} diff --git a/tests/run-make-fulldeps/issue64319/foo.rs b/tests/run-make-fulldeps/issue64319/foo.rs deleted file mode 100644 index c54a238e9ad..00000000000 --- a/tests/run-make-fulldeps/issue64319/foo.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub fn foo() { - bar::(); -} - -pub fn bar() { - baz(); -} - -fn baz() {} diff --git a/tests/run-make-fulldeps/libs-through-symlinks/Makefile b/tests/run-make-fulldeps/libs-through-symlinks/Makefile deleted file mode 100644 index 45deaecb840..00000000000 --- a/tests/run-make-fulldeps/libs-through-symlinks/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# ignore-windows - -NAME := $(shell $(RUSTC) --print file-names foo.rs) - -all: - mkdir -p $(TMPDIR)/outdir - $(RUSTC) foo.rs -o $(TMPDIR)/outdir/$(NAME) - ln -nsf outdir/$(NAME) $(TMPDIR) - RUSTC_LOG=rustc_metadata::loader $(RUSTC) bar.rs diff --git a/tests/run-make-fulldeps/libs-through-symlinks/bar.rs b/tests/run-make-fulldeps/libs-through-symlinks/bar.rs deleted file mode 100644 index bb7b36c496e..00000000000 --- a/tests/run-make-fulldeps/libs-through-symlinks/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate foo; - -fn main() {} diff --git a/tests/run-make-fulldeps/libs-through-symlinks/foo.rs b/tests/run-make-fulldeps/libs-through-symlinks/foo.rs deleted file mode 100644 index 8e3df2c6d4e..00000000000 --- a/tests/run-make-fulldeps/libs-through-symlinks/foo.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "rlib"] -#![crate_name = "foo"] diff --git a/tests/run-make-fulldeps/libtest-json/Makefile b/tests/run-make-fulldeps/libtest-json/Makefile deleted file mode 100644 index 37b6cb9e2d4..00000000000 --- a/tests/run-make-fulldeps/libtest-json/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../tools.mk - -# Test expected libtest's JSON output - -OUTPUT_FILE_DEFAULT := $(TMPDIR)/libtest-json-output-default.json -OUTPUT_FILE_STDOUT_SUCCESS := $(TMPDIR)/libtest-json-output-stdout-success.json - -all: f.rs validate_json.py output-default.json output-stdout-success.json - $(RUSTC) --test f.rs - RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=json > $(OUTPUT_FILE_DEFAULT) || true - RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=json --show-output > $(OUTPUT_FILE_STDOUT_SUCCESS) || true - - cat $(OUTPUT_FILE_DEFAULT) | "$(PYTHON)" validate_json.py - cat $(OUTPUT_FILE_STDOUT_SUCCESS) | "$(PYTHON)" validate_json.py - - # Normalize the actual output and compare to expected output file - cat $(OUTPUT_FILE_DEFAULT) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-default.json - - cat $(OUTPUT_FILE_STDOUT_SUCCESS) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-stdout-success.json - diff --git a/tests/run-make-fulldeps/libtest-json/f.rs b/tests/run-make-fulldeps/libtest-json/f.rs deleted file mode 100644 index edfe25086ae..00000000000 --- a/tests/run-make-fulldeps/libtest-json/f.rs +++ /dev/null @@ -1,22 +0,0 @@ -#[test] -fn a() { - println!("print from successful test"); - // Should pass -} - -#[test] -fn b() { - assert!(false); -} - -#[test] -#[should_panic] -fn c() { - assert!(false); -} - -#[test] -#[ignore = "msg"] -fn d() { - assert!(false); -} diff --git a/tests/run-make-fulldeps/libtest-json/output-default.json b/tests/run-make-fulldeps/libtest-json/output-default.json deleted file mode 100644 index ad22b66eda6..00000000000 --- a/tests/run-make-fulldeps/libtest-json/output-default.json +++ /dev/null @@ -1,10 +0,0 @@ -{ "type": "suite", "event": "started", "test_count": 4 } -{ "type": "test", "event": "started", "name": "a" } -{ "type": "test", "name": "a", "event": "ok" } -{ "type": "test", "event": "started", "name": "b" } -{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } -{ "type": "test", "event": "started", "name": "c" } -{ "type": "test", "name": "c", "event": "ok" } -{ "type": "test", "event": "started", "name": "d" } -{ "type": "test", "name": "d", "event": "ignored", "message": "msg" } -{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } diff --git a/tests/run-make-fulldeps/libtest-json/output-stdout-success.json b/tests/run-make-fulldeps/libtest-json/output-stdout-success.json deleted file mode 100644 index ec98172eb1c..00000000000 --- a/tests/run-make-fulldeps/libtest-json/output-stdout-success.json +++ /dev/null @@ -1,10 +0,0 @@ -{ "type": "suite", "event": "started", "test_count": 4 } -{ "type": "test", "event": "started", "name": "a" } -{ "type": "test", "name": "a", "event": "ok", "stdout": "print from successful test\n" } -{ "type": "test", "event": "started", "name": "b" } -{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } -{ "type": "test", "event": "started", "name": "c" } -{ "type": "test", "name": "c", "event": "ok", "stdout": "thread 'c' panicked at 'assertion failed: false', f.rs:15:5\n" } -{ "type": "test", "event": "started", "name": "d" } -{ "type": "test", "name": "d", "event": "ignored", "message": "msg" } -{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } diff --git a/tests/run-make-fulldeps/libtest-json/validate_json.py b/tests/run-make-fulldeps/libtest-json/validate_json.py deleted file mode 100755 index 657f732f2bf..00000000000 --- a/tests/run-make-fulldeps/libtest-json/validate_json.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python - -import sys -import json - -# Try to decode line in order to ensure it is a valid JSON document -for line in sys.stdin: - json.loads(line) diff --git a/tests/run-make-fulldeps/link-arg/Makefile b/tests/run-make-fulldeps/link-arg/Makefile deleted file mode 100644 index 103527c3e14..00000000000 --- a/tests/run-make-fulldeps/link-arg/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk -RUSTC_FLAGS = -C link-arg="-lfoo" -C link-arg="-lbar" --print link-args - -all: - $(RUSTC) $(RUSTC_FLAGS) empty.rs | $(CGREP) lfoo lbar diff --git a/tests/run-make-fulldeps/link-arg/empty.rs b/tests/run-make-fulldeps/link-arg/empty.rs deleted file mode 100644 index 45590d86ba6..00000000000 --- a/tests/run-make-fulldeps/link-arg/empty.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { } diff --git a/tests/run-make-fulldeps/link-args-order/Makefile b/tests/run-make-fulldeps/link-args-order/Makefile deleted file mode 100644 index c562cc1b396..00000000000 --- a/tests/run-make-fulldeps/link-args-order/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# ignore-msvc - -include ../tools.mk - -RUSTC_FLAGS = -C linker-flavor=ld -C link-arg=a -C link-args="b c" -C link-args="d e" -C link-arg=f -RUSTC_FLAGS_PRE = -C linker-flavor=ld -Z pre-link-arg=a -Z pre-link-args="b c" -Z pre-link-args="d e" -Z pre-link-arg=f - -all: - $(RUSTC) $(RUSTC_FLAGS) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f"' - $(RUSTC) $(RUSTC_FLAGS_PRE) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f"' diff --git a/tests/run-make-fulldeps/link-args-order/empty.rs b/tests/run-make-fulldeps/link-args-order/empty.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/link-args-order/empty.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/link-cfg/Makefile b/tests/run-make-fulldeps/link-cfg/Makefile deleted file mode 100644 index 0b25ccded06..00000000000 --- a/tests/run-make-fulldeps/link-cfg/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../tools.mk - -all: $(call DYLIB,return1) $(call DYLIB,return2) $(call NATIVE_STATICLIB,return3) - ls $(TMPDIR) - $(BARE_RUSTC) --print cfg --target x86_64-unknown-linux-musl | $(CGREP) crt-static - - $(RUSTC) no-deps.rs --cfg foo - $(call RUN,no-deps) - $(RUSTC) no-deps.rs --cfg bar - $(call RUN,no-deps) - - $(RUSTC) dep.rs - $(RUSTC) with-deps.rs --cfg foo - $(call RUN,with-deps) - $(RUSTC) with-deps.rs --cfg bar - $(call RUN,with-deps) - - $(RUSTC) dep-with-staticlib.rs - $(RUSTC) with-staticlib-deps.rs --cfg foo - $(call RUN,with-staticlib-deps) - $(RUSTC) with-staticlib-deps.rs --cfg bar - $(call RUN,with-staticlib-deps) diff --git a/tests/run-make-fulldeps/link-cfg/dep-with-staticlib.rs b/tests/run-make-fulldeps/link-cfg/dep-with-staticlib.rs deleted file mode 100644 index 5ad66475d00..00000000000 --- a/tests/run-make-fulldeps/link-cfg/dep-with-staticlib.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(link_cfg)] -#![crate_type = "rlib"] - -#[link(name = "return1", cfg(foo))] -#[link(name = "return3", kind = "static", cfg(bar))] -extern "C" { - pub fn my_function() -> i32; -} diff --git a/tests/run-make-fulldeps/link-cfg/dep.rs b/tests/run-make-fulldeps/link-cfg/dep.rs deleted file mode 100644 index 40de77f05b3..00000000000 --- a/tests/run-make-fulldeps/link-cfg/dep.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(link_cfg)] -#![crate_type = "rlib"] - -#[link(name = "return1", cfg(foo))] -#[link(name = "return2", cfg(bar))] -extern "C" { - pub fn my_function() -> i32; -} diff --git a/tests/run-make-fulldeps/link-cfg/no-deps.rs b/tests/run-make-fulldeps/link-cfg/no-deps.rs deleted file mode 100644 index ba5a8711a26..00000000000 --- a/tests/run-make-fulldeps/link-cfg/no-deps.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![feature(link_cfg)] - -#[link(name = "return1", cfg(foo))] -#[link(name = "return2", cfg(bar))] -extern "C" { - fn my_function() -> i32; -} - -fn main() { - unsafe { - let v = my_function(); - if cfg!(foo) { - assert_eq!(v, 1); - } else if cfg!(bar) { - assert_eq!(v, 2); - } else { - panic!("unknown"); - } - } -} diff --git a/tests/run-make-fulldeps/link-cfg/return1.c b/tests/run-make-fulldeps/link-cfg/return1.c deleted file mode 100644 index 41c2809ade3..00000000000 --- a/tests/run-make-fulldeps/link-cfg/return1.c +++ /dev/null @@ -1,6 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int my_function() { - return 1; -} diff --git a/tests/run-make-fulldeps/link-cfg/return2.c b/tests/run-make-fulldeps/link-cfg/return2.c deleted file mode 100644 index 622aeaa294c..00000000000 --- a/tests/run-make-fulldeps/link-cfg/return2.c +++ /dev/null @@ -1,6 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int my_function() { - return 2; -} diff --git a/tests/run-make-fulldeps/link-cfg/return3.c b/tests/run-make-fulldeps/link-cfg/return3.c deleted file mode 100644 index f29dc60d5e8..00000000000 --- a/tests/run-make-fulldeps/link-cfg/return3.c +++ /dev/null @@ -1,6 +0,0 @@ -#ifdef _WIN32 -__declspec(dllexport) -#endif -int my_function() { - return 3; -} diff --git a/tests/run-make-fulldeps/link-cfg/with-deps.rs b/tests/run-make-fulldeps/link-cfg/with-deps.rs deleted file mode 100644 index 48b7828152e..00000000000 --- a/tests/run-make-fulldeps/link-cfg/with-deps.rs +++ /dev/null @@ -1,14 +0,0 @@ -extern crate dep; - -fn main() { - unsafe { - let v = dep::my_function(); - if cfg!(foo) { - assert_eq!(v, 1); - } else if cfg!(bar) { - assert_eq!(v, 2); - } else { - panic!("unknown"); - } - } -} diff --git a/tests/run-make-fulldeps/link-cfg/with-staticlib-deps.rs b/tests/run-make-fulldeps/link-cfg/with-staticlib-deps.rs deleted file mode 100644 index 23e5926a73c..00000000000 --- a/tests/run-make-fulldeps/link-cfg/with-staticlib-deps.rs +++ /dev/null @@ -1,14 +0,0 @@ -extern crate dep_with_staticlib; - -fn main() { - unsafe { - let v = dep_with_staticlib::my_function(); - if cfg!(foo) { - assert_eq!(v, 1); - } else if cfg!(bar) { - assert_eq!(v, 3); - } else { - panic!("unknown"); - } - } -} diff --git a/tests/run-make-fulldeps/link-dedup/Makefile b/tests/run-make-fulldeps/link-dedup/Makefile deleted file mode 100644 index eff18ab48ab..00000000000 --- a/tests/run-make-fulldeps/link-dedup/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# ignore-msvc - -include ../tools.mk - -all: - $(RUSTC) depa.rs - $(RUSTC) depb.rs - $(RUSTC) depc.rs - $(RUSTC) empty.rs --cfg bar 2>&1 | $(CGREP) '"-ltesta" "-ltestb" "-ltesta"' - $(RUSTC) empty.rs 2>&1 | $(CGREP) '"-ltesta"' - $(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltestb"' - $(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltesta" "-ltesta" "-ltesta"' diff --git a/tests/run-make-fulldeps/link-dedup/depa.rs b/tests/run-make-fulldeps/link-dedup/depa.rs deleted file mode 100644 index 19178c5bd49..00000000000 --- a/tests/run-make-fulldeps/link-dedup/depa.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "testa")] -extern "C" {} - -#[link(name = "testa")] -extern "C" {} - -#[link(name = "testa")] -extern "C" {} diff --git a/tests/run-make-fulldeps/link-dedup/depb.rs b/tests/run-make-fulldeps/link-dedup/depb.rs deleted file mode 100644 index b1be21fe005..00000000000 --- a/tests/run-make-fulldeps/link-dedup/depb.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(link_cfg)] -#![crate_type = "rlib"] - -#[link(name = "testb", cfg(foo))] -extern "C" {} - -#[link(name = "testb", cfg(bar))] -extern "C" {} diff --git a/tests/run-make-fulldeps/link-dedup/depc.rs b/tests/run-make-fulldeps/link-dedup/depc.rs deleted file mode 100644 index 8dcb3dee5a2..00000000000 --- a/tests/run-make-fulldeps/link-dedup/depc.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "testa")] -extern "C" {} diff --git a/tests/run-make-fulldeps/link-dedup/empty.rs b/tests/run-make-fulldeps/link-dedup/empty.rs deleted file mode 100644 index e00ae18f4af..00000000000 --- a/tests/run-make-fulldeps/link-dedup/empty.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate depa; -extern crate depb; -extern crate depc; - -fn main() {} diff --git a/tests/run-make-fulldeps/link-path-order/Makefile b/tests/run-make-fulldeps/link-path-order/Makefile deleted file mode 100644 index ed7c299e61a..00000000000 --- a/tests/run-make-fulldeps/link-path-order/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../tools.mk - -# Verifies that the -L arguments given to the linker is in the same order -# as the -L arguments on the rustc command line. - -CORRECT_DIR=$(TMPDIR)/correct -WRONG_DIR=$(TMPDIR)/wrong - -F := $(call NATIVE_STATICLIB_FILE,foo) - -all: $(call NATIVE_STATICLIB,correct) $(call NATIVE_STATICLIB,wrong) - mkdir -p $(CORRECT_DIR) $(WRONG_DIR) - mv $(call NATIVE_STATICLIB,correct) $(CORRECT_DIR)/$(F) - mv $(call NATIVE_STATICLIB,wrong) $(WRONG_DIR)/$(F) - $(RUSTC) main.rs -o $(TMPDIR)/should_succeed -L $(CORRECT_DIR) -L $(WRONG_DIR) - $(call RUN,should_succeed) - $(RUSTC) main.rs -o $(TMPDIR)/should_fail -L $(WRONG_DIR) -L $(CORRECT_DIR) - $(call FAIL,should_fail) diff --git a/tests/run-make-fulldeps/link-path-order/correct.c b/tests/run-make-fulldeps/link-path-order/correct.c deleted file mode 100644 index 3064af952f8..00000000000 --- a/tests/run-make-fulldeps/link-path-order/correct.c +++ /dev/null @@ -1 +0,0 @@ -int should_return_one() { return 1; } diff --git a/tests/run-make-fulldeps/link-path-order/main.rs b/tests/run-make-fulldeps/link-path-order/main.rs deleted file mode 100644 index 8024e343d19..00000000000 --- a/tests/run-make-fulldeps/link-path-order/main.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(rustc_private)] - -extern crate libc; - -#[link(name = "foo", kind = "static")] -extern "C" { - fn should_return_one() -> libc::c_int; -} - -fn main() { - let result = unsafe { should_return_one() }; - - if result != 1 { - std::process::exit(255); - } -} diff --git a/tests/run-make-fulldeps/link-path-order/wrong.c b/tests/run-make-fulldeps/link-path-order/wrong.c deleted file mode 100644 index 64275b3ad6b..00000000000 --- a/tests/run-make-fulldeps/link-path-order/wrong.c +++ /dev/null @@ -1 +0,0 @@ -int should_return_one() { return 0; } diff --git a/tests/run-make-fulldeps/linkage-attr-on-static/Makefile b/tests/run-make-fulldeps/linkage-attr-on-static/Makefile deleted file mode 100644 index 7cc54e40a3a..00000000000 --- a/tests/run-make-fulldeps/linkage-attr-on-static/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,foo) - $(RUSTC) bar.rs - $(call RUN,bar) || exit 1 diff --git a/tests/run-make-fulldeps/linkage-attr-on-static/bar.rs b/tests/run-make-fulldeps/linkage-attr-on-static/bar.rs deleted file mode 100644 index 68607cbb657..00000000000 --- a/tests/run-make-fulldeps/linkage-attr-on-static/bar.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(linkage)] - -#[no_mangle] -#[linkage = "external"] -static BAZ: i32 = 21; - -#[link(name = "foo", kind = "static")] -extern "C" { - fn what() -> i32; -} - -fn main() { - unsafe { - assert_eq!(what(), BAZ); - } -} diff --git a/tests/run-make-fulldeps/linkage-attr-on-static/foo.c b/tests/run-make-fulldeps/linkage-attr-on-static/foo.c deleted file mode 100644 index 78a6934f57f..00000000000 --- a/tests/run-make-fulldeps/linkage-attr-on-static/foo.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -extern int32_t BAZ; - -int32_t what() { - return BAZ; -} diff --git a/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/Makefile b/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/Makefile deleted file mode 100644 index a38f4fe5dc5..00000000000 --- a/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs -g - cp foo.bat $(TMPDIR)/ - OUT_DIR="$(TMPDIR)" RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo) diff --git a/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.bat b/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.bat deleted file mode 100644 index a9350f12bbb..00000000000 --- a/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.bat +++ /dev/null @@ -1 +0,0 @@ -%MY_LINKER% %* diff --git a/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.rs b/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.rs deleted file mode 100644 index 74d7b9b07f6..00000000000 --- a/tests/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.rs +++ /dev/null @@ -1,101 +0,0 @@ -// Like the `long-linker-command-lines` test this test attempts to blow -// a command line limit for running the linker. Unlike that test, however, -// this test is testing `cmd.exe` specifically rather than the OS. -// -// Unfortunately `cmd.exe` has a 8192 limit which is relatively small -// in the grand scheme of things and anyone sripting rustc's linker -// is probably using a `*.bat` script and is likely to hit this limit. -// -// This test uses a `foo.bat` script as the linker which just simply -// delegates back to this program. The compiler should use a lower -// limit for arguments before passing everything via `@`, which -// means that everything should still succeed here. - -use std::env; -use std::fs::{self, File}; -use std::io::{BufWriter, Write, Read}; -use std::path::PathBuf; -use std::process::Command; - -fn main() { - if !cfg!(windows) { - return - } - - let tmpdir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); - let ok = tmpdir.join("ok"); - let not_ok = tmpdir.join("not_ok"); - if env::var("YOU_ARE_A_LINKER").is_ok() { - match env::args_os().find(|a| a.to_string_lossy().contains("@")) { - Some(file) => { - let file = file.to_str().unwrap(); - fs::copy(&file[1..], &ok).unwrap(); - } - None => { File::create(¬_ok).unwrap(); } - } - return - } - - let rustc = env::var_os("RUSTC").unwrap_or("rustc".into()); - let me = env::current_exe().unwrap(); - let bat = me.parent() - .unwrap() - .join("foo.bat"); - let bat_linker = format!("linker={}", bat.display()); - for i in (1..).map(|i| i * 10) { - println!("attempt: {}", i); - - let file = tmpdir.join("bar.rs"); - let mut f = BufWriter::new(File::create(&file).unwrap()); - let mut lib_name = String::new(); - for _ in 0..i { - lib_name.push_str("foo"); - } - for j in 0..i { - writeln!(f, "#[link(name = \"{}{}\")]", lib_name, j).unwrap(); - } - writeln!(f, "extern {{}}\nfn main() {{}}").unwrap(); - f.into_inner().unwrap(); - - drop(fs::remove_file(&ok)); - drop(fs::remove_file(¬_ok)); - let status = Command::new(&rustc) - .arg(&file) - .arg("-C").arg(&bat_linker) - .arg("--out-dir").arg(&tmpdir) - .env("YOU_ARE_A_LINKER", "1") - .env("MY_LINKER", &me) - .status() - .unwrap(); - - if !status.success() { - panic!("rustc didn't succeed: {}", status); - } - - if !ok.exists() { - assert!(not_ok.exists()); - continue - } - - let mut contents = Vec::new(); - File::open(&ok).unwrap().read_to_end(&mut contents).unwrap(); - - for j in 0..i { - let exp = format!("{}{}", lib_name, j); - let exp = if cfg!(target_env = "msvc") { - let mut out = Vec::with_capacity(exp.len() * 2); - for c in exp.encode_utf16() { - // encode in little endian - out.push(c as u8); - out.push((c >> 8) as u8); - } - out - } else { - exp.into_bytes() - }; - assert!(contents.windows(exp.len()).any(|w| w == &exp[..])); - } - - break - } -} diff --git a/tests/run-make-fulldeps/long-linker-command-lines/Makefile b/tests/run-make-fulldeps/long-linker-command-lines/Makefile deleted file mode 100644 index 00199ca970d..00000000000 --- a/tests/run-make-fulldeps/long-linker-command-lines/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs -g -O - RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo) diff --git a/tests/run-make-fulldeps/long-linker-command-lines/foo.rs b/tests/run-make-fulldeps/long-linker-command-lines/foo.rs deleted file mode 100644 index db238c0cf1a..00000000000 --- a/tests/run-make-fulldeps/long-linker-command-lines/foo.rs +++ /dev/null @@ -1,106 +0,0 @@ -// This is a test which attempts to blow out the system limit with how many -// arguments can be passed to a process. This'll successively call rustc with -// larger and larger argument lists in an attempt to find one that's way too -// big for the system at hand. This file itself is then used as a "linker" to -// detect when the process creation succeeds. -// -// Eventually we should see an argument that looks like `@` as we switch from -// passing literal arguments to passing everything in the file. - -use std::collections::HashSet; -use std::env; -use std::fs::{self, File}; -use std::io::{BufWriter, Write}; -use std::path::{Path, PathBuf}; -use std::process::Command; - -fn write_test_case(file: &Path, n: usize) -> HashSet { - let mut libs = HashSet::new(); - let mut f = BufWriter::new(File::create(&file).unwrap()); - let mut prefix = String::new(); - for _ in 0..n { - prefix.push_str("foo"); - } - for i in 0..n { - writeln!(f, "#[link(name = \"S{}{}S\")]", prefix, i).unwrap(); - libs.insert(format!("{}{}", prefix, i)); - } - writeln!(f, "extern \"C\" {{}}\nfn main() {{}}").unwrap(); - f.into_inner().unwrap(); - - libs -} - -fn read_linker_args(path: &Path) -> String { - let contents = fs::read(path).unwrap(); - if cfg!(target_env = "msvc") { - let mut i = contents.chunks(2).map(|c| { - c[0] as u16 | ((c[1] as u16) << 8) - }); - assert_eq!(i.next(), Some(0xfeff), "Expected UTF-16 BOM"); - String::from_utf16(&i.collect::>()).unwrap() - } else { - String::from_utf8(contents).unwrap() - } -} - -fn main() { - let tmpdir = PathBuf::from(env::var_os("TMPDIR").unwrap()); - let ok = tmpdir.join("ok"); - if env::var("YOU_ARE_A_LINKER").is_ok() { - if let Some(file) = env::args_os().find(|a| a.to_string_lossy().contains("@")) { - let file = file.to_str().expect("non-utf8 file argument"); - fs::copy(&file[1..], &ok).unwrap(); - } - return - } - - let rustc = env::var_os("RUSTC").unwrap_or("rustc".into()); - let me_as_linker = format!("linker={}", env::current_exe().unwrap().display()); - for i in (1..).map(|i| i * 100) { - println!("attempt: {}", i); - let file = tmpdir.join("bar.rs"); - let mut expected_libs = write_test_case(&file, i); - - drop(fs::remove_file(&ok)); - let output = Command::new(&rustc) - .arg(&file) - .arg("-C").arg(&me_as_linker) - .arg("--out-dir").arg(&tmpdir) - .env("YOU_ARE_A_LINKER", "1") - .output() - .unwrap(); - - if !output.status.success() { - let stderr = String::from_utf8_lossy(&output.stderr); - panic!("status: {}\nstdout:\n{}\nstderr:\n{}", - output.status, - String::from_utf8_lossy(&output.stdout), - stderr.lines().map(|l| { - if l.len() > 200 { - format!("{}...\n", &l[..200]) - } else { - format!("{}\n", l) - } - }).collect::()); - } - - if !ok.exists() { - continue - } - - let linker_args = read_linker_args(&ok); - for arg in linker_args.split('S') { - expected_libs.remove(arg); - } - - assert!( - expected_libs.is_empty(), - "expected but missing libraries: {:#?}\nlinker arguments: \n{}", - expected_libs, - linker_args, - ); - - break - } -} diff --git a/tests/run-make-fulldeps/longjmp-across-rust/Makefile b/tests/run-make-fulldeps/longjmp-across-rust/Makefile deleted file mode 100644 index 848638d82dd..00000000000 --- a/tests/run-make-fulldeps/longjmp-across-rust/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,foo) - $(RUSTC) main.rs - $(call RUN,main) diff --git a/tests/run-make-fulldeps/longjmp-across-rust/foo.c b/tests/run-make-fulldeps/longjmp-across-rust/foo.c deleted file mode 100644 index bd71cc4d777..00000000000 --- a/tests/run-make-fulldeps/longjmp-across-rust/foo.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -static jmp_buf ENV; - -extern void test_middle(); - -void test_start(void(*f)()) { - if (setjmp(ENV) != 0) - return; - f(); - assert(0); -} - -void test_end() { - longjmp(ENV, 1); - assert(0); -} diff --git a/tests/run-make-fulldeps/longjmp-across-rust/main.rs b/tests/run-make-fulldeps/longjmp-across-rust/main.rs deleted file mode 100644 index cc1d5b126dd..00000000000 --- a/tests/run-make-fulldeps/longjmp-across-rust/main.rs +++ /dev/null @@ -1,29 +0,0 @@ -#[link(name = "foo", kind = "static")] -extern "C" { - fn test_start(f: extern "C" fn()); - fn test_end(); -} - -fn main() { - unsafe { - test_start(test_middle); - } -} - -struct A; - -impl Drop for A { - fn drop(&mut self) {} -} - -extern "C" fn test_middle() { - let _a = A; - foo(); -} - -fn foo() { - let _a = A; - unsafe { - test_end(); - } -} diff --git a/tests/run-make-fulldeps/ls-metadata/Makefile b/tests/run-make-fulldeps/ls-metadata/Makefile deleted file mode 100644 index e0f916a248e..00000000000 --- a/tests/run-make-fulldeps/ls-metadata/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs - $(RUSTC) -Z ls $(TMPDIR)/foo - touch $(TMPDIR)/bar - $(RUSTC) -Z ls $(TMPDIR)/bar diff --git a/tests/run-make-fulldeps/ls-metadata/foo.rs b/tests/run-make-fulldeps/ls-metadata/foo.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/ls-metadata/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/lto-dylib-dep/Makefile b/tests/run-make-fulldeps/lto-dylib-dep/Makefile deleted file mode 100644 index 41487b23c74..00000000000 --- a/tests/run-make-fulldeps/lto-dylib-dep/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -# Test that we don't run into an assertion when using a Rust dylib dependency -# while compiling with full LTO. -# See https://github.com/rust-lang/rust/issues/59137 - -all: - $(RUSTC) a_dylib.rs --crate-type=dylib -C prefer-dynamic - $(RUSTC) main.rs -C lto - $(call RUN,main) diff --git a/tests/run-make-fulldeps/lto-dylib-dep/a_dylib.rs b/tests/run-make-fulldeps/lto-dylib-dep/a_dylib.rs deleted file mode 100644 index e63457e6eb9..00000000000 --- a/tests/run-make-fulldeps/lto-dylib-dep/a_dylib.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn foo() { - println!("bar"); -} diff --git a/tests/run-make-fulldeps/lto-dylib-dep/main.rs b/tests/run-make-fulldeps/lto-dylib-dep/main.rs deleted file mode 100644 index 4fb3c4730b2..00000000000 --- a/tests/run-make-fulldeps/lto-dylib-dep/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate a_dylib; - -fn main() { - a_dylib::foo(); -} diff --git a/tests/run-make-fulldeps/lto-empty/Makefile b/tests/run-make-fulldeps/lto-empty/Makefile deleted file mode 100644 index b4345ba1883..00000000000 --- a/tests/run-make-fulldeps/lto-empty/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -all: cdylib-fat cdylib-thin - -cdylib-fat: - $(RUSTC) lib.rs -C lto=fat -C opt-level=3 -C incremental=$(TMPDIR)/inc-fat - $(RUSTC) lib.rs -C lto=fat -C opt-level=3 -C incremental=$(TMPDIR)/inc-fat - -cdylib-thin: - $(RUSTC) lib.rs -C lto=thin -C opt-level=3 -C incremental=$(TMPDIR)/inc-thin - $(RUSTC) lib.rs -C lto=thin -C opt-level=3 -C incremental=$(TMPDIR)/inc-thin - diff --git a/tests/run-make-fulldeps/lto-empty/lib.rs b/tests/run-make-fulldeps/lto-empty/lib.rs deleted file mode 100644 index e3663c79078..00000000000 --- a/tests/run-make-fulldeps/lto-empty/lib.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "cdylib"] diff --git a/tests/run-make-fulldeps/lto-no-link-whole-rlib/Makefile b/tests/run-make-fulldeps/lto-no-link-whole-rlib/Makefile deleted file mode 100644 index e576ee37cf7..00000000000 --- a/tests/run-make-fulldeps/lto-no-link-whole-rlib/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar) - $(RUSTC) lib1.rs - $(RUSTC) lib2.rs - $(RUSTC) main.rs -Clto - $(call RUN,main) - diff --git a/tests/run-make-fulldeps/lto-no-link-whole-rlib/bar.c b/tests/run-make-fulldeps/lto-no-link-whole-rlib/bar.c deleted file mode 100644 index b2501193029..00000000000 --- a/tests/run-make-fulldeps/lto-no-link-whole-rlib/bar.c +++ /dev/null @@ -1,3 +0,0 @@ -int foo() { - return 2; -} diff --git a/tests/run-make-fulldeps/lto-no-link-whole-rlib/foo.c b/tests/run-make-fulldeps/lto-no-link-whole-rlib/foo.c deleted file mode 100644 index 75010458ece..00000000000 --- a/tests/run-make-fulldeps/lto-no-link-whole-rlib/foo.c +++ /dev/null @@ -1,3 +0,0 @@ -int foo() { - return 1; -} diff --git a/tests/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs b/tests/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs deleted file mode 100644 index f70bb338223..00000000000 --- a/tests/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![crate_type = "rlib"] - -#[link(name = "foo", kind = "static")] -extern "C" { - fn foo() -> i32; -} - -pub fn foo1() -> i32 { - unsafe { foo() } -} diff --git a/tests/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs b/tests/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs deleted file mode 100644 index 2dec2a2718e..00000000000 --- a/tests/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type = "rlib"] - -extern crate lib1; - -#[link(name = "bar", kind = "static")] -extern "C" { - fn foo() -> i32; -} - -pub fn foo2() -> i32 { - unsafe { foo() } -} diff --git a/tests/run-make-fulldeps/lto-no-link-whole-rlib/main.rs b/tests/run-make-fulldeps/lto-no-link-whole-rlib/main.rs deleted file mode 100644 index 0c658808e6e..00000000000 --- a/tests/run-make-fulldeps/lto-no-link-whole-rlib/main.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern crate lib1; -extern crate lib2; - -fn main() { - assert_eq!(lib1::foo1(), 2); - assert_eq!(lib2::foo2(), 2); -} diff --git a/tests/run-make-fulldeps/lto-readonly-lib/Makefile b/tests/run-make-fulldeps/lto-readonly-lib/Makefile deleted file mode 100644 index a20ecea88ea..00000000000 --- a/tests/run-make-fulldeps/lto-readonly-lib/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) lib.rs - - # the compiler needs to copy and modify the rlib file when performing - # LTO, so we should ensure that it can cope with the original rlib - # being read-only. - chmod 444 $(TMPDIR)/*.rlib - - $(RUSTC) main.rs -C lto - $(call RUN,main) diff --git a/tests/run-make-fulldeps/lto-readonly-lib/lib.rs b/tests/run-make-fulldeps/lto-readonly-lib/lib.rs deleted file mode 100644 index c1bfaa6cab5..00000000000 --- a/tests/run-make-fulldeps/lto-readonly-lib/lib.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/lto-readonly-lib/main.rs b/tests/run-make-fulldeps/lto-readonly-lib/main.rs deleted file mode 100644 index 69da798b3eb..00000000000 --- a/tests/run-make-fulldeps/lto-readonly-lib/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate lib; - -fn main() {} diff --git a/tests/run-make-fulldeps/lto-smoke-c/Makefile b/tests/run-make-fulldeps/lto-smoke-c/Makefile deleted file mode 100644 index 7c6ee3be849..00000000000 --- a/tests/run-make-fulldeps/lto-smoke-c/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# Apparently older versions of GCC segfault if -g is passed... -CC := $(CC:-g=) - -all: - $(RUSTC) foo.rs -C lto - $(CC) bar.c $(call STATICLIB,foo) \ - $(call OUT_EXE,bar) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(call RUN,bar) diff --git a/tests/run-make-fulldeps/lto-smoke-c/bar.c b/tests/run-make-fulldeps/lto-smoke-c/bar.c deleted file mode 100644 index bb4036b06e1..00000000000 --- a/tests/run-make-fulldeps/lto-smoke-c/bar.c +++ /dev/null @@ -1,6 +0,0 @@ -void foo(); - -int main() { - foo(); - return 0; -} diff --git a/tests/run-make-fulldeps/lto-smoke-c/foo.rs b/tests/run-make-fulldeps/lto-smoke-c/foo.rs deleted file mode 100644 index 2e59432cdb1..00000000000 --- a/tests/run-make-fulldeps/lto-smoke-c/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "staticlib"] - -#[no_mangle] -pub extern "C" fn foo() {} diff --git a/tests/run-make-fulldeps/lto-smoke/Makefile b/tests/run-make-fulldeps/lto-smoke/Makefile deleted file mode 100644 index 8bce708b44b..00000000000 --- a/tests/run-make-fulldeps/lto-smoke/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -include ../tools.mk - -all: noparam bool_true bool_false thin fat - -noparam: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto - $(call RUN,main) - -bool_true: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto=yes - $(call RUN,main) - - -bool_false: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto=off - $(call RUN,main) - -thin: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto=thin - $(call RUN,main) - -fat: - $(RUSTC) lib.rs - $(RUSTC) main.rs -C lto=fat - $(call RUN,main) - diff --git a/tests/run-make-fulldeps/lto-smoke/lib.rs b/tests/run-make-fulldeps/lto-smoke/lib.rs deleted file mode 100644 index c1bfaa6cab5..00000000000 --- a/tests/run-make-fulldeps/lto-smoke/lib.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/lto-smoke/main.rs b/tests/run-make-fulldeps/lto-smoke/main.rs deleted file mode 100644 index 69da798b3eb..00000000000 --- a/tests/run-make-fulldeps/lto-smoke/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate lib; - -fn main() {} diff --git a/tests/run-make-fulldeps/manual-crate-name/Makefile b/tests/run-make-fulldeps/manual-crate-name/Makefile deleted file mode 100644 index c00e20c7c57..00000000000 --- a/tests/run-make-fulldeps/manual-crate-name/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --crate-name foo bar.rs - rm $(TMPDIR)/libfoo.rlib diff --git a/tests/run-make-fulldeps/manual-crate-name/bar.rs b/tests/run-make-fulldeps/manual-crate-name/bar.rs deleted file mode 100644 index c1bfaa6cab5..00000000000 --- a/tests/run-make-fulldeps/manual-crate-name/bar.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "rlib"] diff --git a/tests/run-make-fulldeps/manual-link/Makefile b/tests/run-make-fulldeps/manual-link/Makefile deleted file mode 100644 index 401f6eb440a..00000000000 --- a/tests/run-make-fulldeps/manual-link/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: $(TMPDIR)/libbar.a - $(RUSTC) foo.rs -lstatic=bar - $(RUSTC) main.rs - $(call RUN,main) diff --git a/tests/run-make-fulldeps/manual-link/bar.c b/tests/run-make-fulldeps/manual-link/bar.c deleted file mode 100644 index e4259998678..00000000000 --- a/tests/run-make-fulldeps/manual-link/bar.c +++ /dev/null @@ -1 +0,0 @@ -void bar() {} diff --git a/tests/run-make-fulldeps/manual-link/foo.c b/tests/run-make-fulldeps/manual-link/foo.c deleted file mode 100644 index e4259998678..00000000000 --- a/tests/run-make-fulldeps/manual-link/foo.c +++ /dev/null @@ -1 +0,0 @@ -void bar() {} diff --git a/tests/run-make-fulldeps/manual-link/foo.rs b/tests/run-make-fulldeps/manual-link/foo.rs deleted file mode 100644 index c1f28236ffd..00000000000 --- a/tests/run-make-fulldeps/manual-link/foo.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![crate_type = "rlib"] - -extern "C" { - fn bar(); -} - -pub fn foo() { - unsafe { - bar(); - } -} diff --git a/tests/run-make-fulldeps/manual-link/main.rs b/tests/run-make-fulldeps/manual-link/main.rs deleted file mode 100644 index fe35f1f8e2e..00000000000 --- a/tests/run-make-fulldeps/manual-link/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::foo(); -} diff --git a/tests/run-make-fulldeps/many-crates-but-no-match/Makefile b/tests/run-make-fulldeps/many-crates-but-no-match/Makefile deleted file mode 100644 index ca0ab8e9e5f..00000000000 --- a/tests/run-make-fulldeps/many-crates-but-no-match/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -include ../tools.mk - -# Modelled after ui/changing-crates.rs test, but this one puts -# more than one (mismatching) candidate crate into the search path, -# which did not appear directly expressible in UI testing infrastructure. -# -# Note that we move the built libraries into target direcrtories rather than -# use the `--out-dir` option because the `../tools.mk` file already bakes a -# use of `--out-dir` into the definition of $(RUSTC). - -A1=$(TMPDIR)/a1 -A2=$(TMPDIR)/a2 -A3=$(TMPDIR)/a3 - -# A hack to match distinct lines of output from a single run. -LOG=$(TMPDIR)/log.txt - -all: - mkdir -p $(A1) $(A2) $(A3) - $(RUSTC) --crate-type=rlib crateA1.rs - mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A1) - $(RUSTC) --crate-type=rlib -L $(A1) crateB.rs - $(RUSTC) --crate-type=rlib crateA2.rs - mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A2) - $(RUSTC) --crate-type=rlib crateA3.rs - mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A3) - # Ensure crateC fails to compile since A1 is "missing" and A2/A3 hashes do not match - $(RUSTC) -L $(A2) -L $(A3) crateC.rs >$(LOG) 2>&1 || true - $(CGREP) \ - 'found possibly newer version of crate `crateA` which `crateB` depends on' \ - 'note: perhaps that crate needs to be recompiled?' \ - 'crate `crateA`:' \ - 'crate `crateB`:' \ - < $(LOG) - # the 'crate `crateA`' will match two entries. diff --git a/tests/run-make-fulldeps/many-crates-but-no-match/crateA1.rs b/tests/run-make-fulldeps/many-crates-but-no-match/crateA1.rs deleted file mode 100644 index 3fed5a38e2c..00000000000 --- a/tests/run-make-fulldeps/many-crates-but-no-match/crateA1.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_name="crateA"] - -// Base crate -pub fn func() {} diff --git a/tests/run-make-fulldeps/many-crates-but-no-match/crateA2.rs b/tests/run-make-fulldeps/many-crates-but-no-match/crateA2.rs deleted file mode 100644 index 8db07a015ff..00000000000 --- a/tests/run-make-fulldeps/many-crates-but-no-match/crateA2.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_name="crateA"] - -// Base crate -pub fn func() { println!("hello"); } diff --git a/tests/run-make-fulldeps/many-crates-but-no-match/crateA3.rs b/tests/run-make-fulldeps/many-crates-but-no-match/crateA3.rs deleted file mode 100644 index a1e8e40a38c..00000000000 --- a/tests/run-make-fulldeps/many-crates-but-no-match/crateA3.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_name="crateA"] - -// Base crate -pub fn foo() { println!("world!"); } diff --git a/tests/run-make-fulldeps/many-crates-but-no-match/crateB.rs b/tests/run-make-fulldeps/many-crates-but-no-match/crateB.rs deleted file mode 100644 index 4ccd65d653e..00000000000 --- a/tests/run-make-fulldeps/many-crates-but-no-match/crateB.rs +++ /dev/null @@ -1 +0,0 @@ -extern crate crateA; diff --git a/tests/run-make-fulldeps/many-crates-but-no-match/crateC.rs b/tests/run-make-fulldeps/many-crates-but-no-match/crateC.rs deleted file mode 100644 index a8b817ec681..00000000000 --- a/tests/run-make-fulldeps/many-crates-but-no-match/crateC.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate crateB; - -fn main() {} diff --git a/tests/run-make-fulldeps/metadata-flag-frobs-symbols/Makefile b/tests/run-make-fulldeps/metadata-flag-frobs-symbols/Makefile deleted file mode 100644 index dc6b10f4e9d..00000000000 --- a/tests/run-make-fulldeps/metadata-flag-frobs-symbols/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs -C metadata=a -C extra-filename=-a - $(RUSTC) foo.rs -C metadata=b -C extra-filename=-b - $(RUSTC) bar.rs \ - --extern foo1=$(TMPDIR)/libfoo-a.rlib \ - --extern foo2=$(TMPDIR)/libfoo-b.rlib \ - --print link-args - $(call RUN,bar) diff --git a/tests/run-make-fulldeps/metadata-flag-frobs-symbols/bar.rs b/tests/run-make-fulldeps/metadata-flag-frobs-symbols/bar.rs deleted file mode 100644 index 1e6957a3694..00000000000 --- a/tests/run-make-fulldeps/metadata-flag-frobs-symbols/bar.rs +++ /dev/null @@ -1,8 +0,0 @@ -extern crate foo1; -extern crate foo2; - -fn main() { - let a = foo1::foo(); - let b = foo2::foo(); - assert!(a as *const _ != b as *const _); -} diff --git a/tests/run-make-fulldeps/metadata-flag-frobs-symbols/foo.rs b/tests/run-make-fulldeps/metadata-flag-frobs-symbols/foo.rs deleted file mode 100644 index 696aed2fa1d..00000000000 --- a/tests/run-make-fulldeps/metadata-flag-frobs-symbols/foo.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_name = "foo"] -#![crate_type = "rlib"] - -static FOO: usize = 3; - -pub fn foo() -> &'static usize { &FOO } diff --git a/tests/run-make-fulldeps/min-global-align/Makefile b/tests/run-make-fulldeps/min-global-align/Makefile deleted file mode 100644 index 82f38749e00..00000000000 --- a/tests/run-make-fulldeps/min-global-align/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../tools.mk - -# only-linux - -# This tests ensure that global variables respect the target minimum alignment. -# The three bools `STATIC_BOOL`, `STATIC_MUT_BOOL`, and `CONST_BOOL` all have -# type-alignment of 1, but some targets require greater global alignment. - -SRC = min_global_align.rs -LL = $(TMPDIR)/min_global_align.ll - -all: -# Most targets are happy with default alignment -- take i686 for example. -ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) - $(RUSTC) --target=i686-unknown-linux-gnu --emit=llvm-ir $(SRC) - [ "$$(grep -c 'align 1' "$(LL)")" -eq "3" ] -endif -# SystemZ requires even alignment for PC-relative addressing. -ifeq ($(filter systemz,$(LLVM_COMPONENTS)),systemz) - $(RUSTC) --target=s390x-unknown-linux-gnu --emit=llvm-ir $(SRC) - [ "$$(grep -c 'align 2' "$(LL)")" -eq "3" ] -endif diff --git a/tests/run-make-fulldeps/min-global-align/min_global_align.rs b/tests/run-make-fulldeps/min-global-align/min_global_align.rs deleted file mode 100644 index 135792e9372..00000000000 --- a/tests/run-make-fulldeps/min-global-align/min_global_align.rs +++ /dev/null @@ -1,32 +0,0 @@ -#![feature(no_core, lang_items)] -#![crate_type = "rlib"] -#![no_core] - -pub static STATIC_BOOL: bool = true; - -pub static mut STATIC_MUT_BOOL: bool = true; - -const CONST_BOOL: bool = true; -pub static CONST_BOOL_REF: &'static bool = &CONST_BOOL; - -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} -impl Copy for bool {} -impl Copy for &bool {} - -#[lang = "freeze"] -trait Freeze {} - -// No `UnsafeCell`, so everything is `Freeze`. -impl Freeze for T {} - -#[lang = "sync"] -trait Sync {} -impl Sync for bool {} -impl Sync for &'static bool {} - -#[lang = "drop_in_place"] -pub unsafe fn drop_in_place(_: *mut T) {} diff --git a/tests/run-make-fulldeps/mingw-export-call-convention/Makefile b/tests/run-make-fulldeps/mingw-export-call-convention/Makefile deleted file mode 100644 index 4a60059cc54..00000000000 --- a/tests/run-make-fulldeps/mingw-export-call-convention/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# only-windows-gnu - -all: - $(RUSTC) foo.rs - # FIXME: we should make sure __stdcall calling convention is used here - # but that only works with LLD right now - nm -g "$(call IMPLIB,foo)" | $(CGREP) bar diff --git a/tests/run-make-fulldeps/mingw-export-call-convention/foo.rs b/tests/run-make-fulldeps/mingw-export-call-convention/foo.rs deleted file mode 100644 index 1fec00311ef..00000000000 --- a/tests/run-make-fulldeps/mingw-export-call-convention/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "cdylib"] - -#[no_mangle] -pub extern "system" fn bar() {} diff --git a/tests/run-make-fulldeps/mismatching-target-triples/Makefile b/tests/run-make-fulldeps/mismatching-target-triples/Makefile deleted file mode 100644 index 409388e0414..00000000000 --- a/tests/run-make-fulldeps/mismatching-target-triples/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# Issue #10814 -# -# these are no_std to avoid having to have the standard library or any -# linkers/assemblers for the relevant platform - -all: - $(RUSTC) foo.rs --target=i686-unknown-linux-gnu - $(RUSTC) bar.rs --target=x86_64-unknown-linux-gnu 2>&1 \ - | $(CGREP) 'couldn'"'"'t find crate `foo` with expected target triple x86_64-unknown-linux-gnu' diff --git a/tests/run-make-fulldeps/mismatching-target-triples/bar.rs b/tests/run-make-fulldeps/mismatching-target-triples/bar.rs deleted file mode 100644 index b2c2fc1c410..00000000000 --- a/tests/run-make-fulldeps/mismatching-target-triples/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![feature(no_core)] -#![no_core] -extern crate foo; diff --git a/tests/run-make-fulldeps/mismatching-target-triples/foo.rs b/tests/run-make-fulldeps/mismatching-target-triples/foo.rs deleted file mode 100644 index 6fa05491448..00000000000 --- a/tests/run-make-fulldeps/mismatching-target-triples/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![feature(no_core)] -#![no_core] -#![crate_type = "lib"] diff --git a/tests/run-make-fulldeps/missing-crate-dependency/Makefile b/tests/run-make-fulldeps/missing-crate-dependency/Makefile deleted file mode 100644 index 7c271ab8a90..00000000000 --- a/tests/run-make-fulldeps/missing-crate-dependency/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --crate-type=rlib crateA.rs - $(RUSTC) --crate-type=rlib crateB.rs - $(call REMOVE_RLIBS,crateA) - # Ensure crateC fails to compile since dependency crateA is missing - $(RUSTC) crateC.rs 2>&1 | \ - $(CGREP) 'can'"'"'t find crate for `crateA` which `crateB` depends on' diff --git a/tests/run-make-fulldeps/missing-crate-dependency/crateA.rs b/tests/run-make-fulldeps/missing-crate-dependency/crateA.rs deleted file mode 100644 index 31433cb60b8..00000000000 --- a/tests/run-make-fulldeps/missing-crate-dependency/crateA.rs +++ /dev/null @@ -1,2 +0,0 @@ -// Base crate -pub fn func() {} diff --git a/tests/run-make-fulldeps/missing-crate-dependency/crateB.rs b/tests/run-make-fulldeps/missing-crate-dependency/crateB.rs deleted file mode 100644 index 4ccd65d653e..00000000000 --- a/tests/run-make-fulldeps/missing-crate-dependency/crateB.rs +++ /dev/null @@ -1 +0,0 @@ -extern crate crateA; diff --git a/tests/run-make-fulldeps/missing-crate-dependency/crateC.rs b/tests/run-make-fulldeps/missing-crate-dependency/crateC.rs deleted file mode 100644 index a8b817ec681..00000000000 --- a/tests/run-make-fulldeps/missing-crate-dependency/crateC.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate crateB; - -fn main() {} diff --git a/tests/run-make-fulldeps/mixing-deps/Makefile b/tests/run-make-fulldeps/mixing-deps/Makefile deleted file mode 100644 index 956e704ee16..00000000000 --- a/tests/run-make-fulldeps/mixing-deps/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) both.rs -C prefer-dynamic - $(RUSTC) dylib.rs -C prefer-dynamic - $(RUSTC) prog.rs - $(call RUN,prog) diff --git a/tests/run-make-fulldeps/mixing-deps/both.rs b/tests/run-make-fulldeps/mixing-deps/both.rs deleted file mode 100644 index 6a58187633f..00000000000 --- a/tests/run-make-fulldeps/mixing-deps/both.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] -#![crate_type = "dylib"] - -pub static foo: isize = 4; diff --git a/tests/run-make-fulldeps/mixing-deps/dylib.rs b/tests/run-make-fulldeps/mixing-deps/dylib.rs deleted file mode 100644 index 88976d5b663..00000000000 --- a/tests/run-make-fulldeps/mixing-deps/dylib.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "dylib"] -extern crate both; - -use std::mem; - -pub fn addr() -> usize { unsafe { mem::transmute(&both::foo) } } diff --git a/tests/run-make-fulldeps/mixing-deps/prog.rs b/tests/run-make-fulldeps/mixing-deps/prog.rs deleted file mode 100644 index 188981dc1a3..00000000000 --- a/tests/run-make-fulldeps/mixing-deps/prog.rs +++ /dev/null @@ -1,9 +0,0 @@ -extern crate dylib; -extern crate both; - -use std::mem; - -fn main() { - assert_eq!(unsafe { mem::transmute::<&isize, usize>(&both::foo) }, - dylib::addr()); -} diff --git a/tests/run-make-fulldeps/mixing-formats/Makefile b/tests/run-make-fulldeps/mixing-formats/Makefile deleted file mode 100644 index b27e54257f9..00000000000 --- a/tests/run-make-fulldeps/mixing-formats/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -include ../tools.mk - -# Testing various mixings of rlibs and dylibs. Makes sure that it's possible to -# link an rlib to a dylib. The dependency tree among the file looks like: -# -# foo -# / \ -# bar1 bar2 -# / \ / -# baz baz2 -# -# This is generally testing the permutations of the foo/bar1/bar2 layer against -# the baz/baz2 layer - -all: - # Building just baz - $(RUSTC) --crate-type=rlib foo.rs - $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib,rlib baz.rs -C prefer-dynamic - $(RUSTC) --crate-type=bin baz.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic - $(RUSTC) --crate-type=rlib bar1.rs - $(RUSTC) --crate-type=dylib,rlib baz.rs -C prefer-dynamic - $(RUSTC) --crate-type=bin baz.rs - rm $(TMPDIR)/* - # Building baz2 - $(RUSTC) --crate-type=rlib foo.rs - $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib baz2.rs && exit 1 || exit 0 - $(RUSTC) --crate-type=bin baz2.rs && exit 1 || exit 0 - rm $(TMPDIR)/* - $(RUSTC) --crate-type=rlib foo.rs - $(RUSTC) --crate-type=rlib bar1.rs - $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib,rlib baz2.rs - $(RUSTC) --crate-type=bin baz2.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=rlib foo.rs - $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic - $(RUSTC) --crate-type=rlib bar2.rs - $(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic - $(RUSTC) --crate-type=bin baz2.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=rlib foo.rs - $(RUSTC) --crate-type=rlib bar1.rs - $(RUSTC) --crate-type=rlib bar2.rs - $(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic - $(RUSTC) --crate-type=bin baz2.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic - $(RUSTC) --crate-type=rlib bar1.rs - $(RUSTC) --crate-type=rlib bar2.rs - $(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic - $(RUSTC) --crate-type=bin baz2.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic - $(RUSTC) --crate-type=rlib bar2.rs - $(RUSTC) --crate-type=dylib,rlib baz2.rs - $(RUSTC) --crate-type=bin baz2.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic - $(RUSTC) --crate-type=rlib bar1.rs - $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib,rlib baz2.rs - $(RUSTC) --crate-type=bin baz2.rs - rm $(TMPDIR)/* - $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic - $(RUSTC) --crate-type=dylib,rlib baz2.rs - $(RUSTC) --crate-type=bin baz2.rs diff --git a/tests/run-make-fulldeps/mixing-formats/bar1.rs b/tests/run-make-fulldeps/mixing-formats/bar1.rs deleted file mode 100644 index 49af74e1b74..00000000000 --- a/tests/run-make-fulldeps/mixing-formats/bar1.rs +++ /dev/null @@ -1 +0,0 @@ -extern crate foo; diff --git a/tests/run-make-fulldeps/mixing-formats/bar2.rs b/tests/run-make-fulldeps/mixing-formats/bar2.rs deleted file mode 100644 index 49af74e1b74..00000000000 --- a/tests/run-make-fulldeps/mixing-formats/bar2.rs +++ /dev/null @@ -1 +0,0 @@ -extern crate foo; diff --git a/tests/run-make-fulldeps/mixing-formats/baz.rs b/tests/run-make-fulldeps/mixing-formats/baz.rs deleted file mode 100644 index 99a73159ea4..00000000000 --- a/tests/run-make-fulldeps/mixing-formats/baz.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate bar1; - -fn main() {} diff --git a/tests/run-make-fulldeps/mixing-formats/baz2.rs b/tests/run-make-fulldeps/mixing-formats/baz2.rs deleted file mode 100644 index d0fab1e4cdf..00000000000 --- a/tests/run-make-fulldeps/mixing-formats/baz2.rs +++ /dev/null @@ -1,4 +0,0 @@ -extern crate bar1; -extern crate bar2; - -fn main() {} diff --git a/tests/run-make-fulldeps/mixing-formats/foo.rs b/tests/run-make-fulldeps/mixing-formats/foo.rs deleted file mode 100644 index d11c69f812a..00000000000 --- a/tests/run-make-fulldeps/mixing-formats/foo.rs +++ /dev/null @@ -1 +0,0 @@ -// intentionally empty diff --git a/tests/run-make-fulldeps/mixing-libs/Makefile b/tests/run-make-fulldeps/mixing-libs/Makefile deleted file mode 100644 index 39cc0708ca1..00000000000 --- a/tests/run-make-fulldeps/mixing-libs/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) rlib.rs - $(RUSTC) dylib.rs - $(RUSTC) rlib.rs --crate-type=dylib - $(RUSTC) dylib.rs - $(call REMOVE_DYLIBS,rlib) - $(RUSTC) prog.rs && exit 1 || exit 0 diff --git a/tests/run-make-fulldeps/mixing-libs/dylib.rs b/tests/run-make-fulldeps/mixing-libs/dylib.rs deleted file mode 100644 index 6856887501c..00000000000 --- a/tests/run-make-fulldeps/mixing-libs/dylib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "dylib"] -extern crate rlib; - -pub fn dylib() { rlib::rlib() } diff --git a/tests/run-make-fulldeps/mixing-libs/prog.rs b/tests/run-make-fulldeps/mixing-libs/prog.rs deleted file mode 100644 index 14ce5c951a7..00000000000 --- a/tests/run-make-fulldeps/mixing-libs/prog.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern crate dylib; -extern crate rlib; - -fn main() { - dylib::dylib(); - rlib::rlib(); -} diff --git a/tests/run-make-fulldeps/mixing-libs/rlib.rs b/tests/run-make-fulldeps/mixing-libs/rlib.rs deleted file mode 100644 index 96dcd16bb93..00000000000 --- a/tests/run-make-fulldeps/mixing-libs/rlib.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "rlib"] -pub fn rlib() {} diff --git a/tests/run-make-fulldeps/msvc-opt-minsize/Makefile b/tests/run-make-fulldeps/msvc-opt-minsize/Makefile deleted file mode 100644 index a5f019f244e..00000000000 --- a/tests/run-make-fulldeps/msvc-opt-minsize/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs -Copt-level=z 2>&1 - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/msvc-opt-minsize/foo.rs b/tests/run-make-fulldeps/msvc-opt-minsize/foo.rs deleted file mode 100644 index 3f5496c08ee..00000000000 --- a/tests/run-make-fulldeps/msvc-opt-minsize/foo.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![feature(test)] -extern crate test; - -fn foo(x: i32, y: i32) -> i64 { - (x + y) as i64 -} - -#[inline(never)] -fn bar() { - let _f = Box::new(0); - // This call used to trigger an LLVM bug in opt-level z where the base - // pointer gets corrupted, see issue #45034 - let y: fn(i32, i32) -> i64 = test::black_box(foo); - test::black_box(y(1, 2)); -} - -fn main() { - bar(); -} diff --git a/tests/run-make-fulldeps/multiple-emits/Makefile b/tests/run-make-fulldeps/multiple-emits/Makefile deleted file mode 100644 index d1f29764485..00000000000 --- a/tests/run-make-fulldeps/multiple-emits/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs --emit=asm,llvm-ir -o $(TMPDIR)/out 2>&1 - rm $(TMPDIR)/out.ll $(TMPDIR)/out.s - $(RUSTC) foo.rs --emit=asm,llvm-ir -o $(TMPDIR)/out2.ext 2>&1 - rm $(TMPDIR)/out2.ll $(TMPDIR)/out2.s diff --git a/tests/run-make-fulldeps/multiple-emits/foo.rs b/tests/run-make-fulldeps/multiple-emits/foo.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/multiple-emits/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/no-builtins-lto/Makefile b/tests/run-make-fulldeps/no-builtins-lto/Makefile deleted file mode 100644 index c8f05d9918b..00000000000 --- a/tests/run-make-fulldeps/no-builtins-lto/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -all: - # Compile a `#![no_builtins]` rlib crate - $(RUSTC) no_builtins.rs - # Build an executable that depends on that crate using LTO. The no_builtins crate doesn't - # participate in LTO, so its rlib must be explicitly linked into the final binary. Verify this by - # grepping the linker arguments. - $(RUSTC) main.rs -C lto --print link-args | $(CGREP) 'libno_builtins.rlib' diff --git a/tests/run-make-fulldeps/no-builtins-lto/main.rs b/tests/run-make-fulldeps/no-builtins-lto/main.rs deleted file mode 100644 index 890c999c8cc..00000000000 --- a/tests/run-make-fulldeps/no-builtins-lto/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate no_builtins; - -fn main() {} diff --git a/tests/run-make-fulldeps/no-builtins-lto/no_builtins.rs b/tests/run-make-fulldeps/no-builtins-lto/no_builtins.rs deleted file mode 100644 index 5d001031a57..00000000000 --- a/tests/run-make-fulldeps/no-builtins-lto/no_builtins.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "lib"] -#![no_builtins] diff --git a/tests/run-make-fulldeps/no-duplicate-libs/Makefile b/tests/run-make-fulldeps/no-duplicate-libs/Makefile deleted file mode 100644 index b05aff7826e..00000000000 --- a/tests/run-make-fulldeps/no-duplicate-libs/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -ifdef IS_MSVC -# FIXME(#27979) -all: -else -all: $(call STATICLIB,foo) $(call STATICLIB,bar) - $(RUSTC) main.rs - $(call RUN,main) -endif diff --git a/tests/run-make-fulldeps/no-duplicate-libs/bar.c b/tests/run-make-fulldeps/no-duplicate-libs/bar.c deleted file mode 100644 index e369526572d..00000000000 --- a/tests/run-make-fulldeps/no-duplicate-libs/bar.c +++ /dev/null @@ -1,5 +0,0 @@ -extern void foo(); - -void bar() { - foo(); -} diff --git a/tests/run-make-fulldeps/no-duplicate-libs/foo.c b/tests/run-make-fulldeps/no-duplicate-libs/foo.c deleted file mode 100644 index 85e6cd8c390..00000000000 --- a/tests/run-make-fulldeps/no-duplicate-libs/foo.c +++ /dev/null @@ -1 +0,0 @@ -void foo() {} diff --git a/tests/run-make-fulldeps/no-duplicate-libs/main.rs b/tests/run-make-fulldeps/no-duplicate-libs/main.rs deleted file mode 100644 index b25ef35ada6..00000000000 --- a/tests/run-make-fulldeps/no-duplicate-libs/main.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[link(name = "foo")] // linker should drop this library, no symbols used -#[link(name = "bar")] // symbol comes from this library -#[link(name = "foo")] // now linker picks up `foo` b/c `bar` library needs it -extern "C" { - fn bar(); -} - -fn main() { - unsafe { bar() } -} diff --git a/tests/run-make-fulldeps/no-intermediate-extras/Makefile b/tests/run-make-fulldeps/no-intermediate-extras/Makefile deleted file mode 100644 index 4116aac1b8f..00000000000 --- a/tests/run-make-fulldeps/no-intermediate-extras/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# Regression test for issue #10973 - -include ../tools.mk - -all: - $(RUSTC) --crate-type=rlib --test foo.rs - rm $(TMPDIR)/foo.bc && exit 1 || exit 0 diff --git a/tests/run-make-fulldeps/no-intermediate-extras/foo.rs b/tests/run-make-fulldeps/no-intermediate-extras/foo.rs deleted file mode 100644 index d11c69f812a..00000000000 --- a/tests/run-make-fulldeps/no-intermediate-extras/foo.rs +++ /dev/null @@ -1 +0,0 @@ -// intentionally empty diff --git a/tests/run-make-fulldeps/obey-crate-type-flag/Makefile b/tests/run-make-fulldeps/obey-crate-type-flag/Makefile deleted file mode 100644 index effcfc94cc5..00000000000 --- a/tests/run-make-fulldeps/obey-crate-type-flag/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../tools.mk - -# check that rustc builds all crate_type attributes -# delete rlib -# delete whatever dylib is made for this system -# check that rustc only builds --crate-type flags, ignoring attributes -# fail if an rlib was built -all: - $(RUSTC) test.rs - $(call REMOVE_RLIBS,test) - $(call REMOVE_DYLIBS,test) - $(RUSTC) --crate-type dylib test.rs - $(call REMOVE_RLIBS,test) && exit 1 || exit 0 diff --git a/tests/run-make-fulldeps/obey-crate-type-flag/test.rs b/tests/run-make-fulldeps/obey-crate-type-flag/test.rs deleted file mode 100644 index 8a768f9de90..00000000000 --- a/tests/run-make-fulldeps/obey-crate-type-flag/test.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "rlib"] -#![crate_type = "dylib"] diff --git a/tests/run-make-fulldeps/output-filename-conflicts-with-directory/Makefile b/tests/run-make-fulldeps/output-filename-conflicts-with-directory/Makefile deleted file mode 100644 index 45221356cd9..00000000000 --- a/tests/run-make-fulldeps/output-filename-conflicts-with-directory/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - cp foo.rs $(TMPDIR)/foo.rs - mkdir $(TMPDIR)/foo - $(RUSTC) $(TMPDIR)/foo.rs -o $(TMPDIR)/foo 2>&1 \ - | $(CGREP) -e "the generated executable for the input file \".*foo\.rs\" conflicts with the existing directory \".*foo\"" diff --git a/tests/run-make-fulldeps/output-filename-conflicts-with-directory/foo.rs b/tests/run-make-fulldeps/output-filename-conflicts-with-directory/foo.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/output-filename-conflicts-with-directory/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/output-filename-overwrites-input/Makefile b/tests/run-make-fulldeps/output-filename-overwrites-input/Makefile deleted file mode 100644 index 33069c06f5a..00000000000 --- a/tests/run-make-fulldeps/output-filename-overwrites-input/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../tools.mk - -all: - cp foo.rs $(TMPDIR)/foo - $(RUSTC) $(TMPDIR)/foo -o $(TMPDIR)/foo 2>&1 \ - | $(CGREP) -e "the input file \".*foo\" would be overwritten by the generated executable" - cp bar.rs $(TMPDIR)/bar.rlib - $(RUSTC) $(TMPDIR)/bar.rlib -o $(TMPDIR)/bar.rlib 2>&1 \ - | $(CGREP) -e "the input file \".*bar.rlib\" would be overwritten by the generated executable" - $(RUSTC) foo.rs 2>&1 && $(RUSTC) -Z ls $(TMPDIR)/foo 2>&1 - cp foo.rs $(TMPDIR)/foo.rs - $(RUSTC) $(TMPDIR)/foo.rs -o $(TMPDIR)/foo.rs 2>&1 \ - | $(CGREP) -e "the input file \".*foo.rs\" would be overwritten by the generated executable" diff --git a/tests/run-make-fulldeps/output-filename-overwrites-input/bar.rs b/tests/run-make-fulldeps/output-filename-overwrites-input/bar.rs deleted file mode 100644 index 83be6e807e0..00000000000 --- a/tests/run-make-fulldeps/output-filename-overwrites-input/bar.rs +++ /dev/null @@ -1 +0,0 @@ -#![crate_type = "lib"] diff --git a/tests/run-make-fulldeps/output-filename-overwrites-input/foo.rs b/tests/run-make-fulldeps/output-filename-overwrites-input/foo.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/output-filename-overwrites-input/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/output-type-permutations/Makefile b/tests/run-make-fulldeps/output-type-permutations/Makefile deleted file mode 100644 index 791606c643b..00000000000 --- a/tests/run-make-fulldeps/output-type-permutations/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs --crate-type=rlib,dylib,staticlib - $(call REMOVE_RLIBS,bar) - $(call REMOVE_DYLIBS,bar) - rm $(call STATICLIB,bar) - rm -f $(TMPDIR)/{lib,}bar.{dll.exp,dll.lib,pdb,dll.a} - # Check that $(TMPDIR) is empty. - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --crate-type=bin - rm $(TMPDIR)/$(call BIN,bar) - rm -f $(TMPDIR)/bar.pdb - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit=asm,llvm-ir,llvm-bc,obj,link - rm $(TMPDIR)/bar.ll - rm $(TMPDIR)/bar.bc - rm $(TMPDIR)/bar.s - rm $(TMPDIR)/bar.o - rm $(TMPDIR)/$(call BIN,bar) - rm -f $(TMPDIR)/bar.pdb - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit asm -o $(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit asm=$(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit=asm=$(TMPDIR)/foo - rm $(TMPDIR)/foo - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit llvm-bc -o $(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit llvm-bc=$(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit=llvm-bc=$(TMPDIR)/foo - rm $(TMPDIR)/foo - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit llvm-ir -o $(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit llvm-ir=$(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit=llvm-ir=$(TMPDIR)/foo - rm $(TMPDIR)/foo - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit obj -o $(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit obj=$(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --emit=obj=$(TMPDIR)/foo - rm $(TMPDIR)/foo - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit link -o $(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --emit link=$(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --emit=link=$(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - rm -f $(TMPDIR)/foo.pdb - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --crate-type=rlib -o $(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --crate-type=rlib --emit link=$(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --crate-type=rlib --emit=link=$(TMPDIR)/foo - rm $(TMPDIR)/foo - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --crate-type=dylib -o $(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --crate-type=dylib --emit link=$(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --crate-type=dylib --emit=link=$(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - rm -f $(TMPDIR)/{lib,}foo.{dll.exp,dll.lib,pdb,dll.a,exe.a} - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] || (ls -1 $(TMPDIR) && exit 1) - - $(RUSTC) foo.rs --crate-type=staticlib -o $(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --crate-type=staticlib --emit link=$(TMPDIR)/foo - rm $(TMPDIR)/foo - $(RUSTC) foo.rs --crate-type=staticlib --emit=link=$(TMPDIR)/foo - rm $(TMPDIR)/foo - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --crate-type=bin -o $(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --crate-type=bin --emit link=$(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - $(RUSTC) foo.rs --crate-type=bin --emit=link=$(TMPDIR)/$(call BIN,foo) - rm $(TMPDIR)/$(call BIN,foo) - rm -f $(TMPDIR)/foo.pdb - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit llvm-ir=$(TMPDIR)/ir \ - --emit link \ - --crate-type=rlib - rm $(TMPDIR)/ir - rm $(TMPDIR)/libbar.rlib - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit asm=$(TMPDIR)/asm \ - --emit llvm-ir=$(TMPDIR)/ir \ - --emit llvm-bc=$(TMPDIR)/bc \ - --emit obj=$(TMPDIR)/obj \ - --emit link=$(TMPDIR)/link \ - --crate-type=staticlib - rm $(TMPDIR)/asm - rm $(TMPDIR)/ir - rm $(TMPDIR)/bc - rm $(TMPDIR)/obj - rm $(TMPDIR)/link - $(RUSTC) foo.rs --emit=asm=$(TMPDIR)/asm \ - --emit llvm-ir=$(TMPDIR)/ir \ - --emit=llvm-bc=$(TMPDIR)/bc \ - --emit obj=$(TMPDIR)/obj \ - --emit=link=$(TMPDIR)/link \ - --crate-type=staticlib - rm $(TMPDIR)/asm - rm $(TMPDIR)/ir - rm $(TMPDIR)/bc - rm $(TMPDIR)/obj - rm $(TMPDIR)/link - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] - - $(RUSTC) foo.rs --emit=asm,llvm-ir,llvm-bc,obj,link --crate-type=staticlib - rm $(TMPDIR)/bar.ll - rm $(TMPDIR)/bar.s - rm $(TMPDIR)/bar.o - rm $(call STATICLIB,bar) - mv $(TMPDIR)/bar.bc $(TMPDIR)/foo.bc - # Don't check that the $(TMPDIR) is empty - we left `foo.bc` for later - # comparison. - - $(RUSTC) foo.rs --emit=llvm-bc,link --crate-type=rlib - cmp $(TMPDIR)/foo.bc $(TMPDIR)/bar.bc - rm $(TMPDIR)/bar.bc - rm $(TMPDIR)/foo.bc - $(call REMOVE_RLIBS,bar) - [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] diff --git a/tests/run-make-fulldeps/output-type-permutations/foo.rs b/tests/run-make-fulldeps/output-type-permutations/foo.rs deleted file mode 100644 index f0a2cc6ad75..00000000000 --- a/tests/run-make-fulldeps/output-type-permutations/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_name = "bar"] - -fn main() {} diff --git a/tests/run-make-fulldeps/output-with-hyphens/Makefile b/tests/run-make-fulldeps/output-with-hyphens/Makefile deleted file mode 100644 index 365fb6e591a..00000000000 --- a/tests/run-make-fulldeps/output-with-hyphens/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo-bar.rs --crate-type bin - [ -f $(TMPDIR)/$(call BIN,foo-bar) ] - $(RUSTC) foo-bar.rs --crate-type lib - [ -f $(TMPDIR)/libfoo_bar.rlib ] diff --git a/tests/run-make-fulldeps/output-with-hyphens/foo-bar.rs b/tests/run-make-fulldeps/output-with-hyphens/foo-bar.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/output-with-hyphens/foo-bar.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/override-aliased-flags/Makefile b/tests/run-make-fulldeps/override-aliased-flags/Makefile deleted file mode 100644 index 186b8c7c85e..00000000000 --- a/tests/run-make-fulldeps/override-aliased-flags/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../tools.mk - -# FIXME: it would be good to check that it's actually the rightmost flags -# that are used when multiple flags are specified, but I can't think of a -# reliable way to check this. - -all: - # Test that `-O` and `-C opt-level` can be specified multiple times. - # The rightmost flag will be used over any previous flags. - $(RUSTC) -O -O main.rs - $(RUSTC) -O -C opt-level=0 main.rs - $(RUSTC) -C opt-level=0 -O main.rs - $(RUSTC) -C opt-level=0 -C opt-level=2 main.rs - $(RUSTC) -C opt-level=2 -C opt-level=0 main.rs - - # Test that `-g` and `-C debuginfo` can be specified multiple times. - # The rightmost flag will be used over any previous flags. - $(RUSTC) -g -g main.rs - $(RUSTC) -g -C debuginfo=0 main.rs - $(RUSTC) -C debuginfo=0 -g main.rs - $(RUSTC) -C debuginfo=0 -C debuginfo=2 main.rs - $(RUSTC) -C debuginfo=2 -C debuginfo=0 main.rs diff --git a/tests/run-make-fulldeps/override-aliased-flags/main.rs b/tests/run-make-fulldeps/override-aliased-flags/main.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/override-aliased-flags/main.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/panic-impl-transitive/Makefile b/tests/run-make-fulldeps/panic-impl-transitive/Makefile deleted file mode 100644 index c3192efcb5a..00000000000 --- a/tests/run-make-fulldeps/panic-impl-transitive/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../../run-make-fulldeps/tools.mk - -# NOTE we use --emit=llvm-ir to avoid running the linker (linking will fail because there's no main -# in this crate) -all: - $(RUSTC) panic-impl-provider.rs - $(RUSTC) panic-impl-consumer.rs -C panic=abort --emit=llvm-ir -L $(TMPDIR) diff --git a/tests/run-make-fulldeps/panic-impl-transitive/panic-impl-consumer.rs b/tests/run-make-fulldeps/panic-impl-transitive/panic-impl-consumer.rs deleted file mode 100644 index 82a98b12d04..00000000000 --- a/tests/run-make-fulldeps/panic-impl-transitive/panic-impl-consumer.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![no_std] -#![no_main] - -// this crate provides the `panic_impl` lang item so we don't need to define it here -extern crate panic_impl_provider; diff --git a/tests/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs b/tests/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs deleted file mode 100644 index f1b9873c83a..00000000000 --- a/tests/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_type = "rlib"] -#![no_std] - -use core::panic::PanicInfo; - -#[panic_handler] -fn panic(info: &PanicInfo) -> ! { - loop {} -} diff --git a/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/Makefile b/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/Makefile deleted file mode 100644 index 42d3c977f75..00000000000 --- a/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) nonclike.rs -L$(TMPDIR) -ltest - $(call RUN,nonclike) diff --git a/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/nonclike.rs b/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/nonclike.rs deleted file mode 100644 index 517286a868d..00000000000 --- a/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/nonclike.rs +++ /dev/null @@ -1,21 +0,0 @@ -#[repr(C, u8)] -pub enum TT { - AA(u64, u64), - BB, -} - -#[repr(C,u8)] -pub enum T { - A(u64), - B, -} - -extern "C" { - pub fn t_add(a: T, b: T) -> u64; - pub fn tt_add(a: TT, b: TT) -> u64; -} - -fn main() { - assert_eq!(33, unsafe { tt_add(TT::AA(1,2), TT::AA(10,20)) }); - assert_eq!(11, unsafe { t_add(T::A(1), T::A(10)) }); -} diff --git a/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/test.c b/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/test.c deleted file mode 100644 index 99511b2530f..00000000000 --- a/tests/run-make-fulldeps/pass-non-c-like-enum-to-c/test.c +++ /dev/null @@ -1,85 +0,0 @@ -#include - -/* This is the code generated by cbindgen 0.12.1 for the `enum TT` - * type in nonclike.rs . */ -enum TT_Tag { - AA, - BB, -}; -typedef uint8_t TT_Tag; - -typedef struct { - uint64_t _0; - uint64_t _1; -} AA_Body; - -typedef struct { - TT_Tag tag; - union { - AA_Body aa; - }; -} TT; - -/* This is the code generated by cbindgen 0.12.1 for the `enum T` type - * in nonclike.rs . */ -enum T_Tag { - A, - B, -}; -typedef uint8_t T_Tag; - -typedef struct { - uint64_t _0; -} A_Body; - -typedef struct { - T_Tag tag; - union { - A_Body a; - }; -} T; - -uint64_t tt_add(TT a, TT b) { - if (a.tag == AA && b.tag == AA) { - return a.aa._0 + a.aa._1 + b.aa._0 + b.aa._1; - } else if (a.tag == AA) { - return a.aa._0 + a.aa._1; - } else if (b.tag == BB) { - return b.aa._0 + b.aa._1; - } else { - return 0; - } -} - -uint64_t t_add(T a, T b) { - if (a.tag == A && b.tag == A) { - return a.a._0 + b.a._0; - } else if (a.tag == AA) { - return a.a._0; - } else if (b.tag == BB) { - return b.a._0; - } else { - return 0; - } -} - -TT tt_new(uint64_t a, uint64_t b) { - TT tt = { - .tag = AA, - .aa = { - ._0 = a, - ._1 = b, - }, - }; - return tt; -} - -T t_new(uint64_t a) { - T t = { - .tag = A, - .a = { - ._0 = a, - }, - }; - return t; -} diff --git a/tests/run-make-fulldeps/pgo-branch-weights/Makefile b/tests/run-make-fulldeps/pgo-branch-weights/Makefile deleted file mode 100644 index c60206a1f34..00000000000 --- a/tests/run-make-fulldeps/pgo-branch-weights/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# needs-profiler-support -# ignore-windows-gnu - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -include ../tools.mk - -# For some very small programs GNU ld seems to not properly handle -# instrumentation sections correctly. Neither Gold nor LLD have that problem. -ifeq ($(UNAME),Linux) -ifneq (,$(findstring x86,$(TARGET))) -COMMON_FLAGS=-Clink-args=-fuse-ld=gold -endif -endif - - -all: - # We don't compile `opaque` with either optimizations or instrumentation. - $(RUSTC) $(COMMON_FLAGS) opaque.rs || exit 1 - # Compile the test program with instrumentation - mkdir -p "$(TMPDIR)/prof_data_dir" || exit 1 - $(RUSTC) $(COMMON_FLAGS) interesting.rs \ - -Cprofile-generate="$(TMPDIR)/prof_data_dir" -O -Ccodegen-units=1 || exit 1 - $(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)/prof_data_dir" -O || exit 1 - # The argument below generates to the expected branch weights - $(call RUN,main aaaaaaaaaaaa2bbbbbbbbbbbb2bbbbbbbbbbbbbbbbcc) || exit 1 - "$(LLVM_BIN_DIR)/llvm-profdata" merge \ - -o "$(TMPDIR)/prof_data_dir/merged.profdata" \ - "$(TMPDIR)/prof_data_dir" || exit 1 - $(RUSTC) $(COMMON_FLAGS) interesting.rs \ - -Cprofile-use="$(TMPDIR)/prof_data_dir/merged.profdata" -O \ - -Ccodegen-units=1 --emit=llvm-ir || exit 1 - cat "$(TMPDIR)/interesting.ll" | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/tests/run-make-fulldeps/pgo-branch-weights/filecheck-patterns.txt b/tests/run-make-fulldeps/pgo-branch-weights/filecheck-patterns.txt deleted file mode 100644 index 70d5a645c14..00000000000 --- a/tests/run-make-fulldeps/pgo-branch-weights/filecheck-patterns.txt +++ /dev/null @@ -1,24 +0,0 @@ - -# First, establish that certain !prof labels are attached to the expected -# functions and branching instructions. - -CHECK: define void @function_called_twice(i32 {{.*}} !prof [[function_called_twice_id:![0-9]+]] { -CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}, !prof [[branch_weights0:![0-9]+]] - -CHECK: define void @function_called_42_times(i32{{.*}} %c) {{.*}} !prof [[function_called_42_times_id:![0-9]+]] { -CHECK: switch i32 %c, label {{.*}} [ -CHECK-NEXT: i32 97, label {{.*}} -CHECK-NEXT: i32 98, label {{.*}} -CHECK-NEXT: ], !prof [[branch_weights1:![0-9]+]] - -CHECK: define void @function_called_never(i32 {{.*}} !prof [[function_called_never_id:![0-9]+]] { - - - -# Now check that those !prof tags hold the expected counts - -CHECK: [[function_called_twice_id]] = !{!"function_entry_count", i64 2} -CHECK: [[branch_weights0]] = !{!"branch_weights", i32 2, i32 0} -CHECK: [[function_called_42_times_id]] = !{!"function_entry_count", i64 42} -CHECK: [[branch_weights1]] = !{!"branch_weights", i32 2, i32 12, i32 28} -CHECK: [[function_called_never_id]] = !{!"function_entry_count", i64 0} diff --git a/tests/run-make-fulldeps/pgo-branch-weights/interesting.rs b/tests/run-make-fulldeps/pgo-branch-weights/interesting.rs deleted file mode 100644 index a26d6fd69d1..00000000000 --- a/tests/run-make-fulldeps/pgo-branch-weights/interesting.rs +++ /dev/null @@ -1,40 +0,0 @@ -#![crate_name="interesting"] -#![crate_type="rlib"] - -extern crate opaque; - -#[no_mangle] -#[inline(never)] -pub fn function_called_twice(c: char) { - if c == '2' { - // This branch is taken twice - opaque::f1(); - } else { - // This branch is never taken - opaque::f2(); - } -} - -#[no_mangle] -#[inline(never)] -pub fn function_called_42_times(c: char) { - if c == 'a' { - // This branch is taken 12 times - opaque::f1(); - } else { - - if c == 'b' { - // This branch is taken 28 times - opaque::f2(); - } else { - // This branch is taken 2 times - opaque::f3(); - } - } -} - -#[no_mangle] -#[inline(never)] -pub fn function_called_never(_: char) { - opaque::f1(); -} diff --git a/tests/run-make-fulldeps/pgo-branch-weights/main.rs b/tests/run-make-fulldeps/pgo-branch-weights/main.rs deleted file mode 100644 index 619cf9c698c..00000000000 --- a/tests/run-make-fulldeps/pgo-branch-weights/main.rs +++ /dev/null @@ -1,17 +0,0 @@ -extern crate interesting; - -fn main() { - let arg = std::env::args().skip(1).next().unwrap(); - - for c in arg.chars() { - if c == '2' { - interesting::function_called_twice(c); - } else { - interesting::function_called_42_times(c); - } - - if c == '0' { - interesting::function_called_never(c); - } - } -} diff --git a/tests/run-make-fulldeps/pgo-branch-weights/opaque.rs b/tests/run-make-fulldeps/pgo-branch-weights/opaque.rs deleted file mode 100644 index 72f93c9feab..00000000000 --- a/tests/run-make-fulldeps/pgo-branch-weights/opaque.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_name="opaque"] -#![crate_type="rlib"] - -pub fn f1() {} -pub fn f2() {} -pub fn f3() {} diff --git a/tests/run-make-fulldeps/pgo-gen-lto/Makefile b/tests/run-make-fulldeps/pgo-gen-lto/Makefile deleted file mode 100644 index 3f2f6a838b5..00000000000 --- a/tests/run-make-fulldeps/pgo-gen-lto/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# needs-profiler-support -# ignore-windows-gnu - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -include ../tools.mk - -COMPILE_FLAGS=-Copt-level=3 -Clto=fat -Cprofile-generate="$(TMPDIR)" - -all: - $(RUSTC) $(COMPILE_FLAGS) test.rs - $(call RUN,test) || exit 1 - [ -e "$(TMPDIR)"/default_*.profraw ] || (echo "No .profraw file"; exit 1) diff --git a/tests/run-make-fulldeps/pgo-gen-lto/test.rs b/tests/run-make-fulldeps/pgo-gen-lto/test.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/pgo-gen-lto/test.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/pgo-gen-no-imp-symbols/Makefile b/tests/run-make-fulldeps/pgo-gen-no-imp-symbols/Makefile deleted file mode 100644 index 7f72b11b611..00000000000 --- a/tests/run-make-fulldeps/pgo-gen-no-imp-symbols/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# needs-profiler-support - -include ../tools.mk - -COMPILE_FLAGS=-O -Ccodegen-units=1 -Cprofile-generate="$(TMPDIR)" - -all: - $(RUSTC) $(COMPILE_FLAGS) --emit=llvm-ir test.rs - # We expect symbols starting with "__llvm_profile_". - $(CGREP) "__llvm_profile_" < $(TMPDIR)/test.ll - # We do NOT expect the "__imp_" version of these symbols. - $(CGREP) -v "__imp___llvm_profile_" < $(TMPDIR)/test.ll # 64 bit - $(CGREP) -v "__imp____llvm_profile_" < $(TMPDIR)/test.ll # 32 bit diff --git a/tests/run-make-fulldeps/pgo-gen-no-imp-symbols/test.rs b/tests/run-make-fulldeps/pgo-gen-no-imp-symbols/test.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/pgo-gen-no-imp-symbols/test.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/pgo-gen/Makefile b/tests/run-make-fulldeps/pgo-gen/Makefile deleted file mode 100644 index 4623a74957b..00000000000 --- a/tests/run-make-fulldeps/pgo-gen/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# needs-profiler-support -# ignore-windows-gnu - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -include ../tools.mk - -COMPILE_FLAGS=-g -Cprofile-generate="$(TMPDIR)" - -all: - $(RUSTC) $(COMPILE_FLAGS) test.rs - $(call RUN,test) || exit 1 - [ -e "$(TMPDIR)"/default_*.profraw ] || (echo "No .profraw file"; exit 1) diff --git a/tests/run-make-fulldeps/pgo-gen/test.rs b/tests/run-make-fulldeps/pgo-gen/test.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/pgo-gen/test.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/pgo-indirect-call-promotion/Makefile b/tests/run-make-fulldeps/pgo-indirect-call-promotion/Makefile deleted file mode 100644 index 45302215cc6..00000000000 --- a/tests/run-make-fulldeps/pgo-indirect-call-promotion/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# needs-profiler-support -# ignore-windows-gnu - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -include ../tools.mk - -all: - # We don't compile `opaque` with either optimizations or instrumentation. - # We don't compile `opaque` with either optimizations or instrumentation. - $(RUSTC) $(COMMON_FLAGS) opaque.rs - # Compile the test program with instrumentation - mkdir -p "$(TMPDIR)"/prof_data_dir - $(RUSTC) $(COMMON_FLAGS) interesting.rs \ - -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O -Ccodegen-units=1 - $(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O - # The argument below generates to the expected branch weights - $(call RUN,main) || exit 1 - "$(LLVM_BIN_DIR)"/llvm-profdata merge \ - -o "$(TMPDIR)"/prof_data_dir/merged.profdata \ - "$(TMPDIR)"/prof_data_dir - $(RUSTC) $(COMMON_FLAGS) interesting.rs \ - -Cprofile-use="$(TMPDIR)"/prof_data_dir/merged.profdata -O \ - -Ccodegen-units=1 --emit=llvm-ir - cat "$(TMPDIR)"/interesting.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/tests/run-make-fulldeps/pgo-indirect-call-promotion/filecheck-patterns.txt b/tests/run-make-fulldeps/pgo-indirect-call-promotion/filecheck-patterns.txt deleted file mode 100644 index e19c78350e9..00000000000 --- a/tests/run-make-fulldeps/pgo-indirect-call-promotion/filecheck-patterns.txt +++ /dev/null @@ -1,16 +0,0 @@ -CHECK: define void @call_a_bunch_of_functions({{.*}} { - -# Make sure that indirect call promotion inserted a check against the most -# frequently called function. -CHECK: %{{.*}} = icmp eq {{void \(\)\*|ptr}} %{{.*}}, @function_called_always - -# Check that the call to `function_called_always` was inlined, so that we -# directly call `opaque_f1` from the upstream crate. -CHECK: call void @opaque_f1() - - -# Same checks as above, repeated for the trait object case - -CHECK: define void @call_a_bunch_of_trait_methods({{.*}} -CHECK: %{{.*}} = icmp eq {{void \(\{\}\*\)\*|ptr}} %{{.*}}, {{.*}}@foo -CHECK: tail call void @opaque_f2() diff --git a/tests/run-make-fulldeps/pgo-indirect-call-promotion/interesting.rs b/tests/run-make-fulldeps/pgo-indirect-call-promotion/interesting.rs deleted file mode 100644 index 4fd096d626d..00000000000 --- a/tests/run-make-fulldeps/pgo-indirect-call-promotion/interesting.rs +++ /dev/null @@ -1,56 +0,0 @@ -#![crate_name="interesting"] -#![crate_type="rlib"] - -extern crate opaque; - -#[no_mangle] -pub fn function_called_always() { - opaque::opaque_f1(); -} - -#[no_mangle] -pub fn function_called_never() { - opaque::opaque_f2(); -} - -#[no_mangle] -pub fn call_a_bunch_of_functions(fns: &[fn()]) { - - // Indirect call promotion transforms the below into something like - // - // for f in fns { - // if f == function_called_always { - // function_called_always() - // } else { - // f(); - // } - // } - // - // where `function_called_always` actually gets inlined too. - - for f in fns { - f(); - } -} - - -pub trait Foo { - fn foo(&self); -} - -impl Foo for u32 { - - #[no_mangle] - fn foo(&self) { - opaque::opaque_f2(); - } -} - -#[no_mangle] -pub fn call_a_bunch_of_trait_methods(trait_objects: &[&dyn Foo]) { - - // Same as above, just with vtables in between - for x in trait_objects { - x.foo(); - } -} diff --git a/tests/run-make-fulldeps/pgo-indirect-call-promotion/main.rs b/tests/run-make-fulldeps/pgo-indirect-call-promotion/main.rs deleted file mode 100644 index 27181f30710..00000000000 --- a/tests/run-make-fulldeps/pgo-indirect-call-promotion/main.rs +++ /dev/null @@ -1,14 +0,0 @@ -extern crate interesting; - -fn main() { - // function pointer case - let fns: Vec<_> = std::iter::repeat(interesting::function_called_always as fn()) - .take(1000) - .collect(); - interesting::call_a_bunch_of_functions(&fns[..]); - - // Trait object case - let trait_objects = vec![0u32; 1000]; - let trait_objects: Vec<_> = trait_objects.iter().map(|x| x as &dyn interesting::Foo).collect(); - interesting::call_a_bunch_of_trait_methods(&trait_objects[..]); -} diff --git a/tests/run-make-fulldeps/pgo-indirect-call-promotion/opaque.rs b/tests/run-make-fulldeps/pgo-indirect-call-promotion/opaque.rs deleted file mode 100644 index 9628d711c50..00000000000 --- a/tests/run-make-fulldeps/pgo-indirect-call-promotion/opaque.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_name="opaque"] -#![crate_type="rlib"] - -#[no_mangle] -pub fn opaque_f1() {} -#[no_mangle] -pub fn opaque_f2() {} diff --git a/tests/run-make-fulldeps/pgo-use/Makefile b/tests/run-make-fulldeps/pgo-use/Makefile deleted file mode 100644 index 3bac9b77aa3..00000000000 --- a/tests/run-make-fulldeps/pgo-use/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# needs-profiler-support -# ignore-windows-gnu - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -include ../tools.mk - -# This test makes sure that PGO profiling data leads to cold functions being -# marked as `cold` and hot functions with `inlinehint`. -# The test program contains an `if` were actual execution only ever takes the -# `else` branch. Accordingly, we expect the function that is never called to -# be marked as cold. -# -# Disable the pre-inlining pass (i.e. a pass that does some inlining before -# it adds the profiling instrumentation). Disabling this pass leads to -# rather predictable IR which we need for this test to be stable. - -COMMON_FLAGS=-Copt-level=2 -Ccodegen-units=1 -Cllvm-args=-disable-preinline - -ifeq ($(UNAME),Darwin) -# macOS does not have the `tac` command, but `tail -r` does the same thing -TAC := tail -r -else -# some other platforms don't support the `-r` flag for `tail`, so use `tac` -TAC := tac -endif - -all: - # Compile the test program with instrumentation - $(RUSTC) $(COMMON_FLAGS) -Cprofile-generate="$(TMPDIR)" main.rs - # Run it in order to generate some profiling data - $(call RUN,main some-argument) || exit 1 - # Postprocess the profiling data so it can be used by the compiler - "$(LLVM_BIN_DIR)"/llvm-profdata merge \ - -o "$(TMPDIR)"/merged.profdata \ - "$(TMPDIR)"/default_*.profraw - # Compile the test program again, making use of the profiling data - $(RUSTC) $(COMMON_FLAGS) -Cprofile-use="$(TMPDIR)"/merged.profdata --emit=llvm-ir main.rs - # Check that the generate IR contains some things that we expect - # - # We feed the file into LLVM FileCheck tool *in reverse* so that we see the - # line with the function name before the line with the function attributes. - # FileCheck only supports checking that something matches on the next line, - # but not if something matches on the previous line. - $(TAC) "$(TMPDIR)"/main.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/tests/run-make-fulldeps/pgo-use/filecheck-patterns.txt b/tests/run-make-fulldeps/pgo-use/filecheck-patterns.txt deleted file mode 100644 index 6da34f88f2a..00000000000 --- a/tests/run-make-fulldeps/pgo-use/filecheck-patterns.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Add a check that the IR contains some expected metadata -CHECK: !{!"ProfileFormat", !"InstrProf"} -CHECK: !"ProfileSummary" - -# Make sure that the hot function is marked with `inlinehint` -CHECK: define {{.*}} @hot_function -CHECK-NEXT: Function Attrs:{{.*}}inlinehint - -# Make sure that the cold function is marked with `cold` -CHECK: define {{.*}} @cold_function -CHECK-NEXT: Function Attrs:{{.*}}cold diff --git a/tests/run-make-fulldeps/pgo-use/main.rs b/tests/run-make-fulldeps/pgo-use/main.rs deleted file mode 100644 index eb9192c87e6..00000000000 --- a/tests/run-make-fulldeps/pgo-use/main.rs +++ /dev/null @@ -1,23 +0,0 @@ -#[no_mangle] -pub fn cold_function(c: u8) { - println!("cold {}", c); -} - -#[no_mangle] -pub fn hot_function(c: u8) { - std::env::set_var(format!("var{}", c), format!("hot {}", c)); -} - -fn main() { - let arg = std::env::args().skip(1).next().unwrap(); - - for i in 0 .. 1000_000 { - let some_value = arg.as_bytes()[i % arg.len()]; - if some_value == b'!' { - // This branch is never taken at runtime - cold_function(some_value); - } else { - hot_function(some_value); - } - } -} diff --git a/tests/run-make-fulldeps/pointer-auth-link-with-c/Makefile b/tests/run-make-fulldeps/pointer-auth-link-with-c/Makefile deleted file mode 100644 index 7acea03802c..00000000000 --- a/tests/run-make-fulldeps/pointer-auth-link-with-c/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -include ../tools.mk - -# only-aarch64 - -all: - $(COMPILE_OBJ) $(TMPDIR)/test.o test.c - $(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o - $(RUSTC) -Z branch-protection=bti,pac-ret,leaf test.rs - $(call RUN,test) - - $(COMPILE_OBJ) $(TMPDIR)/test.o test.c -mbranch-protection=bti+pac-ret+leaf - $(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o - $(RUSTC) -Z branch-protection=bti,pac-ret,leaf test.rs - $(call RUN,test) diff --git a/tests/run-make-fulldeps/pointer-auth-link-with-c/test.c b/tests/run-make-fulldeps/pointer-auth-link-with-c/test.c deleted file mode 100644 index 9fe07f82f9e..00000000000 --- a/tests/run-make-fulldeps/pointer-auth-link-with-c/test.c +++ /dev/null @@ -1 +0,0 @@ -int foo() { return 0; } diff --git a/tests/run-make-fulldeps/pointer-auth-link-with-c/test.rs b/tests/run-make-fulldeps/pointer-auth-link-with-c/test.rs deleted file mode 100644 index 615ad0aeb3d..00000000000 --- a/tests/run-make-fulldeps/pointer-auth-link-with-c/test.rs +++ /dev/null @@ -1,8 +0,0 @@ -#[link(name = "test")] -extern "C" { - fn foo() -> i32; -} - -fn main() { - unsafe {foo();} -} diff --git a/tests/run-make-fulldeps/prefer-dylib/Makefile b/tests/run-make-fulldeps/prefer-dylib/Makefile deleted file mode 100644 index 3817ca195eb..00000000000 --- a/tests/run-make-fulldeps/prefer-dylib/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) bar.rs --crate-type=dylib --crate-type=rlib -C prefer-dynamic - $(RUSTC) foo.rs -C prefer-dynamic - $(call RUN,foo) - rm $(TMPDIR)/*bar* - $(call FAIL,foo) diff --git a/tests/run-make-fulldeps/prefer-dylib/bar.rs b/tests/run-make-fulldeps/prefer-dylib/bar.rs deleted file mode 100644 index c5c0bc606cd..00000000000 --- a/tests/run-make-fulldeps/prefer-dylib/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/prefer-dylib/foo.rs b/tests/run-make-fulldeps/prefer-dylib/foo.rs deleted file mode 100644 index 8d68535e3b6..00000000000 --- a/tests/run-make-fulldeps/prefer-dylib/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate bar; - -fn main() { - bar::bar(); -} diff --git a/tests/run-make-fulldeps/prefer-rlib/Makefile b/tests/run-make-fulldeps/prefer-rlib/Makefile deleted file mode 100644 index adc345d760d..00000000000 --- a/tests/run-make-fulldeps/prefer-rlib/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) bar.rs --crate-type=dylib --crate-type=rlib - ls $(TMPDIR)/$(call RLIB_GLOB,bar) - $(RUSTC) foo.rs - rm $(TMPDIR)/*bar* - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/prefer-rlib/bar.rs b/tests/run-make-fulldeps/prefer-rlib/bar.rs deleted file mode 100644 index c5c0bc606cd..00000000000 --- a/tests/run-make-fulldeps/prefer-rlib/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/prefer-rlib/foo.rs b/tests/run-make-fulldeps/prefer-rlib/foo.rs deleted file mode 100644 index 8d68535e3b6..00000000000 --- a/tests/run-make-fulldeps/prefer-rlib/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate bar; - -fn main() { - bar::bar(); -} diff --git a/tests/run-make-fulldeps/pretty-print-to-file/Makefile b/tests/run-make-fulldeps/pretty-print-to-file/Makefile deleted file mode 100644 index ca11b8c47f0..00000000000 --- a/tests/run-make-fulldeps/pretty-print-to-file/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) -o $(TMPDIR)/input.out -Zunpretty=normal input.rs - diff -u $(TMPDIR)/input.out input.pp diff --git a/tests/run-make-fulldeps/pretty-print-to-file/input.pp b/tests/run-make-fulldeps/pretty-print-to-file/input.pp deleted file mode 100644 index e3f03242a6e..00000000000 --- a/tests/run-make-fulldeps/pretty-print-to-file/input.pp +++ /dev/null @@ -1,3 +0,0 @@ - -#[crate_type = "lib"] -pub fn foo() -> i32 { 45 } diff --git a/tests/run-make-fulldeps/pretty-print-to-file/input.rs b/tests/run-make-fulldeps/pretty-print-to-file/input.rs deleted file mode 100644 index aa828155b20..00000000000 --- a/tests/run-make-fulldeps/pretty-print-to-file/input.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[crate_type="lib"] - -pub fn -foo() -> i32 -{ 45 } diff --git a/tests/run-make-fulldeps/print-calling-conventions/Makefile b/tests/run-make-fulldeps/print-calling-conventions/Makefile deleted file mode 100644 index d3fd06392b0..00000000000 --- a/tests/run-make-fulldeps/print-calling-conventions/Makefile +++ /dev/null @@ -1,4 +0,0 @@ --include ../tools.mk - -all: - $(RUSTC) --print calling-conventions diff --git a/tests/run-make-fulldeps/print-cfg/Makefile b/tests/run-make-fulldeps/print-cfg/Makefile deleted file mode 100644 index 126f5768c90..00000000000 --- a/tests/run-make-fulldeps/print-cfg/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# needs-llvm-components: x86 arm - -include ../tools.mk - -all: default - $(RUSTC) --target x86_64-pc-windows-gnu --print cfg | $(CGREP) windows - $(RUSTC) --target x86_64-pc-windows-gnu --print cfg | $(CGREP) x86_64 - $(RUSTC) --target i686-pc-windows-msvc --print cfg | $(CGREP) msvc - $(RUSTC) --target i686-apple-darwin --print cfg | $(CGREP) macos - $(RUSTC) --target i686-unknown-linux-gnu --print cfg | $(CGREP) gnu - $(RUSTC) --target arm-unknown-linux-gnueabihf --print cfg | $(CGREP) target_abi= - $(RUSTC) --target arm-unknown-linux-gnueabihf --print cfg | $(CGREP) eabihf - -ifdef IS_WINDOWS -default: - $(RUSTC) --print cfg | $(CGREP) windows -else -default: - $(RUSTC) --print cfg | $(CGREP) unix -endif diff --git a/tests/run-make-fulldeps/print-target-list/Makefile b/tests/run-make-fulldeps/print-target-list/Makefile deleted file mode 100644 index f23c40d4281..00000000000 --- a/tests/run-make-fulldeps/print-target-list/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -# Checks that all the targets returned by `rustc --print target-list` are valid -# target specifications -all: - for target in $(shell $(BARE_RUSTC) --print target-list); do \ - $(BARE_RUSTC) --target $$target --print sysroot; \ - done diff --git a/tests/run-make-fulldeps/profile/Makefile b/tests/run-make-fulldeps/profile/Makefile deleted file mode 100644 index fffc051adbf..00000000000 --- a/tests/run-make-fulldeps/profile/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# needs-profiler-support - -include ../tools.mk - -all: - $(RUSTC) -g -Z profile test.rs - $(call RUN,test) || exit 1 - [ -e "$(TMPDIR)/test.gcno" ] || (echo "No .gcno file"; exit 1) - [ -e "$(TMPDIR)/test.gcda" ] || (echo "No .gcda file"; exit 1) - $(RUSTC) -g -Z profile -Z profile-emit=$(TMPDIR)/abc/abc.gcda test.rs - $(call RUN,test) || exit 1 - [ -e "$(TMPDIR)/abc/abc.gcda" ] || (echo "gcda file not emitted to defined path"; exit 1) diff --git a/tests/run-make-fulldeps/profile/test.rs b/tests/run-make-fulldeps/profile/test.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/profile/test.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/prune-link-args/Makefile b/tests/run-make-fulldeps/prune-link-args/Makefile deleted file mode 100644 index a359dc5aef1..00000000000 --- a/tests/run-make-fulldeps/prune-link-args/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# ignore-windows - -# Notice the space in the end, this emulates the output of pkg-config -RUSTC_FLAGS = -C link-args="-lc " - -all: - $(RUSTC) $(RUSTC_FLAGS) empty.rs diff --git a/tests/run-make-fulldeps/prune-link-args/empty.rs b/tests/run-make-fulldeps/prune-link-args/empty.rs deleted file mode 100644 index 45590d86ba6..00000000000 --- a/tests/run-make-fulldeps/prune-link-args/empty.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() { } diff --git a/tests/run-make-fulldeps/redundant-libs/Makefile b/tests/run-make-fulldeps/redundant-libs/Makefile deleted file mode 100644 index b2dff05d163..00000000000 --- a/tests/run-make-fulldeps/redundant-libs/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -include ../tools.mk - -# ignore-windows-msvc - -# rustc will remove one of the two redundant references to foo below. Depending -# on which one gets removed, we'll get a linker error on SOME platforms (like -# Linux). On these platforms, when a library is referenced, the linker will -# only pull in the symbols needed _at that point in time_. If a later library -# depends on additional symbols from the library, they will not have been pulled -# in, and you'll get undefined symbols errors. -# -# So in this example, we need to ensure that rustc keeps the _later_ reference -# to foo, and not the former one. -RUSTC_FLAGS = \ - -l static=bar \ - -l foo \ - -l static=baz \ - -l foo \ - --print link-args - -all: $(call DYLIB,foo) $(call STATICLIB,bar) $(call STATICLIB,baz) - $(RUSTC) $(RUSTC_FLAGS) main.rs - $(call RUN,main) diff --git a/tests/run-make-fulldeps/redundant-libs/bar.c b/tests/run-make-fulldeps/redundant-libs/bar.c deleted file mode 100644 index e4259998678..00000000000 --- a/tests/run-make-fulldeps/redundant-libs/bar.c +++ /dev/null @@ -1 +0,0 @@ -void bar() {} diff --git a/tests/run-make-fulldeps/redundant-libs/baz.c b/tests/run-make-fulldeps/redundant-libs/baz.c deleted file mode 100644 index a4e2c2b717f..00000000000 --- a/tests/run-make-fulldeps/redundant-libs/baz.c +++ /dev/null @@ -1,7 +0,0 @@ -extern void foo1(); -extern void foo2(); - -void baz() { - foo1(); - foo2(); -} diff --git a/tests/run-make-fulldeps/redundant-libs/foo.c b/tests/run-make-fulldeps/redundant-libs/foo.c deleted file mode 100644 index 339ee86c99e..00000000000 --- a/tests/run-make-fulldeps/redundant-libs/foo.c +++ /dev/null @@ -1,2 +0,0 @@ -void foo1() {} -void foo2() {} diff --git a/tests/run-make-fulldeps/redundant-libs/main.rs b/tests/run-make-fulldeps/redundant-libs/main.rs deleted file mode 100644 index 90d185ff51d..00000000000 --- a/tests/run-make-fulldeps/redundant-libs/main.rs +++ /dev/null @@ -1,11 +0,0 @@ -extern "C" { - fn bar(); - fn baz(); -} - -fn main() { - unsafe { - bar(); - baz(); - } -} diff --git a/tests/run-make-fulldeps/relocation-model/Makefile b/tests/run-make-fulldeps/relocation-model/Makefile deleted file mode 100644 index a31dbfd9167..00000000000 --- a/tests/run-make-fulldeps/relocation-model/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../tools.mk - -all: others - $(RUSTC) -C relocation-model=dynamic-no-pic foo.rs - $(call RUN,foo) - - $(RUSTC) -C relocation-model=default foo.rs - $(call RUN,foo) - - $(RUSTC) -C relocation-model=dynamic-no-pic --crate-type=dylib foo.rs --emit=link,obj - -ifdef IS_MSVC -# FIXME(#28026) -others: -else -others: - $(RUSTC) -C relocation-model=static foo.rs - $(call RUN,foo) -endif diff --git a/tests/run-make-fulldeps/relocation-model/foo.rs b/tests/run-make-fulldeps/relocation-model/foo.rs deleted file mode 100644 index da0f5d925d1..00000000000 --- a/tests/run-make-fulldeps/relocation-model/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn main() {} diff --git a/tests/run-make-fulldeps/relro-levels/Makefile b/tests/run-make-fulldeps/relro-levels/Makefile deleted file mode 100644 index 6176fc1a589..00000000000 --- a/tests/run-make-fulldeps/relro-levels/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -include ../tools.mk - -# only-linux -# -# This tests the different -Zrelro-level values, and makes sure that they work properly. - -all: - # Ensure that binaries built with the full relro level links them with both - # RELRO and BIND_NOW for doing eager symbol resolving. - $(RUSTC) -Zrelro-level=full hello.rs - readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO - readelf -d $(TMPDIR)/hello | grep -q BIND_NOW - - $(RUSTC) -Zrelro-level=partial hello.rs - readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO - - # Ensure that we're *not* built with RELRO when setting it to off. We do - # not want to check for BIND_NOW however, as the linker might have that - # enabled by default. - $(RUSTC) -Zrelro-level=off hello.rs - ! readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO diff --git a/tests/run-make-fulldeps/relro-levels/hello.rs b/tests/run-make-fulldeps/relro-levels/hello.rs deleted file mode 100644 index e7a11a969c0..00000000000 --- a/tests/run-make-fulldeps/relro-levels/hello.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/tests/run-make-fulldeps/remap-path-prefix/Makefile b/tests/run-make-fulldeps/remap-path-prefix/Makefile deleted file mode 100644 index 2a7378fdf9e..00000000000 --- a/tests/run-make-fulldeps/remap-path-prefix/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# ignore-windows - -# Checks if remapping works if the remap-from string contains path to the working directory plus more -all: - $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux --crate-type=lib --emit=metadata auxiliary/lib.rs - grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1 - ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1 diff --git a/tests/run-make-fulldeps/remap-path-prefix/auxiliary/lib.rs b/tests/run-make-fulldeps/remap-path-prefix/auxiliary/lib.rs deleted file mode 100644 index 019c786a902..00000000000 --- a/tests/run-make-fulldeps/remap-path-prefix/auxiliary/lib.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn lib() { - panic!("calm"); -} diff --git a/tests/run-make-fulldeps/reproducible-build-2/Makefile b/tests/run-make-fulldeps/reproducible-build-2/Makefile deleted file mode 100644 index 1df5e102ce3..00000000000 --- a/tests/run-make-fulldeps/reproducible-build-2/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include ../tools.mk - -# ignore-musl -# ignore-windows -# Objects are reproducible but their path is not. - -all: \ - fat_lto \ - sysroot - -fat_lto: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs -C lto=fat - cp $(TMPDIR)/reproducible-build $(TMPDIR)/reproducible-build-a - $(RUSTC) reproducible-build.rs -C lto=fat - cmp "$(TMPDIR)/reproducible-build-a" "$(TMPDIR)/reproducible-build" || exit 1 - -sysroot: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs --crate-type rlib --sysroot $(shell $(RUSTC) --print sysroot) --remap-path-prefix=$(shell $(RUSTC) --print sysroot)=/sysroot - cp -R $(shell $(RUSTC) --print sysroot) $(TMPDIR)/sysroot - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - $(RUSTC) reproducible-build.rs --crate-type rlib --sysroot $(TMPDIR)/sysroot --remap-path-prefix=$(TMPDIR)/sysroot=/sysroot - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 diff --git a/tests/run-make-fulldeps/reproducible-build-2/linker.rs b/tests/run-make-fulldeps/reproducible-build-2/linker.rs deleted file mode 100644 index 998d1f32859..00000000000 --- a/tests/run-make-fulldeps/reproducible-build-2/linker.rs +++ /dev/null @@ -1,44 +0,0 @@ -use std::env; -use std::path::Path; -use std::fs::File; -use std::io::{Read, Write}; - -fn main() { - let mut dst = env::current_exe().unwrap(); - dst.pop(); - dst.push("linker-arguments1"); - if dst.exists() { - dst.pop(); - dst.push("linker-arguments2"); - assert!(!dst.exists()); - } - - let mut out = String::new(); - for arg in env::args().skip(1) { - let path = Path::new(&arg); - if !path.is_file() { - out.push_str(&arg); - out.push_str("\n"); - continue - } - - let mut contents = Vec::new(); - File::open(path).unwrap().read_to_end(&mut contents).unwrap(); - - out.push_str(&format!("{}: {}\n", arg, hash(&contents))); - } - - File::create(dst).unwrap().write_all(out.as_bytes()).unwrap(); -} - -// fnv hash for now -fn hash(contents: &[u8]) -> u64 { - let mut hash = 0xcbf29ce484222325; - - for byte in contents { - hash = hash ^ (*byte as u64); - hash = hash.wrapping_mul(0x100000001b3); - } - - hash -} diff --git a/tests/run-make-fulldeps/reproducible-build-2/reproducible-build-aux.rs b/tests/run-make-fulldeps/reproducible-build-2/reproducible-build-aux.rs deleted file mode 100644 index 8105b3d2bda..00000000000 --- a/tests/run-make-fulldeps/reproducible-build-2/reproducible-build-aux.rs +++ /dev/null @@ -1,28 +0,0 @@ -#![crate_type="lib"] - -pub static STATIC: i32 = 1234; - -pub struct Struct { - _t1: std::marker::PhantomData, - _t2: std::marker::PhantomData, -} - -pub fn regular_fn(_: i32) {} - -pub fn generic_fn() {} - -impl Drop for Struct { - fn drop(&mut self) {} -} - -pub enum Enum { - Variant1, - Variant2(u32), - Variant3 { x: u32 } -} - -pub struct TupleStruct(pub i8, pub i16, pub i32, pub i64); - -pub trait Trait { - fn foo(&self); -} diff --git a/tests/run-make-fulldeps/reproducible-build-2/reproducible-build.rs b/tests/run-make-fulldeps/reproducible-build-2/reproducible-build.rs deleted file mode 100644 index a6c04774c86..00000000000 --- a/tests/run-make-fulldeps/reproducible-build-2/reproducible-build.rs +++ /dev/null @@ -1,116 +0,0 @@ -// This test case makes sure that two identical invocations of the compiler -// (i.e., same code base, same compile-flags, same compiler-versions, etc.) -// produce the same output. In the past, symbol names of monomorphized functions -// were not deterministic (which we want to avoid). -// -// The test tries to exercise as many different paths into symbol name -// generation as possible: -// -// - regular functions -// - generic functions -// - methods -// - statics -// - closures -// - enum variant constructors -// - tuple struct constructors -// - drop glue -// - FnOnce adapters -// - Trait object shims -// - Fn Pointer shims - -#![allow(dead_code, warnings)] - -extern crate reproducible_build_aux; - -static STATIC: i32 = 1234; - -pub struct Struct { - x: T1, - y: T2, -} - -fn regular_fn(_: i32) {} - -fn generic_fn() {} - -impl Drop for Struct { - fn drop(&mut self) {} -} - -pub enum Enum { - Variant1, - Variant2(u32), - Variant3 { x: u32 } -} - -struct TupleStruct(i8, i16, i32, i64); - -impl TupleStruct { - pub fn bar(&self) {} -} - -trait Trait { - fn foo(&self); -} - -impl Trait for u64 { - fn foo(&self) {} -} - -impl reproducible_build_aux::Trait for TupleStruct { - fn foo(&self) {} -} - -fn main() { - regular_fn(STATIC); - generic_fn::(); - generic_fn::>(); - generic_fn::, reproducible_build_aux::Struct>(); - - let dropped = Struct { - x: "", - y: 'a', - }; - - let _ = Enum::Variant1; - let _ = Enum::Variant2(0); - let _ = Enum::Variant3 { x: 0 }; - let _ = TupleStruct(1, 2, 3, 4); - - let closure = |x| { - x + 1i32 - }; - - fn inner i32>(f: F) -> i32 { - f(STATIC) - } - - println!("{}", inner(closure)); - - let object_shim: &Trait = &0u64; - object_shim.foo(); - - fn with_fn_once_adapter(f: F) { - f(0); - } - - with_fn_once_adapter(|_:i32| { }); - - reproducible_build_aux::regular_fn(STATIC); - reproducible_build_aux::generic_fn::(); - reproducible_build_aux::generic_fn::>(); - reproducible_build_aux::generic_fn::, - reproducible_build_aux::Struct>(); - - let _ = reproducible_build_aux::Enum::Variant1; - let _ = reproducible_build_aux::Enum::Variant2(0); - let _ = reproducible_build_aux::Enum::Variant3 { x: 0 }; - let _ = reproducible_build_aux::TupleStruct(1, 2, 3, 4); - - let object_shim: &reproducible_build_aux::Trait = &TupleStruct(0, 1, 2, 3); - object_shim.foo(); - - let pointer_shim: &Fn(i32) = ®ular_fn; - - TupleStruct(1, 2, 3, 4).bar(); -} diff --git a/tests/run-make-fulldeps/reproducible-build/Makefile b/tests/run-make-fulldeps/reproducible-build/Makefile deleted file mode 100644 index 642a480815b..00000000000 --- a/tests/run-make-fulldeps/reproducible-build/Makefile +++ /dev/null @@ -1,139 +0,0 @@ -include ../tools.mk - -# ignore-musl -# Objects are reproducible but their path is not. - -all: \ - smoke \ - debug \ - opt \ - link_paths \ - remap_paths \ - different_source_dirs_rlib \ - remap_cwd_rlib \ - remap_cwd_to_empty \ - extern_flags - -# TODO: Builds of `bin` crate types are not deterministic with debuginfo=2 on -# Windows. -# See: https://github.com/rust-lang/rust/pull/87320#issuecomment-920105533 -# Issue: https://github.com/rust-lang/rust/issues/88982 -# -# different_source_dirs_bin \ -# remap_cwd_bin \ - -smoke: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) linker.rs -O - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) - diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" - -debug: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) linker.rs -O - $(RUSTC) reproducible-build-aux.rs -g - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g - diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" - -opt: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) linker.rs -O - $(RUSTC) reproducible-build-aux.rs -O - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O - diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" - -link_paths: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs --crate-type rlib -L /b - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - $(RUSTC) reproducible-build.rs --crate-type rlib -L /a - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 - -remap_paths: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=/a=/c - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=/b=/c - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 - -different_source_dirs_bin: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type bin --remap-path-prefix=$$PWD=/b - cp $(TMPDIR)/reproducible-build $(TMPDIR)/foo - (cd $(TMPDIR)/test && $(RUSTC) reproducible-build.rs \ - --remap-path-prefix=$(TMPDIR)/test=/b \ - --crate-type bin) - cmp "$(TMPDIR)/reproducible-build" "$(TMPDIR)/foo" || exit 1 - -different_source_dirs_rlib: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=$$PWD=/b - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - (cd $(TMPDIR)/test && $(RUSTC) reproducible-build.rs \ - --remap-path-prefix=$(TMPDIR)/test=/b \ - --crate-type rlib) - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 - -remap_cwd_bin: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \ - -Z remap-cwd-prefix=. - cp $(TMPDIR)/reproducible-build $(TMPDIR)/first - (cd $(TMPDIR)/test && \ - $(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \ - -Z remap-cwd-prefix=.) - cmp "$(TMPDIR)/first" "$(TMPDIR)/reproducible-build" || exit 1 - -remap_cwd_rlib: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ - -Z remap-cwd-prefix=. - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib - (cd $(TMPDIR)/test && \ - $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ - -Z remap-cwd-prefix=.) - cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1 - -remap_cwd_to_empty: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ - -Z remap-cwd-prefix= - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib - (cd $(TMPDIR)/test && \ - $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ - -Z remap-cwd-prefix=) - cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1 - -extern_flags: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs \ - --extern reproducible_build_aux=$(TMPDIR)/libreproducible_build_aux.rlib \ - --crate-type rlib - cp $(TMPDIR)/libreproducible_build_aux.rlib $(TMPDIR)/libbar.rlib - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - $(RUSTC) reproducible-build.rs \ - --extern reproducible_build_aux=$(TMPDIR)/libbar.rlib \ - --crate-type rlib - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 diff --git a/tests/run-make-fulldeps/reproducible-build/linker.rs b/tests/run-make-fulldeps/reproducible-build/linker.rs deleted file mode 100644 index 3dda6f190e4..00000000000 --- a/tests/run-make-fulldeps/reproducible-build/linker.rs +++ /dev/null @@ -1,50 +0,0 @@ -use std::env; -use std::path::Path; -use std::fs::File; -use std::io::{Read, Write}; - -fn main() { - let mut dst = env::current_exe().unwrap(); - dst.pop(); - dst.push("linker-arguments1"); - if dst.exists() { - dst.pop(); - dst.push("linker-arguments2"); - assert!(!dst.exists()); - } - - let mut out = String::new(); - for arg in env::args().skip(1) { - let path = Path::new(&arg); - if !path.is_file() { - out.push_str(&arg); - out.push_str("\n"); - continue - } - - let mut contents = Vec::new(); - File::open(path).unwrap().read_to_end(&mut contents).unwrap(); - - // This file is produced during linking in a temporary directory. - let arg = if arg.ends_with("/symbols.o") || arg.ends_with("\\symbols.o") { - "symbols.o" - } else { - &*arg - }; - out.push_str(&format!("{}: {}\n", arg, hash(&contents))); - } - - File::create(dst).unwrap().write_all(out.as_bytes()).unwrap(); -} - -// fnv hash for now -fn hash(contents: &[u8]) -> u64 { - let mut hash = 0xcbf29ce484222325; - - for byte in contents { - hash = hash ^ (*byte as u64); - hash = hash.wrapping_mul(0x100000001b3); - } - - hash -} diff --git a/tests/run-make-fulldeps/reproducible-build/reproducible-build-aux.rs b/tests/run-make-fulldeps/reproducible-build/reproducible-build-aux.rs deleted file mode 100644 index 8105b3d2bda..00000000000 --- a/tests/run-make-fulldeps/reproducible-build/reproducible-build-aux.rs +++ /dev/null @@ -1,28 +0,0 @@ -#![crate_type="lib"] - -pub static STATIC: i32 = 1234; - -pub struct Struct { - _t1: std::marker::PhantomData, - _t2: std::marker::PhantomData, -} - -pub fn regular_fn(_: i32) {} - -pub fn generic_fn() {} - -impl Drop for Struct { - fn drop(&mut self) {} -} - -pub enum Enum { - Variant1, - Variant2(u32), - Variant3 { x: u32 } -} - -pub struct TupleStruct(pub i8, pub i16, pub i32, pub i64); - -pub trait Trait { - fn foo(&self); -} diff --git a/tests/run-make-fulldeps/reproducible-build/reproducible-build.rs b/tests/run-make-fulldeps/reproducible-build/reproducible-build.rs deleted file mode 100644 index a6c04774c86..00000000000 --- a/tests/run-make-fulldeps/reproducible-build/reproducible-build.rs +++ /dev/null @@ -1,116 +0,0 @@ -// This test case makes sure that two identical invocations of the compiler -// (i.e., same code base, same compile-flags, same compiler-versions, etc.) -// produce the same output. In the past, symbol names of monomorphized functions -// were not deterministic (which we want to avoid). -// -// The test tries to exercise as many different paths into symbol name -// generation as possible: -// -// - regular functions -// - generic functions -// - methods -// - statics -// - closures -// - enum variant constructors -// - tuple struct constructors -// - drop glue -// - FnOnce adapters -// - Trait object shims -// - Fn Pointer shims - -#![allow(dead_code, warnings)] - -extern crate reproducible_build_aux; - -static STATIC: i32 = 1234; - -pub struct Struct { - x: T1, - y: T2, -} - -fn regular_fn(_: i32) {} - -fn generic_fn() {} - -impl Drop for Struct { - fn drop(&mut self) {} -} - -pub enum Enum { - Variant1, - Variant2(u32), - Variant3 { x: u32 } -} - -struct TupleStruct(i8, i16, i32, i64); - -impl TupleStruct { - pub fn bar(&self) {} -} - -trait Trait { - fn foo(&self); -} - -impl Trait for u64 { - fn foo(&self) {} -} - -impl reproducible_build_aux::Trait for TupleStruct { - fn foo(&self) {} -} - -fn main() { - regular_fn(STATIC); - generic_fn::(); - generic_fn::>(); - generic_fn::, reproducible_build_aux::Struct>(); - - let dropped = Struct { - x: "", - y: 'a', - }; - - let _ = Enum::Variant1; - let _ = Enum::Variant2(0); - let _ = Enum::Variant3 { x: 0 }; - let _ = TupleStruct(1, 2, 3, 4); - - let closure = |x| { - x + 1i32 - }; - - fn inner i32>(f: F) -> i32 { - f(STATIC) - } - - println!("{}", inner(closure)); - - let object_shim: &Trait = &0u64; - object_shim.foo(); - - fn with_fn_once_adapter(f: F) { - f(0); - } - - with_fn_once_adapter(|_:i32| { }); - - reproducible_build_aux::regular_fn(STATIC); - reproducible_build_aux::generic_fn::(); - reproducible_build_aux::generic_fn::>(); - reproducible_build_aux::generic_fn::, - reproducible_build_aux::Struct>(); - - let _ = reproducible_build_aux::Enum::Variant1; - let _ = reproducible_build_aux::Enum::Variant2(0); - let _ = reproducible_build_aux::Enum::Variant3 { x: 0 }; - let _ = reproducible_build_aux::TupleStruct(1, 2, 3, 4); - - let object_shim: &reproducible_build_aux::Trait = &TupleStruct(0, 1, 2, 3); - object_shim.foo(); - - let pointer_shim: &Fn(i32) = ®ular_fn; - - TupleStruct(1, 2, 3, 4).bar(); -} diff --git a/tests/run-make-fulldeps/resolve-rename/Makefile b/tests/run-make-fulldeps/resolve-rename/Makefile deleted file mode 100644 index 00f83a5d6b2..00000000000 --- a/tests/run-make-fulldeps/resolve-rename/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) -C extra-filename=-hash foo.rs - $(RUSTC) bar.rs - mv $(TMPDIR)/libfoo-hash.rlib $(TMPDIR)/libfoo-another-hash.rlib - $(RUSTC) baz.rs diff --git a/tests/run-make-fulldeps/resolve-rename/bar.rs b/tests/run-make-fulldeps/resolve-rename/bar.rs deleted file mode 100644 index 4a09ce355e6..00000000000 --- a/tests/run-make-fulldeps/resolve-rename/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type = "rlib"] - -extern crate foo; - -pub fn bar() { foo::foo() } diff --git a/tests/run-make-fulldeps/resolve-rename/baz.rs b/tests/run-make-fulldeps/resolve-rename/baz.rs deleted file mode 100644 index 9176073ef97..00000000000 --- a/tests/run-make-fulldeps/resolve-rename/baz.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type = "rlib"] - -extern crate bar; - -pub fn baz() { bar::bar() } diff --git a/tests/run-make-fulldeps/resolve-rename/foo.rs b/tests/run-make-fulldeps/resolve-rename/foo.rs deleted file mode 100644 index bd6820098ee..00000000000 --- a/tests/run-make-fulldeps/resolve-rename/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "rlib"] - -pub fn foo() {} diff --git a/tests/run-make-fulldeps/return-non-c-like-enum-from-c/Makefile b/tests/run-make-fulldeps/return-non-c-like-enum-from-c/Makefile deleted file mode 100644 index 42d3c977f75..00000000000 --- a/tests/run-make-fulldeps/return-non-c-like-enum-from-c/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,test) - $(RUSTC) nonclike.rs -L$(TMPDIR) -ltest - $(call RUN,nonclike) diff --git a/tests/run-make-fulldeps/return-non-c-like-enum-from-c/nonclike.rs b/tests/run-make-fulldeps/return-non-c-like-enum-from-c/nonclike.rs deleted file mode 100644 index ea22a2a56e0..00000000000 --- a/tests/run-make-fulldeps/return-non-c-like-enum-from-c/nonclike.rs +++ /dev/null @@ -1,31 +0,0 @@ -#[repr(C, u8)] -pub enum TT { - AA(u64, u64), - BB, -} - -#[repr(C,u8)] -pub enum T { - A(u64), - B, -} - -extern "C" { - pub fn t_new(a: u64) -> T; - pub fn tt_new(a: u64, b: u64) -> TT; -} - -fn main() { - if let TT::AA(a, b) = unsafe { tt_new(10, 11) } { - assert_eq!(10, a); - assert_eq!(11, b); - } else { - panic!("expected TT::AA"); - } - - if let T::A(a) = unsafe { t_new(10) } { - assert_eq!(10, a); - } else { - panic!("expected T::A"); - } -} diff --git a/tests/run-make-fulldeps/return-non-c-like-enum-from-c/test.c b/tests/run-make-fulldeps/return-non-c-like-enum-from-c/test.c deleted file mode 100644 index 3ad135bab4a..00000000000 --- a/tests/run-make-fulldeps/return-non-c-like-enum-from-c/test.c +++ /dev/null @@ -1,61 +0,0 @@ -#include - -/* This is the code generated by cbindgen 0.12.1 for the `enum TT` - * type in nonclike.rs . */ -enum TT_Tag { - AA, - BB, -}; -typedef uint8_t TT_Tag; - -typedef struct { - uint64_t _0; - uint64_t _1; -} AA_Body; - -typedef struct { - TT_Tag tag; - union { - AA_Body aa; - }; -} TT; - -/* This is the code generated by cbindgen 0.12.1 for the `enum T` type - * in nonclike.rs . */ -enum T_Tag { - A, - B, -}; -typedef uint8_t T_Tag; - -typedef struct { - uint64_t _0; -} A_Body; - -typedef struct { - T_Tag tag; - union { - A_Body a; - }; -} T; - -TT tt_new(uint64_t a, uint64_t b) { - TT tt = { - .tag = AA, - .aa = { - ._0 = a, - ._1 = b, - }, - }; - return tt; -} - -T t_new(uint64_t a) { - T t = { - .tag = A, - .a = { - ._0 = a, - }, - }; - return t; -} diff --git a/tests/run-make-fulldeps/return-non-c-like-enum/Makefile b/tests/run-make-fulldeps/return-non-c-like-enum/Makefile deleted file mode 100644 index 513311c8289..00000000000 --- a/tests/run-make-fulldeps/return-non-c-like-enum/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --crate-type=staticlib nonclike.rs - $(CC) test.c $(call STATICLIB,nonclike) $(call OUT_EXE,test) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(call RUN,test) diff --git a/tests/run-make-fulldeps/return-non-c-like-enum/nonclike.rs b/tests/run-make-fulldeps/return-non-c-like-enum/nonclike.rs deleted file mode 100644 index de529cf641a..00000000000 --- a/tests/run-make-fulldeps/return-non-c-like-enum/nonclike.rs +++ /dev/null @@ -1,21 +0,0 @@ -#[repr(C, u8)] -pub enum TT { - AA(u64, u64), - BB, -} - -#[no_mangle] -pub extern "C" fn tt_new(a: u64, b: u64) -> TT { - TT::AA(a, b) -} - -#[repr(C,u8)] -pub enum T { - A(u64), - B, -} - -#[no_mangle] -pub extern "C" fn t_new(a: u64) -> T { - T::A(a) -} diff --git a/tests/run-make-fulldeps/return-non-c-like-enum/test.c b/tests/run-make-fulldeps/return-non-c-like-enum/test.c deleted file mode 100644 index afadd3c10c5..00000000000 --- a/tests/run-make-fulldeps/return-non-c-like-enum/test.c +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include - -/* This is the code generated by cbindgen 0.12.1 for the `enum TT` - * type in nonclike.rs . */ -enum TT_Tag { - AA, - BB, -}; -typedef uint8_t TT_Tag; - -typedef struct { - uint64_t _0; - uint64_t _1; -} AA_Body; - -typedef struct { - TT_Tag tag; - union { - AA_Body aa; - }; -} TT; - -/* This is the code generated by cbindgen 0.12.1 for the `enum T` type - * in nonclike.rs . */ -enum T_Tag { - A, - B, -}; -typedef uint8_t T_Tag; - -typedef struct { - uint64_t _0; -} A_Body; - -typedef struct { - T_Tag tag; - union { - A_Body a; - }; -} T; - -/* These symbols are defined by the Rust staticlib built from - * nonclike.rs. */ -extern TT tt_new(uint64_t a, uint64_t b); -extern T t_new(uint64_t v); - -int main(int argc, char *argv[]) { - (void)argc; (void)argv; - - /* This example works. */ - TT tt = tt_new(10, 20); - assert(AA == tt.tag); - assert(10 == tt.aa._0); - assert(20 == tt.aa._1); - - /* This one used to segfault (see issue #68190). */ - T t = t_new(10); - assert(A == t.tag); - assert(10 == t.a._0); - - return 0; -} diff --git a/tests/run-make-fulldeps/rlib-chain/Makefile b/tests/run-make-fulldeps/rlib-chain/Makefile deleted file mode 100644 index 236943a2a3b..00000000000 --- a/tests/run-make-fulldeps/rlib-chain/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) m1.rs - $(RUSTC) m2.rs - $(RUSTC) m3.rs - $(RUSTC) m4.rs - $(call RUN,m4) - rm $(TMPDIR)/*lib - $(call RUN,m4) diff --git a/tests/run-make-fulldeps/rlib-chain/m1.rs b/tests/run-make-fulldeps/rlib-chain/m1.rs deleted file mode 100644 index 665b206ccf1..00000000000 --- a/tests/run-make-fulldeps/rlib-chain/m1.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![crate_type = "rlib"] -pub fn m1() {} diff --git a/tests/run-make-fulldeps/rlib-chain/m2.rs b/tests/run-make-fulldeps/rlib-chain/m2.rs deleted file mode 100644 index eba12fe1218..00000000000 --- a/tests/run-make-fulldeps/rlib-chain/m2.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] -extern crate m1; - -pub fn m2() { m1::m1() } diff --git a/tests/run-make-fulldeps/rlib-chain/m3.rs b/tests/run-make-fulldeps/rlib-chain/m3.rs deleted file mode 100644 index ade191db49c..00000000000 --- a/tests/run-make-fulldeps/rlib-chain/m3.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] -extern crate m2; - -pub fn m3() { m2::m2() } diff --git a/tests/run-make-fulldeps/rlib-chain/m4.rs b/tests/run-make-fulldeps/rlib-chain/m4.rs deleted file mode 100644 index fa8ec6079de..00000000000 --- a/tests/run-make-fulldeps/rlib-chain/m4.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate m3; - -fn main() { m3::m3() } diff --git a/tests/run-make-fulldeps/rustdoc-determinism/Makefile b/tests/run-make-fulldeps/rustdoc-determinism/Makefile deleted file mode 100644 index a3ef1690671..00000000000 --- a/tests/run-make-fulldeps/rustdoc-determinism/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -include ../tools.mk - -# Assert that the search index is generated deterministically, regardless of the -# order that crates are documented in. - -# ignore-windows -# Uses `diff`. - -all: - $(RUSTDOC) foo.rs -o $(TMPDIR)/foo_first - $(RUSTDOC) bar.rs -o $(TMPDIR)/foo_first - - $(RUSTDOC) bar.rs -o $(TMPDIR)/bar_first - $(RUSTDOC) foo.rs -o $(TMPDIR)/bar_first - - diff $(TMPDIR)/foo_first/search-index.js $(TMPDIR)/bar_first/search-index.js diff --git a/tests/run-make-fulldeps/rustdoc-determinism/bar.rs b/tests/run-make-fulldeps/rustdoc-determinism/bar.rs deleted file mode 100644 index ca05a6a9076..00000000000 --- a/tests/run-make-fulldeps/rustdoc-determinism/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Bar; diff --git a/tests/run-make-fulldeps/rustdoc-determinism/foo.rs b/tests/run-make-fulldeps/rustdoc-determinism/foo.rs deleted file mode 100644 index 4a835673a59..00000000000 --- a/tests/run-make-fulldeps/rustdoc-determinism/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Foo; diff --git a/tests/run-make-fulldeps/rustdoc-error-lines/Makefile b/tests/run-make-fulldeps/rustdoc-error-lines/Makefile deleted file mode 100644 index 2dc30f56b83..00000000000 --- a/tests/run-make-fulldeps/rustdoc-error-lines/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include ../tools.mk - -# Test that hir-tree output doesn't crash and includes -# the string constant we would expect to see. - -all: - $(RUSTDOC) --test input.rs > $(TMPDIR)/output || true - $(CGREP) 'input.rs - foo (line 5)' < $(TMPDIR)/output - $(CGREP) 'input.rs:7:15' < $(TMPDIR)/output - $(CGREP) 'input.rs - bar (line 15)' < $(TMPDIR)/output - $(CGREP) 'input.rs:17:15' < $(TMPDIR)/output - $(CGREP) 'input.rs - bar (line 24)' < $(TMPDIR)/output - $(CGREP) 'input.rs:26:15' < $(TMPDIR)/output diff --git a/tests/run-make-fulldeps/rustdoc-error-lines/input.rs b/tests/run-make-fulldeps/rustdoc-error-lines/input.rs deleted file mode 100644 index b4db182e85f..00000000000 --- a/tests/run-make-fulldeps/rustdoc-error-lines/input.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Test for #45868 - -// random #![feature] to ensure that crate attrs -// do not offset things -/// ```rust -/// #![feature(bool_to_option)] -/// let x: char = 1; -/// ``` -pub fn foo() { - -} - -/// Add some text around the test... -/// -/// ```rust -/// #![feature(bool_to_option)] -/// let x: char = 1; -/// ``` -/// -/// ...to make sure that the line number is still correct. -/// -/// Let's also add a second test in the same doc comment. -/// -/// ```rust -/// #![feature(bool_to_option)] -/// let x: char = 1; -/// ``` -pub fn bar() {} diff --git a/tests/run-make-fulldeps/rustdoc-io-error/Makefile b/tests/run-make-fulldeps/rustdoc-io-error/Makefile deleted file mode 100644 index 27f5ecf94ab..00000000000 --- a/tests/run-make-fulldeps/rustdoc-io-error/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include ../tools.mk - -# This test verifies that rustdoc doesn't ICE when it encounters an IO error -# while generating files. Ideally this would be a rustdoc-ui test, so we could -# verify the error message as well. - -# ignore-windows -# The test uses `chmod`. - -OUTPUT_DIR := "$(TMPDIR)/rustdoc-io-error" - -# This test operates by creating a temporary directory and modifying its -# permissions so that it is not writable. We have to take special care to set -# the permissions back to normal so that it's able to be deleted later. -all: - mkdir -p $(OUTPUT_DIR) - chmod u-w $(OUTPUT_DIR) - -$(shell $(RUSTDOC) -o $(OUTPUT_DIR) foo.rs) - chmod u+w $(OUTPUT_DIR) - exit $($(.SHELLSTATUS) -eq 1) diff --git a/tests/run-make-fulldeps/rustdoc-io-error/foo.rs b/tests/run-make-fulldeps/rustdoc-io-error/foo.rs deleted file mode 100644 index 4a835673a59..00000000000 --- a/tests/run-make-fulldeps/rustdoc-io-error/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Foo; diff --git a/tests/run-make-fulldeps/rustdoc-map-file/Makefile b/tests/run-make-fulldeps/rustdoc-map-file/Makefile deleted file mode 100644 index 5cbf7747af6..00000000000 --- a/tests/run-make-fulldeps/rustdoc-map-file/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTDOC) -Z unstable-options --generate-redirect-map foo.rs -o "$(TMPDIR)/out" - "$(PYTHON)" validate_json.py "$(TMPDIR)/out" diff --git a/tests/run-make-fulldeps/rustdoc-map-file/expected.json b/tests/run-make-fulldeps/rustdoc-map-file/expected.json deleted file mode 100644 index 6b1ccbeac30..00000000000 --- a/tests/run-make-fulldeps/rustdoc-map-file/expected.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "foo/macro.foo!.html": "foo/macro.foo.html", - "foo/private/struct.Quz.html": "foo/struct.Quz.html", - "foo/hidden/struct.Bar.html": "foo/struct.Bar.html" -} diff --git a/tests/run-make-fulldeps/rustdoc-map-file/foo.rs b/tests/run-make-fulldeps/rustdoc-map-file/foo.rs deleted file mode 100644 index e12b9d2292c..00000000000 --- a/tests/run-make-fulldeps/rustdoc-map-file/foo.rs +++ /dev/null @@ -1,16 +0,0 @@ -pub use private::Quz; -pub use hidden::Bar; - -mod private { - pub struct Quz; -} - -#[doc(hidden)] -pub mod hidden { - pub struct Bar; -} - -#[macro_export] -macro_rules! foo { - () => {} -} diff --git a/tests/run-make-fulldeps/rustdoc-map-file/validate_json.py b/tests/run-make-fulldeps/rustdoc-map-file/validate_json.py deleted file mode 100755 index 5c14c90b70d..00000000000 --- a/tests/run-make-fulldeps/rustdoc-map-file/validate_json.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python - -import os -import sys -import json - - -def find_redirect_map_file(folder, errors): - for root, dirs, files in os.walk(folder): - for name in files: - if not name.endswith("redirect-map.json"): - continue - with open(os.path.join(root, name)) as f: - data = json.load(f) - with open("expected.json") as f: - expected = json.load(f) - for key in expected: - if expected[key] != data.get(key): - errors.append("Expected `{}` for key `{}`, found: `{}`".format( - expected[key], key, data.get(key))) - else: - del data[key] - for key in data: - errors.append("Extra data not expected: key: `{}`, data: `{}`".format( - key, data[key])) - return True - return False - - -if len(sys.argv) != 2: - print("Expected doc directory to check!") - sys.exit(1) - -errors = [] -if not find_redirect_map_file(sys.argv[1], errors): - print("Didn't find the map file in `{}`...".format(sys.argv[1])) - sys.exit(1) -for err in errors: - print("=> {}".format(err)) -if len(errors) != 0: - sys.exit(1) diff --git a/tests/run-make-fulldeps/rustdoc-output-path/Makefile b/tests/run-make-fulldeps/rustdoc-output-path/Makefile deleted file mode 100644 index 8f5cda9e56e..00000000000 --- a/tests/run-make-fulldeps/rustdoc-output-path/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTDOC) -o "$(TMPDIR)/foo/bar/doc" foo.rs diff --git a/tests/run-make-fulldeps/rustdoc-output-path/foo.rs b/tests/run-make-fulldeps/rustdoc-output-path/foo.rs deleted file mode 100644 index 4a835673a59..00000000000 --- a/tests/run-make-fulldeps/rustdoc-output-path/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Foo; diff --git a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/Makefile b/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/Makefile deleted file mode 100644 index c857aa4b993..00000000000 --- a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -include ../../run-make-fulldeps/tools.mk - -OUTPUT_DIR := "$(TMPDIR)/rustdoc" -DYLIB_NAME := $(shell echo | $(RUSTC) --crate-name foobar_macro --crate-type dylib --print file-names -) - -all: - $(RUSTC) src/proc.rs --crate-name foobar_macro --edition=2021 --crate-type proc-macro --emit=dep-info,link - - $(RUSTC) src/lib.rs --crate-name foobar --edition=2021 --crate-type lib --emit=dep-info,link - - $(RUSTDOC) examples/ex.rs --crate-name ex --crate-type bin --output $(OUTPUT_DIR) \ - --extern foobar=$(TMPDIR)/libfoobar.rlib --extern foobar_macro=$(TMPDIR)/$(DYLIB_NAME) \ - -Z unstable-options --scrape-examples-output-path $(TMPDIR)/ex.calls --scrape-examples-target-crate foobar - - $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR) \ - -Z unstable-options --with-examples $(TMPDIR)/ex.calls - - $(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs diff --git a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs b/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs deleted file mode 100644 index 4d8c8b30e31..00000000000 --- a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/examples/ex.rs +++ /dev/null @@ -1,27 +0,0 @@ -extern crate foobar; -extern crate foobar_macro; - -use foobar::*; -use foobar_macro::*; - -a_proc_macro!(); // no - -#[an_attr_macro] -fn a() { - f(); // no -} - -#[an_attr_macro(with_span)] -fn b() { - f(); // yes -} - -fn c() { - a_rules_macro!(f()); // yes -} - -fn d() { - a_rules_macro!(()); // no -} - -fn main(){} diff --git a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/lib.rs b/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/lib.rs deleted file mode 100644 index d8658a0f255..00000000000 --- a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/lib.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Scraped example should only include line numbers for items b and c in ex.rs -// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '14' -// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '15' -// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '21' -// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '22' - -pub fn f() {} - -#[macro_export] -macro_rules! a_rules_macro { - ($e:expr) => { ($e, foobar::f()); } -} diff --git a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/proc.rs b/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/proc.rs deleted file mode 100644 index 46e518fdf6a..00000000000 --- a/tests/run-make-fulldeps/rustdoc-scrape-examples-macros/src/proc.rs +++ /dev/null @@ -1,39 +0,0 @@ -extern crate proc_macro; -use proc_macro::*; - -#[proc_macro] -pub fn a_proc_macro(_item: TokenStream) -> TokenStream { - "fn ex() { foobar::f(); }".parse().unwrap() -} - -// inserts foobar::f() to the end of the function -#[proc_macro_attribute] -pub fn an_attr_macro(attr: TokenStream, item: TokenStream) -> TokenStream { - let new_call: TokenStream = "foobar::f();".parse().unwrap(); - - let mut tokens = item.into_iter(); - - let fn_tok = tokens.next().unwrap(); - let ident_tok = tokens.next().unwrap(); - let args_tok = tokens.next().unwrap(); - let body = match tokens.next().unwrap() { - TokenTree::Group(g) => { - let new_g = Group::new(g.delimiter(), new_call); - let mut outer_g = Group::new( - g.delimiter(), - [TokenTree::Group(g.clone()), TokenTree::Group(new_g)].into_iter().collect(), - ); - - if attr.to_string() == "with_span" { - outer_g.set_span(g.span()); - } - - TokenTree::Group(outer_g) - } - _ => unreachable!(), - }; - - let tokens = vec![fn_tok, ident_tok, args_tok, body].into_iter().collect::(); - - tokens -} diff --git a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/Makefile b/tests/run-make-fulldeps/rustdoc-target-spec-json-path/Makefile deleted file mode 100644 index 6d0bc4186f2..00000000000 --- a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# Test that rustdoc will properly canonicalize the target spec json path just like rustc - -OUTPUT_DIR := "$(TMPDIR)/rustdoc-target-spec-json-path" - -all: - $(RUSTC) --crate-type lib dummy_core.rs --target target.json - $(RUSTDOC) -o $(OUTPUT_DIR) -L $(TMPDIR) my_crate.rs --target target.json diff --git a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/dummy_core.rs b/tests/run-make-fulldeps/rustdoc-target-spec-json-path/dummy_core.rs deleted file mode 100644 index da27b7f3463..00000000000 --- a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/dummy_core.rs +++ /dev/null @@ -1,2 +0,0 @@ -#![feature(no_core)] -#![no_core] diff --git a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/my_crate.rs b/tests/run-make-fulldeps/rustdoc-target-spec-json-path/my_crate.rs deleted file mode 100644 index 12aa0822084..00000000000 --- a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/my_crate.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![feature(no_core)] -#![no_core] -extern crate dummy_core; diff --git a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/target.json b/tests/run-make-fulldeps/rustdoc-target-spec-json-path/target.json deleted file mode 100644 index 34357182c20..00000000000 --- a/tests/run-make-fulldeps/rustdoc-target-spec-json-path/target.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "arch": "x86_64", - "cpu": "x86-64", - "crt-static-respected": true, - "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", - "dynamic-linking": true, - "env": "gnu", - "executables": true, - "has-elf-tls": true, - "has-rpath": true, - "linker-is-gnu": true, - "llvm-target": "x86_64-unknown-linux-gnu", - "max-atomic-width": 64, - "os": "linux", - "position-independent-executables": true, - "pre-link-args": { - "gcc": [ - "-m64" - ] - }, - "relro-level": "full", - "stack-probes": { - "kind": "inline-or-call", - "min-llvm-version-for-inline": [ - 11, - 0, - 1 - ] - }, - "supported-sanitizers": [ - "address", - "leak", - "memory", - "thread" - ], - "target-family": "unix", - "target-pointer-width": "64" -} diff --git a/tests/run-make-fulldeps/rustdoc-themes/Makefile b/tests/run-make-fulldeps/rustdoc-themes/Makefile deleted file mode 100644 index a6d9a43addf..00000000000 --- a/tests/run-make-fulldeps/rustdoc-themes/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -# Test that rustdoc will properly load in a theme file and display it in the theme selector. - -OUTPUT_DIR := "$(TMPDIR)/rustdoc-themes" - -all: - cp $(S)/src/librustdoc/html/static/css/themes/light.css $(TMPDIR)/test.css - $(RUSTDOC) -o $(OUTPUT_DIR) foo.rs --theme $(TMPDIR)/test.css - $(HTMLDOCCK) $(OUTPUT_DIR) foo.rs diff --git a/tests/run-make-fulldeps/rustdoc-themes/foo.rs b/tests/run-make-fulldeps/rustdoc-themes/foo.rs deleted file mode 100644 index 995544aeff9..00000000000 --- a/tests/run-make-fulldeps/rustdoc-themes/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -// @has test.css -// @has foo/struct.Foo.html -// @has - '//*[@id="rustdoc-vars"]/@data-themes' 'test' -pub struct Foo; diff --git a/tests/run-make-fulldeps/sanitizer-cdylib-link/Makefile b/tests/run-make-fulldeps/sanitizer-cdylib-link/Makefile deleted file mode 100644 index 691585268bf..00000000000 --- a/tests/run-make-fulldeps/sanitizer-cdylib-link/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# needs-sanitizer-support -# needs-sanitizer-address - -include ../tools.mk - -LOG := $(TMPDIR)/log.txt - -# This test builds a shared object, then an executable that links it as a native -# rust library (contrast to an rlib). The shared library and executable both -# are compiled with address sanitizer, and we assert that a fault in the cdylib -# is correctly detected. - -all: - $(RUSTC) -g -Z sanitizer=address --crate-type cdylib --target $(TARGET) library.rs - $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -llibrary program.rs - LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow diff --git a/tests/run-make-fulldeps/sanitizer-cdylib-link/library.rs b/tests/run-make-fulldeps/sanitizer-cdylib-link/library.rs deleted file mode 100644 index f2a52cb5ca1..00000000000 --- a/tests/run-make-fulldeps/sanitizer-cdylib-link/library.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[no_mangle] -pub extern "C" fn overflow() { - let xs = [0, 1, 2, 3]; - let _y = unsafe { *xs.as_ptr().offset(4) }; -} diff --git a/tests/run-make-fulldeps/sanitizer-cdylib-link/program.rs b/tests/run-make-fulldeps/sanitizer-cdylib-link/program.rs deleted file mode 100644 index ef053aa2e7a..00000000000 --- a/tests/run-make-fulldeps/sanitizer-cdylib-link/program.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern "C" { - fn overflow(); -} - -fn main() { - unsafe { overflow() } -} diff --git a/tests/run-make-fulldeps/sanitizer-dylib-link/Makefile b/tests/run-make-fulldeps/sanitizer-dylib-link/Makefile deleted file mode 100644 index b0a91e5b197..00000000000 --- a/tests/run-make-fulldeps/sanitizer-dylib-link/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# needs-sanitizer-support -# needs-sanitizer-address - -include ../tools.mk - -LOG := $(TMPDIR)/log.txt - -# This test builds a shared object, then an executable that links it as a native -# rust library (contrast to an rlib). The shared library and executable both -# are compiled with address sanitizer, and we assert that a fault in the dylib -# is correctly detected. - -all: - $(RUSTC) -g -Z sanitizer=address --crate-type dylib --target $(TARGET) library.rs - $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -llibrary program.rs - LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow diff --git a/tests/run-make-fulldeps/sanitizer-dylib-link/library.rs b/tests/run-make-fulldeps/sanitizer-dylib-link/library.rs deleted file mode 100644 index f2a52cb5ca1..00000000000 --- a/tests/run-make-fulldeps/sanitizer-dylib-link/library.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[no_mangle] -pub extern "C" fn overflow() { - let xs = [0, 1, 2, 3]; - let _y = unsafe { *xs.as_ptr().offset(4) }; -} diff --git a/tests/run-make-fulldeps/sanitizer-dylib-link/program.rs b/tests/run-make-fulldeps/sanitizer-dylib-link/program.rs deleted file mode 100644 index ef053aa2e7a..00000000000 --- a/tests/run-make-fulldeps/sanitizer-dylib-link/program.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern "C" { - fn overflow(); -} - -fn main() { - unsafe { overflow() } -} diff --git a/tests/run-make-fulldeps/sanitizer-staticlib-link/Makefile b/tests/run-make-fulldeps/sanitizer-staticlib-link/Makefile deleted file mode 100644 index 7b1a286ed12..00000000000 --- a/tests/run-make-fulldeps/sanitizer-staticlib-link/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# needs-sanitizer-support -# needs-sanitizer-address - -include ../tools.mk - -# This test first builds a staticlib with AddressSanitizer and checks that -# linking it to an executable fails due to the missing sanitizer runtime. -# It then builds an executable linking to the staticlib and checks that -# the fault in the staticlib is detected correctly. - -# Note that checking for the link failure actually checks two things at once: -# 1) That the library has the sanitizer intrumentation -# 2) and that library does not have the sanitizer runtime - -all: - $(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs - ! $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -L . program.rs - LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow - diff --git a/tests/run-make-fulldeps/sanitizer-staticlib-link/library.rs b/tests/run-make-fulldeps/sanitizer-staticlib-link/library.rs deleted file mode 100644 index f2a52cb5ca1..00000000000 --- a/tests/run-make-fulldeps/sanitizer-staticlib-link/library.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[no_mangle] -pub extern "C" fn overflow() { - let xs = [0, 1, 2, 3]; - let _y = unsafe { *xs.as_ptr().offset(4) }; -} diff --git a/tests/run-make-fulldeps/sanitizer-staticlib-link/program.c b/tests/run-make-fulldeps/sanitizer-staticlib-link/program.c deleted file mode 100644 index 735e2b147fd..00000000000 --- a/tests/run-make-fulldeps/sanitizer-staticlib-link/program.c +++ /dev/null @@ -1,6 +0,0 @@ -void overflow(); - -int main() { - overflow(); - return 0; -} diff --git a/tests/run-make-fulldeps/sanitizer-staticlib-link/program.rs b/tests/run-make-fulldeps/sanitizer-staticlib-link/program.rs deleted file mode 100644 index ec59bdb11c8..00000000000 --- a/tests/run-make-fulldeps/sanitizer-staticlib-link/program.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[link(name = "library")] -extern "C" { - fn overflow(); -} - -fn main() { - unsafe { - overflow(); - } -} diff --git a/tests/run-make-fulldeps/separate-link-fail/Makefile b/tests/run-make-fulldeps/separate-link-fail/Makefile deleted file mode 100644 index bfd18fbf972..00000000000 --- a/tests/run-make-fulldeps/separate-link-fail/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - echo 'fn main(){}' > $(TMPDIR)/main.rs - # Make sure that this fails - ! $(RUSTC) -Z link-only $(TMPDIR)/main.rs 2> $(TMPDIR)/stderr.txt - $(CGREP) "The input does not look like a .rlink file" < $(TMPDIR)/stderr.txt diff --git a/tests/run-make-fulldeps/separate-link/Makefile b/tests/run-make-fulldeps/separate-link/Makefile deleted file mode 100644 index 3ccdb6275d1..00000000000 --- a/tests/run-make-fulldeps/separate-link/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - echo 'fn main(){}' | $(RUSTC) -Z no-link - - $(RUSTC) -Z link-only $(TMPDIR)/rust_out.rlink - $(call RUN,rust_out) diff --git a/tests/run-make-fulldeps/sepcomp-cci-copies/Makefile b/tests/run-make-fulldeps/sepcomp-cci-copies/Makefile deleted file mode 100644 index df289d0b0b1..00000000000 --- a/tests/run-make-fulldeps/sepcomp-cci-copies/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -# Check that cross-crate inlined items are inlined in all compilation units -# that refer to them, and not in any other compilation units. -# Note that we have to pass `-C codegen-units=6` because up to two CGUs may be -# created for each source module (see `rustc_const_eval::monomorphize::partitioning`). - -all: - $(RUSTC) cci_lib.rs - $(RUSTC) foo.rs --emit=llvm-ir -C codegen-units=6 \ - -Z inline-in-all-cgus - [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ .*cci_fn)" -eq "2" ] diff --git a/tests/run-make-fulldeps/sepcomp-cci-copies/cci_lib.rs b/tests/run-make-fulldeps/sepcomp-cci-copies/cci_lib.rs deleted file mode 100644 index 869d4a6cd3e..00000000000 --- a/tests/run-make-fulldeps/sepcomp-cci-copies/cci_lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "rlib"] - -#[inline] -pub fn cci_fn() -> usize { - 1234 -} diff --git a/tests/run-make-fulldeps/sepcomp-cci-copies/foo.rs b/tests/run-make-fulldeps/sepcomp-cci-copies/foo.rs deleted file mode 100644 index ba251fcb0ac..00000000000 --- a/tests/run-make-fulldeps/sepcomp-cci-copies/foo.rs +++ /dev/null @@ -1,25 +0,0 @@ -extern crate cci_lib; -use cci_lib::cci_fn; - -fn call1() -> usize { - cci_fn() -} - -mod a { - use cci_lib::cci_fn; - pub fn call2() -> usize { - cci_fn() - } -} - -mod b { - pub fn call3() -> usize { - 0 - } -} - -fn main() { - call1(); - a::call2(); - b::call3(); -} diff --git a/tests/run-make-fulldeps/sepcomp-inlining/Makefile b/tests/run-make-fulldeps/sepcomp-inlining/Makefile deleted file mode 100644 index 327aeb75e5e..00000000000 --- a/tests/run-make-fulldeps/sepcomp-inlining/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../tools.mk - -# Test that #[inline] functions still get inlined across compilation unit -# boundaries. Compilation should produce three IR files, but only the two -# compilation units that have a usage of the #[inline] function should -# contain a definition. Also, the non-#[inline] function should be defined -# in only one compilation unit. - -all: - $(RUSTC) foo.rs --emit=llvm-ir -C codegen-units=3 \ - -Z inline-in-all-cgus - [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ i32\ .*inlined)" -eq "0" ] - [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ internal\ i32\ .*inlined)" -eq "2" ] - [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ hidden\ i32\ .*normal)" -eq "1" ] - [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c declare\ hidden\ i32\ .*normal)" -eq "2" ] diff --git a/tests/run-make-fulldeps/sepcomp-inlining/foo.rs b/tests/run-make-fulldeps/sepcomp-inlining/foo.rs deleted file mode 100644 index 2fe5f9cb726..00000000000 --- a/tests/run-make-fulldeps/sepcomp-inlining/foo.rs +++ /dev/null @@ -1,30 +0,0 @@ -#![feature(start)] - -#[inline] -fn inlined() -> u32 { - 1234 -} - -fn normal() -> u32 { - 2345 -} - -mod a { - pub fn f() -> u32 { - ::inlined() + ::normal() - } -} - -mod b { - pub fn f() -> u32 { - ::inlined() + ::normal() - } -} - -#[start] -fn start(_: isize, _: *const *const u8) -> isize { - a::f(); - b::f(); - - 0 -} diff --git a/tests/run-make-fulldeps/sepcomp-separate/Makefile b/tests/run-make-fulldeps/sepcomp-separate/Makefile deleted file mode 100644 index 62cf54a88fb..00000000000 --- a/tests/run-make-fulldeps/sepcomp-separate/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# Test that separate compilation actually puts code into separate compilation -# units. `foo.rs` defines `magic_fn` in three different modules, which should -# wind up in three different compilation units. - -all: - $(RUSTC) foo.rs --emit=llvm-ir -C codegen-units=3 - [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ .*magic_fn)" -eq "3" ] diff --git a/tests/run-make-fulldeps/sepcomp-separate/foo.rs b/tests/run-make-fulldeps/sepcomp-separate/foo.rs deleted file mode 100644 index 169bafa9b3a..00000000000 --- a/tests/run-make-fulldeps/sepcomp-separate/foo.rs +++ /dev/null @@ -1,21 +0,0 @@ -fn magic_fn() -> usize { - 1234 -} - -mod a { - pub fn magic_fn() -> usize { - 2345 - } -} - -mod b { - pub fn magic_fn() -> usize { - 3456 - } -} - -fn main() { - magic_fn(); - a::magic_fn(); - b::magic_fn(); -} diff --git a/tests/run-make-fulldeps/share-generics-dylib/Makefile b/tests/run-make-fulldeps/share-generics-dylib/Makefile deleted file mode 100644 index 065fb574c3c..00000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# This test makes sure all generic instances get re-exported from Rust dylibs for use by -# `-Zshare-generics`. There are two rlibs (`instance_provider_a` and `instance_provider_b`) -# which both provide an instance of `Cell::set`. There is `instance_user_dylib` which is -# supposed to re-export both these instances, and then there are `instance_user_a_rlib` and -# `instance_user_b_rlib` which each rely on a specific instance to be available. -# -# In the end everything is linked together into `linked_leaf`. If `instance_user_dylib` does -# not export both then we'll get an `undefined reference` error for one of the instances. -# -# This is regression test for https://github.com/rust-lang/rust/issues/67276. - -include ../../run-make-fulldeps/tools.mk - -COMMON_ARGS=-Cprefer-dynamic -Zshare-generics=yes -Ccodegen-units=1 -Csymbol-mangling-version=v0 - -all: - $(RUSTC) instance_provider_a.rs $(COMMON_ARGS) --crate-type=rlib - $(RUSTC) instance_provider_b.rs $(COMMON_ARGS) --crate-type=rlib - $(RUSTC) instance_user_dylib.rs $(COMMON_ARGS) --crate-type=dylib - $(RUSTC) instance_user_a_rlib.rs $(COMMON_ARGS) --crate-type=rlib - $(RUSTC) instance_user_b_rlib.rs $(COMMON_ARGS) --crate-type=rlib - $(RUSTC) linked_leaf.rs $(COMMON_ARGS) --crate-type=bin diff --git a/tests/run-make-fulldeps/share-generics-dylib/instance_provider_a.rs b/tests/run-make-fulldeps/share-generics-dylib/instance_provider_a.rs deleted file mode 100644 index b4e125ac052..00000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/instance_provider_a.rs +++ /dev/null @@ -1,6 +0,0 @@ -use std::cell::Cell; - -pub fn foo() { - let a: Cell = Cell::new(1); - a.set(123); -} diff --git a/tests/run-make-fulldeps/share-generics-dylib/instance_provider_b.rs b/tests/run-make-fulldeps/share-generics-dylib/instance_provider_b.rs deleted file mode 100644 index f613db873e6..00000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/instance_provider_b.rs +++ /dev/null @@ -1,6 +0,0 @@ -use std::cell::Cell; - -pub fn foo() { - let b: Cell = Cell::new(1); - b.set(123); -} diff --git a/tests/run-make-fulldeps/share-generics-dylib/instance_user_a_rlib.rs b/tests/run-make-fulldeps/share-generics-dylib/instance_user_a_rlib.rs deleted file mode 100644 index c8e6ab95cf9..00000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/instance_user_a_rlib.rs +++ /dev/null @@ -1,9 +0,0 @@ -extern crate instance_provider_a as upstream; -use std::cell::Cell; - -pub fn foo() { - upstream::foo(); - - let b: Cell = Cell::new(1); - b.set(123); -} diff --git a/tests/run-make-fulldeps/share-generics-dylib/instance_user_b_rlib.rs b/tests/run-make-fulldeps/share-generics-dylib/instance_user_b_rlib.rs deleted file mode 100644 index 7c34af6d0dc..00000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/instance_user_b_rlib.rs +++ /dev/null @@ -1,9 +0,0 @@ -extern crate instance_provider_b as upstream; -use std::cell::Cell; - -pub fn foo() { - upstream::foo(); - - let b: Cell = Cell::new(1); - b.set(123); -} diff --git a/tests/run-make-fulldeps/share-generics-dylib/instance_user_dylib.rs b/tests/run-make-fulldeps/share-generics-dylib/instance_user_dylib.rs deleted file mode 100644 index 7c8368eec65..00000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/instance_user_dylib.rs +++ /dev/null @@ -1,7 +0,0 @@ -extern crate instance_provider_a; -extern crate instance_provider_b; - -pub fn foo() { - instance_provider_a::foo(); - instance_provider_b::foo(); -} diff --git a/tests/run-make-fulldeps/share-generics-dylib/linked_leaf.rs b/tests/run-make-fulldeps/share-generics-dylib/linked_leaf.rs deleted file mode 100644 index e510dad691c..00000000000 --- a/tests/run-make-fulldeps/share-generics-dylib/linked_leaf.rs +++ /dev/null @@ -1,15 +0,0 @@ -extern crate instance_user_dylib; -extern crate instance_user_a_rlib; -extern crate instance_user_b_rlib; - -use std::cell::Cell; - -fn main() { - - instance_user_a_rlib::foo(); - instance_user_b_rlib::foo(); - instance_user_dylib::foo(); - - let a: Cell = Cell::new(1); - a.set(123); -} diff --git a/tests/run-make-fulldeps/simd-ffi/Makefile b/tests/run-make-fulldeps/simd-ffi/Makefile deleted file mode 100644 index 29735347041..00000000000 --- a/tests/run-make-fulldeps/simd-ffi/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -include ../tools.mk - -TARGETS = -ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm) -# construct a fairly exhaustive list of platforms that we -# support. These ones don't follow a pattern -TARGETS += arm-linux-androideabi arm-unknown-linux-gnueabihf arm-unknown-linux-gnueabi -endif - -ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) -X86_ARCHS = i686 x86_64 -else -X86_ARCHS = -endif - -# these ones do, each OS lists the architectures it supports -LINUX=$(filter aarch64 mips,$(LLVM_COMPONENTS)) $(X86_ARCHS) -ifeq ($(filter mips,$(LLVM_COMPONENTS)),mips) -LINUX += mipsel -endif - -WINDOWS=$(X86_ARCHS) -# fails with: failed to get iphonesimulator SDK path: no such file or directory -#IOS=i386 aarch64 armv7 -DARWIN=$(X86_ARCHS) - -$(foreach arch,$(LINUX),$(eval TARGETS += $(arch)-unknown-linux-gnu)) -$(foreach arch,$(WINDOWS),$(eval TARGETS += $(arch)-pc-windows-gnu)) -#$(foreach arch,$(IOS),$(eval TARGETS += $(arch)-apple-ios)) -$(foreach arch,$(DARWIN),$(eval TARGETS += $(arch)-apple-darwin)) - -all: $(TARGETS) - -define MK_TARGETS -# compile the rust file to the given target, but only to asm and IR -# form, to avoid having to have an appropriate linker. -# -# we need some features because the integer SIMD instructions are not -# enabled by-default for i686 and ARM; these features will be invalid -# on some platforms, but LLVM just prints a warning so that's fine for -# now. -$(1): simd.rs - $$(RUSTC) --target=$(1) --emit=llvm-ir,asm simd.rs \ - -C target-feature='+neon,+sse2' -C extra-filename=-$(1) -endef - -$(foreach targetxxx,$(TARGETS),$(eval $(call MK_TARGETS,$(targetxxx)))) diff --git a/tests/run-make-fulldeps/simd-ffi/simd.rs b/tests/run-make-fulldeps/simd-ffi/simd.rs deleted file mode 100644 index d11cfd77c5b..00000000000 --- a/tests/run-make-fulldeps/simd-ffi/simd.rs +++ /dev/null @@ -1,82 +0,0 @@ -// ensures that public symbols are not removed completely -#![crate_type = "lib"] -// we can compile to a variety of platforms, because we don't need -// cross-compiled standard libraries. -#![feature(no_core, auto_traits)] -#![no_core] -#![feature(repr_simd, simd_ffi, link_llvm_intrinsics, lang_items, rustc_attrs)] - -#[derive(Copy)] -#[repr(simd)] -pub struct f32x4(f32, f32, f32, f32); - -extern "C" { - #[link_name = "llvm.sqrt.v4f32"] - fn vsqrt(x: f32x4) -> f32x4; -} - -pub fn foo(x: f32x4) -> f32x4 { - unsafe { vsqrt(x) } -} - -#[derive(Copy)] -#[repr(simd)] -pub struct i32x4(i32, i32, i32, i32); - -extern "C" { - // _mm_sll_epi32 - #[cfg(any(target_arch = "x86", target_arch = "x86-64"))] - #[link_name = "llvm.x86.sse2.psll.d"] - fn integer(a: i32x4, b: i32x4) -> i32x4; - - // vmaxq_s32 - #[cfg(target_arch = "arm")] - #[link_name = "llvm.arm.neon.vmaxs.v4i32"] - fn integer(a: i32x4, b: i32x4) -> i32x4; - // vmaxq_s32 - #[cfg(target_arch = "aarch64")] - #[link_name = "llvm.aarch64.neon.maxs.v4i32"] - fn integer(a: i32x4, b: i32x4) -> i32x4; - - // just some substitute foreign symbol, not an LLVM intrinsic; so - // we still get type checking, but not as detailed as (ab)using - // LLVM. - #[cfg(not(any( - target_arch = "x86", - target_arch = "x86-64", - target_arch = "arm", - target_arch = "aarch64" - )))] - fn integer(a: i32x4, b: i32x4) -> i32x4; -} - -pub fn bar(a: i32x4, b: i32x4) -> i32x4 { - unsafe { integer(a, b) } -} - -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -pub trait Copy {} - -impl Copy for f32 {} -impl Copy for i32 {} - -pub mod marker { - pub use Copy; -} - -#[lang = "freeze"] -auto trait Freeze {} - -#[macro_export] -#[rustc_builtin_macro] -macro_rules! Copy { - () => {}; -} -#[macro_export] -#[rustc_builtin_macro] -macro_rules! derive { - () => {}; -} diff --git a/tests/run-make-fulldeps/simple-dylib/Makefile b/tests/run-make-fulldeps/simple-dylib/Makefile deleted file mode 100644 index 5dda5d66d1c..00000000000 --- a/tests/run-make-fulldeps/simple-dylib/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk -all: - $(RUSTC) bar.rs --crate-type=dylib -C prefer-dynamic - $(RUSTC) foo.rs - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/simple-dylib/bar.rs b/tests/run-make-fulldeps/simple-dylib/bar.rs deleted file mode 100644 index c5c0bc606cd..00000000000 --- a/tests/run-make-fulldeps/simple-dylib/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/simple-dylib/foo.rs b/tests/run-make-fulldeps/simple-dylib/foo.rs deleted file mode 100644 index 8d68535e3b6..00000000000 --- a/tests/run-make-fulldeps/simple-dylib/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate bar; - -fn main() { - bar::bar(); -} diff --git a/tests/run-make-fulldeps/simple-rlib/Makefile b/tests/run-make-fulldeps/simple-rlib/Makefile deleted file mode 100644 index d912b8a7bab..00000000000 --- a/tests/run-make-fulldeps/simple-rlib/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk -all: - $(RUSTC) bar.rs --crate-type=rlib - $(RUSTC) foo.rs - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/simple-rlib/bar.rs b/tests/run-make-fulldeps/simple-rlib/bar.rs deleted file mode 100644 index c5c0bc606cd..00000000000 --- a/tests/run-make-fulldeps/simple-rlib/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/simple-rlib/foo.rs b/tests/run-make-fulldeps/simple-rlib/foo.rs deleted file mode 100644 index 8d68535e3b6..00000000000 --- a/tests/run-make-fulldeps/simple-rlib/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate bar; - -fn main() { - bar::bar(); -} diff --git a/tests/run-make-fulldeps/split-debuginfo/Makefile b/tests/run-make-fulldeps/split-debuginfo/Makefile deleted file mode 100644 index 44cda0d3d11..00000000000 --- a/tests/run-make-fulldeps/split-debuginfo/Makefile +++ /dev/null @@ -1,308 +0,0 @@ -include ../tools.mk - -all: off packed unpacked - -ifeq ($(UNAME),Darwin) -# If disabled, don't run `dsymutil`. -off: - rm -rf $(TMPDIR)/*.dSYM - $(RUSTC) foo.rs -g -C split-debuginfo=off - [ ! -d $(TMPDIR)/foo.dSYM ] - -# Packed by default, but only if debuginfo is requested -packed: - rm -rf $(TMPDIR)/*.dSYM - $(RUSTC) foo.rs - [ ! -d $(TMPDIR)/foo.dSYM ] - rm -rf $(TMPDIR)/*.dSYM - $(RUSTC) foo.rs -g - [ -d $(TMPDIR)/foo.dSYM ] - rm -rf $(TMPDIR)/*.dSYM - $(RUSTC) foo.rs -g -C split-debuginfo=packed - [ -d $(TMPDIR)/foo.dSYM ] - rm -rf $(TMPDIR)/*.dSYM - -# Object files are preserved with unpacked and `dsymutil` isn't run -unpacked: - $(RUSTC) foo.rs -g -C split-debuginfo=unpacked - ls $(TMPDIR)/*.o - [ ! -d $(TMPDIR)/foo.dSYM ] -else -ifdef IS_WINDOWS -# Windows only supports packed debuginfo - nothing to test. -off: -packed: -unpacked: -else -# Some non-Windows, non-Darwin platforms are not stable, and some are. -ifeq ($(UNAME),Linux) - UNSTABLEOPTS := -else - UNSTABLEOPTS := -Zunstable-options -endif - -# - Debuginfo in `.o` files -# - `.o` deleted -# - `.dwo` never created -# - `.dwp` never created -off: - $(RUSTC) foo.rs -g -C $(UNSTABLEOPTS) split-debuginfo=off - [ ! -f $(TMPDIR)/*.dwp ] - [ ! -f $(TMPDIR)/*.dwo ] - $(RUSTC) foo.rs -g - [ ! -f $(TMPDIR)/*.dwp ] - [ ! -f $(TMPDIR)/*.dwo ] - -packed: packed-split packed-single packed-lto packed-remapped packed-crosscrate - -# - Debuginfo in `.dwo` files -# - `.o` deleted -# - `.dwo` deleted -# - `.dwp` present -packed-split: - $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=packed -Zsplit-dwarf-kind=split - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` deleted -# - `.dwo` never created -# - `.dwp` present -packed-single: - $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=packed -Zsplit-dwarf-kind=single - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -packed-lto: packed-lto-split packed-lto-single - -# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` never created -# - `.dwo` never created -# - `.dwp` never created -packed-lto-split: - $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split \ - --crate-type=rlib -Clinker-plugin-lto - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/libbaz.rlib - -# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` never created -# - `.dwo` never created -# - `.dwp` never created -packed-lto-single: - $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=single \ - --crate-type=rlib -Clinker-plugin-lto - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/libbaz.rlib - -packed-remapped: packed-remapped-split packed-remapped-single - -# - Debuginfo in `.dwo` files -# - `.o` and binary refer to remapped `.dwo` paths which do not exist -# - `.o` deleted -# - `.dwo` deleted -# - `.dwp` present -packed-remapped-split: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ - -Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` and binary refer to remapped `.o` paths which do not exist -# - `.o` deleted -# - `.dwo` never created -# - `.dwp` present -packed-remapped-single: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ - -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -packed-crosscrate: packed-crosscrate-split packed-crosscrate-single - -# - Debuginfo in `.dwo` files -# - (bar) `.rlib` file created, contains `.dwo` -# - (bar) `.o` deleted -# - (bar) `.dwo` deleted -# - (bar) `.dwp` never created -# - (main) `.o` deleted -# - (main) `.dwo` deleted -# - (main) `.dwp` present -packed-crosscrate-split: - $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=packed \ - -Zsplit-dwarf-kind=split -C debuginfo=2 -g bar.rs - ls $(TMPDIR)/*.rlib - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ - -C split-debuginfo=packed -Zsplit-dwarf-kind=split -C debuginfo=2 -g main.rs - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/main.dwp - rm $(TMPDIR)/$(call BIN,main) - -# - Debuginfo in `.o` files -# - (bar) `.rlib` file created, contains `.o` -# - (bar) `.o` deleted -# - (bar) `.dwo` never created -# - (bar) `.dwp` never created -# - (main) `.o` deleted -# - (main) `.dwo` never created -# - (main) `.dwp` present -packed-crosscrate-single: - $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=packed \ - -Zsplit-dwarf-kind=single -C debuginfo=2 -g bar.rs - ls $(TMPDIR)/*.rlib - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ - -C split-debuginfo=packed -Zsplit-dwarf-kind=single -C debuginfo=2 -g main.rs - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/main.dwp - rm $(TMPDIR)/$(call BIN,main) - -unpacked: unpacked-split unpacked-single unpacked-lto unpacked-remapped unpacked-crosscrate - -# - Debuginfo in `.dwo` files -# - `.o` deleted -# - `.dwo` present -# - `.dwp` never created -unpacked-split: - $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=unpacked -Zsplit-dwarf-kind=split - ls $(TMPDIR)/*.o && exit 1 || exit 0 - rm $(TMPDIR)/*.dwo - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` present -# - `.dwo` never created -# - `.dwp` never created -unpacked-single: - $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=unpacked -Zsplit-dwarf-kind=single - ls $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -unpacked-lto: packed-lto-split packed-lto-single - -# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` never created -# - `.dwo` never created -# - `.dwp` never created -unpacked-lto-split: - $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=split \ - --crate-type=rlib -Clinker-plugin-lto - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/libbaz.rlib - -# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` never created -# - `.dwo` never created -# - `.dwp` never created -unpacked-lto-single: - $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=single \ - --crate-type=rlib -Clinker-plugin-lto - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/libbaz.rlib - -unpacked-remapped: unpacked-remapped-split unpacked-remapped-single - -# - Debuginfo in `.dwo` files -# - `.o` and binary refer to remapped `.dwo` paths which do not exist -# - `.o` deleted -# - `.dwo` present -# - `.dwp` never created -unpacked-remapped-split: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ - -Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - ls $(TMPDIR)/*.o && exit 1 || exit 0 - rm $(TMPDIR)/*.dwo - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` and binary refer to remapped `.o` paths which do not exist -# - `.o` present -# - `.dwo` never created -# - `.dwp` never created -unpacked-remapped-single: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ - -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - rm $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -unpacked-crosscrate: unpacked-crosscrate-split unpacked-crosscrate-single - -# - Debuginfo in `.dwo` files -# - (bar) `.rlib` file created, contains `.dwo` -# - (bar) `.o` deleted -# - (bar) `.dwo` present -# - (bar) `.dwp` never created -# - (main) `.o` deleted -# - (main) `.dwo` present -# - (main) `.dwp` never created -unpacked-crosscrate-split: - $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=unpacked \ - -Zsplit-dwarf-kind=split -C debuginfo=2 -g bar.rs - ls $(TMPDIR)/*.rlib - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ - -C split-debuginfo=unpacked -Zsplit-dwarf-kind=split -C debuginfo=2 -g main.rs - ls $(TMPDIR)/*.o && exit 1 || exit 0 - rm $(TMPDIR)/*.dwo - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,main) - -# - Debuginfo in `.o` files -# - (bar) `.rlib` file created, contains `.o` -# - (bar) `.o` present -# - (bar) `.dwo` never created -# - (bar) `.dwp` never created -# - (main) `.o` present -# - (main) `.dwo` never created -# - (main) `.dwp` never created -unpacked-crosscrate-single: - $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=unpacked \ - -Zsplit-dwarf-kind=single -C debuginfo=2 -g bar.rs - ls $(TMPDIR)/*.rlib - ls $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ - -C split-debuginfo=unpacked -Zsplit-dwarf-kind=single -C debuginfo=2 -g main.rs - ls $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,main) -endif -endif diff --git a/tests/run-make-fulldeps/split-debuginfo/bar.rs b/tests/run-make-fulldeps/split-debuginfo/bar.rs deleted file mode 100644 index 07dd0715252..00000000000 --- a/tests/run-make-fulldeps/split-debuginfo/bar.rs +++ /dev/null @@ -1,13 +0,0 @@ -pub struct Bar { - x: u32, -} - -impl Bar { - pub fn print(&self) { - println!("{}", self.x); - } -} - -pub fn make_bar(x: u32) -> Bar { - Bar { x } -} diff --git a/tests/run-make-fulldeps/split-debuginfo/baz.rs b/tests/run-make-fulldeps/split-debuginfo/baz.rs deleted file mode 100644 index 8b1a393741c..00000000000 --- a/tests/run-make-fulldeps/split-debuginfo/baz.rs +++ /dev/null @@ -1 +0,0 @@ -// empty diff --git a/tests/run-make-fulldeps/split-debuginfo/foo.rs b/tests/run-make-fulldeps/split-debuginfo/foo.rs deleted file mode 100644 index b058e540862..00000000000 --- a/tests/run-make-fulldeps/split-debuginfo/foo.rs +++ /dev/null @@ -1,15 +0,0 @@ -pub struct Foo { - x: u32, -} - -impl Foo { - pub fn print(&self) { - println!("{}", self.x); - } -} - -pub fn make_foo(x: u32) -> Foo { - Foo { x } -} - -fn main() {} diff --git a/tests/run-make-fulldeps/split-debuginfo/main.rs b/tests/run-make-fulldeps/split-debuginfo/main.rs deleted file mode 100644 index 21fa16e40a4..00000000000 --- a/tests/run-make-fulldeps/split-debuginfo/main.rs +++ /dev/null @@ -1,8 +0,0 @@ -extern crate bar; - -use bar::{Bar, make_bar}; - -fn main() { - let b = make_bar(3); - b.print(); -} diff --git a/tests/run-make-fulldeps/stable-symbol-names/Makefile b/tests/run-make-fulldeps/stable-symbol-names/Makefile deleted file mode 100644 index bbfb8e38881..00000000000 --- a/tests/run-make-fulldeps/stable-symbol-names/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -include ../tools.mk - -# The following command will: -# 1. dump the symbols of a library using `nm` -# 2. extract only those lines that we are interested in via `grep` -# 3. from those lines, extract just the symbol name via `sed`, which: -# * always starts with "_ZN" and ends with "E" (`legacy` mangling) -# * always starts with "_R" (`v0` mangling) -# 4. sort those symbol names for deterministic comparison -# 5. write the result into a file - -dump-symbols = nm "$(TMPDIR)/lib$(1).rlib" \ - | grep -E "$(2)" \ - | sed -E "s/.*(_ZN.*E|_R[a-zA-Z0-9_]*).*/\1/" \ - | sort \ - > "$(TMPDIR)/$(1)$(3).nm" - -# This test -# - compiles each of the two crates 2 times and makes sure each time we get -# exactly the same symbol names -# - makes sure that both crates agree on the same symbol names for monomorphic -# functions - -all: - $(RUSTC) stable-symbol-names1.rs - $(call dump-symbols,stable_symbol_names1,generic_|mono_,_v1) - rm $(TMPDIR)/libstable_symbol_names1.rlib - $(RUSTC) stable-symbol-names1.rs - $(call dump-symbols,stable_symbol_names1,generic_|mono_,_v2) - cmp "$(TMPDIR)/stable_symbol_names1_v1.nm" "$(TMPDIR)/stable_symbol_names1_v2.nm" - - $(RUSTC) stable-symbol-names2.rs - $(call dump-symbols,stable_symbol_names2,generic_|mono_,_v1) - rm $(TMPDIR)/libstable_symbol_names2.rlib - $(RUSTC) stable-symbol-names2.rs - $(call dump-symbols,stable_symbol_names2,generic_|mono_,_v2) - cmp "$(TMPDIR)/stable_symbol_names2_v1.nm" "$(TMPDIR)/stable_symbol_names2_v2.nm" - - $(call dump-symbols,stable_symbol_names1,mono_,_cross) - $(call dump-symbols,stable_symbol_names2,mono_,_cross) - cmp "$(TMPDIR)/stable_symbol_names1_cross.nm" "$(TMPDIR)/stable_symbol_names2_cross.nm" diff --git a/tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names1.rs b/tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names1.rs deleted file mode 100644 index b85a428278c..00000000000 --- a/tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names1.rs +++ /dev/null @@ -1,31 +0,0 @@ -#![crate_type="rlib"] - -pub trait Foo { - fn generic_method(); -} - -pub struct Bar; - -impl Foo for Bar { - fn generic_method() {} -} - -pub fn mono_function() { - Bar::generic_method::(); -} - -pub fn mono_function_lifetime<'a>(x: &'a u64) -> u64 { - *x -} - -pub fn generic_function(t: T) -> T { - t -} - -pub fn user() { - generic_function(0u32); - generic_function("abc"); - let x = 2u64; - generic_function(&x); - let _ = mono_function_lifetime(&x); -} diff --git a/tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names2.rs b/tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names2.rs deleted file mode 100644 index 33df9d6c689..00000000000 --- a/tests/run-make-fulldeps/stable-symbol-names/stable-symbol-names2.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![crate_type="rlib"] - -extern crate stable_symbol_names1; - -pub fn user() { - stable_symbol_names1::generic_function(1u32); - stable_symbol_names1::generic_function("def"); - let x = 2u64; - stable_symbol_names1::generic_function(&x); - stable_symbol_names1::mono_function(); - stable_symbol_names1::mono_function_lifetime(&0); -} - -pub fn trait_impl_test_function() { - use stable_symbol_names1::*; - Bar::generic_method::(); -} diff --git a/tests/run-make-fulldeps/static-dylib-by-default/Makefile b/tests/run-make-fulldeps/static-dylib-by-default/Makefile deleted file mode 100644 index eedd0b32092..00000000000 --- a/tests/run-make-fulldeps/static-dylib-by-default/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -include ../tools.mk - -TO_LINK := $(call DYLIB,bar) -ifdef IS_MSVC -LINK_ARG = $(TO_LINK:dll=dll.lib) -else -LINK_ARG = $(TO_LINK) -endif - -all: - $(RUSTC) foo.rs - $(RUSTC) bar.rs - $(CC) main.c $(call OUT_EXE,main) $(LINK_ARG) $(EXTRACFLAGS) - rm $(TMPDIR)/*.rlib - rm $(call DYLIB,foo) - $(call RUN,main) diff --git a/tests/run-make-fulldeps/static-dylib-by-default/bar.rs b/tests/run-make-fulldeps/static-dylib-by-default/bar.rs deleted file mode 100644 index 14421165e2d..00000000000 --- a/tests/run-make-fulldeps/static-dylib-by-default/bar.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![crate_type = "dylib"] - -extern crate foo; - -#[no_mangle] -pub extern "C" fn bar() { - foo::foo(); -} diff --git a/tests/run-make-fulldeps/static-dylib-by-default/foo.rs b/tests/run-make-fulldeps/static-dylib-by-default/foo.rs deleted file mode 100644 index 7ebec872055..00000000000 --- a/tests/run-make-fulldeps/static-dylib-by-default/foo.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "rlib"] -#![crate_type = "dylib"] - -pub fn foo() {} diff --git a/tests/run-make-fulldeps/static-dylib-by-default/main.c b/tests/run-make-fulldeps/static-dylib-by-default/main.c deleted file mode 100644 index 5f7f2c27cd3..00000000000 --- a/tests/run-make-fulldeps/static-dylib-by-default/main.c +++ /dev/null @@ -1,6 +0,0 @@ -extern void bar(); - -int main() { - bar(); - return 0; -} diff --git a/tests/run-make-fulldeps/static-extern-type/Makefile b/tests/run-make-fulldeps/static-extern-type/Makefile deleted file mode 100644 index e9aa95e63a0..00000000000 --- a/tests/run-make-fulldeps/static-extern-type/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: $(call NATIVE_STATICLIB,define-foo) - $(RUSTC) -ldefine-foo use-foo.rs - $(call RUN,use-foo) || exit 1 diff --git a/tests/run-make-fulldeps/static-extern-type/define-foo.c b/tests/run-make-fulldeps/static-extern-type/define-foo.c deleted file mode 100644 index 39be5acfa11..00000000000 --- a/tests/run-make-fulldeps/static-extern-type/define-foo.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -struct Foo { - uint8_t x; -}; - -struct Foo FOO = { 42 }; - -uint8_t bar(const struct Foo* foo) { - return foo->x; -} diff --git a/tests/run-make-fulldeps/static-extern-type/use-foo.rs b/tests/run-make-fulldeps/static-extern-type/use-foo.rs deleted file mode 100644 index 932b5b5944b..00000000000 --- a/tests/run-make-fulldeps/static-extern-type/use-foo.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(extern_types)] - -extern "C" { - type Foo; - static FOO: Foo; - fn bar(foo: *const Foo) -> u8; -} - -fn main() { - unsafe { - let foo = &FOO; - assert_eq!(bar(foo), 42); - } -} diff --git a/tests/run-make-fulldeps/static-unwinding/Makefile b/tests/run-make-fulldeps/static-unwinding/Makefile deleted file mode 100644 index 9c755d4ab18..00000000000 --- a/tests/run-make-fulldeps/static-unwinding/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) lib.rs - $(RUSTC) main.rs - $(call RUN,main) diff --git a/tests/run-make-fulldeps/static-unwinding/lib.rs b/tests/run-make-fulldeps/static-unwinding/lib.rs deleted file mode 100644 index 3fb1117a110..00000000000 --- a/tests/run-make-fulldeps/static-unwinding/lib.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![crate_type = "rlib"] - -pub static mut statik: isize = 0; - -struct A; -impl Drop for A { - fn drop(&mut self) { - unsafe { statik = 1; } - } -} - -pub fn callback(f: F) where F: FnOnce() { - let _a = A; - f(); -} diff --git a/tests/run-make-fulldeps/static-unwinding/main.rs b/tests/run-make-fulldeps/static-unwinding/main.rs deleted file mode 100644 index 0c66ea1aa07..00000000000 --- a/tests/run-make-fulldeps/static-unwinding/main.rs +++ /dev/null @@ -1,24 +0,0 @@ -extern crate lib; - -use std::thread; - -static mut statik: isize = 0; - -struct A; -impl Drop for A { - fn drop(&mut self) { - unsafe { statik = 1; } - } -} - -fn main() { - thread::spawn(move|| { - let _a = A; - lib::callback(|| panic!()); - }).join().unwrap_err(); - - unsafe { - assert_eq!(lib::statik, 1); - assert_eq!(statik, 1); - } -} diff --git a/tests/run-make-fulldeps/staticlib-blank-lib/Makefile b/tests/run-make-fulldeps/staticlib-blank-lib/Makefile deleted file mode 100644 index fcbf87758fb..00000000000 --- a/tests/run-make-fulldeps/staticlib-blank-lib/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(AR) crus $(TMPDIR)/libfoo.a foo.rs - $(AR) d $(TMPDIR)/libfoo.a foo.rs - $(RUSTC) foo.rs diff --git a/tests/run-make-fulldeps/staticlib-blank-lib/foo.rs b/tests/run-make-fulldeps/staticlib-blank-lib/foo.rs deleted file mode 100644 index bf48d069da9..00000000000 --- a/tests/run-make-fulldeps/staticlib-blank-lib/foo.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "staticlib"] - -#[link(name = "foo", kind = "static")] -extern "C" {} - -fn main() {} diff --git a/tests/run-make-fulldeps/std-core-cycle/Makefile b/tests/run-make-fulldeps/std-core-cycle/Makefile deleted file mode 100644 index 4f252863767..00000000000 --- a/tests/run-make-fulldeps/std-core-cycle/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -include ../tools.mk - -ifeq ($(UNAME),Darwin) -FLAGS := -else -ifdef IS_WINDOWS -FLAGS := -else -FLAGS := -C link-args=-Wl,--no-undefined -endif -endif - -all: - $(RUSTC) bar.rs - $(RUSTC) foo.rs $(FLAGS) - $(RUSTC) foo.rs $(FLAGS) -C panic=abort diff --git a/tests/run-make-fulldeps/std-core-cycle/bar.rs b/tests/run-make-fulldeps/std-core-cycle/bar.rs deleted file mode 100644 index 9f5e7c29bdd..00000000000 --- a/tests/run-make-fulldeps/std-core-cycle/bar.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(allocator_api)] -#![crate_type = "rlib"] - -use std::alloc::*; - -pub struct A; - -unsafe impl GlobalAlloc for A { - unsafe fn alloc(&self, _: Layout) -> *mut u8 { - loop {} - } - - unsafe fn dealloc(&self, _ptr: *mut u8, _: Layout) { - loop {} - } -} diff --git a/tests/run-make-fulldeps/std-core-cycle/foo.rs b/tests/run-make-fulldeps/std-core-cycle/foo.rs deleted file mode 100644 index 6aa6e1ac3c5..00000000000 --- a/tests/run-make-fulldeps/std-core-cycle/foo.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![crate_type = "cdylib"] - -extern crate bar; - -#[global_allocator] -static A: bar::A = bar::A; - -#[no_mangle] -pub extern "C" fn a(a: u32, b: u32) -> u32 { - a / b -} diff --git a/tests/run-make-fulldeps/stdin-non-utf8/Makefile b/tests/run-make-fulldeps/stdin-non-utf8/Makefile deleted file mode 100644 index 709d4cf1408..00000000000 --- a/tests/run-make-fulldeps/stdin-non-utf8/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - cp non-utf8 $(TMPDIR)/non-utf.rs - cat $(TMPDIR)/non-utf.rs | $(RUSTC) - 2>&1 \ - | $(CGREP) "error: couldn't read from stdin, as it did not contain valid UTF-8" diff --git a/tests/run-make-fulldeps/stdin-non-utf8/non-utf8 b/tests/run-make-fulldeps/stdin-non-utf8/non-utf8 deleted file mode 100644 index bc87051a852..00000000000 --- a/tests/run-make-fulldeps/stdin-non-utf8/non-utf8 +++ /dev/null @@ -1 +0,0 @@ -Ò diff --git a/tests/run-make-fulldeps/suspicious-library/Makefile b/tests/run-make-fulldeps/suspicious-library/Makefile deleted file mode 100644 index 2af9e85c228..00000000000 --- a/tests/run-make-fulldeps/suspicious-library/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs -C prefer-dynamic - touch $(call DYLIB,foo-something-special) - touch $(call DYLIB,foo-something-special2) - $(RUSTC) bar.rs diff --git a/tests/run-make-fulldeps/suspicious-library/bar.rs b/tests/run-make-fulldeps/suspicious-library/bar.rs deleted file mode 100644 index 550c94cd0c6..00000000000 --- a/tests/run-make-fulldeps/suspicious-library/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ -extern crate foo; - -fn main() { foo::foo() } diff --git a/tests/run-make-fulldeps/suspicious-library/foo.rs b/tests/run-make-fulldeps/suspicious-library/foo.rs deleted file mode 100644 index a382d8f2c7f..00000000000 --- a/tests/run-make-fulldeps/suspicious-library/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "dylib"] - -pub fn foo() {} diff --git a/tests/run-make-fulldeps/symbol-visibility/Makefile b/tests/run-make-fulldeps/symbol-visibility/Makefile deleted file mode 100644 index 17052ef4e63..00000000000 --- a/tests/run-make-fulldeps/symbol-visibility/Makefile +++ /dev/null @@ -1,122 +0,0 @@ -include ../tools.mk - -# ignore-windows-msvc - -NM=nm -D -CDYLIB_NAME=liba_cdylib.so -RDYLIB_NAME=liba_rust_dylib.so -PROC_MACRO_NAME=liba_proc_macro.so -EXE_NAME=an_executable -COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.so - -ifeq ($(UNAME),Darwin) -NM=nm -gU -CDYLIB_NAME=liba_cdylib.dylib -RDYLIB_NAME=liba_rust_dylib.dylib -PROC_MACRO_NAME=liba_proc_macro.dylib -EXE_NAME=an_executable -COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.dylib -endif - -ifdef IS_WINDOWS -NM=nm -g -CDYLIB_NAME=liba_cdylib.dll.a -RDYLIB_NAME=liba_rust_dylib.dll.a -PROC_MACRO_NAME=liba_proc_macro.dll -EXE_NAME=an_executable.exe -COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.dll.a -endif - -# `grep` regex for symbols produced by either `legacy` or `v0` mangling -RE_ANY_RUST_SYMBOL="_ZN.*h.*E\|_R[a-zA-Z0-9_]+" - -all: - $(RUSTC) -Zshare-generics=no an_rlib.rs - $(RUSTC) -Zshare-generics=no a_cdylib.rs - $(RUSTC) -Zshare-generics=no a_rust_dylib.rs - $(RUSTC) -Zshare-generics=no a_proc_macro.rs - $(RUSTC) -Zshare-generics=no an_executable.rs - $(RUSTC) -Zshare-generics=no a_cdylib.rs --crate-name combined_rlib_dylib --crate-type=rlib,cdylib - - # Check that a cdylib exports its public #[no_mangle] functions - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] - # Check that a cdylib exports the public #[no_mangle] functions of dependencies - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - # Check that a cdylib DOES NOT export any public Rust functions - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] - - # Check that a Rust dylib exports its monomorphic functions - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rust_dylib)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rust_dylib)" -eq "1" ] - # Check that a Rust dylib does not export generics if -Zshare-generics=no - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rust_dylib)" -eq "0" ] - - - # Check that a Rust dylib exports the monomorphic functions from its dependencies - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rlib)" -eq "1" ] - # Check that a Rust dylib does not export generics if -Zshare-generics=no - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rlib)" -eq "0" ] - - # Check that a proc macro exports its public #[no_mangle] functions - # FIXME(#99978) avoid exporting #[no_mangle] symbols for proc macros - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] - # Check that a proc macro exports the public #[no_mangle] functions of dependencies - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - # Check that a proc macro DOES NOT export any public Rust functions - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] - -# FIXME(nbdd0121): This is broken in MinGW, see https://github.com/rust-lang/rust/pull/95604#issuecomment-1101564032 -ifndef IS_WINDOWS - # Check that an executable does not export any dynamic symbols - [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "0" ] - [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_rust_function_from_exe)" -eq "0" ] -endif - - - # Check the combined case, where we generate a cdylib and an rlib in the same - # compilation session: - # Check that a cdylib exports its public #[no_mangle] functions - [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] - # Check that a cdylib exports the public #[no_mangle] functions of dependencies - [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - # Check that a cdylib DOES NOT export any public Rust functions - [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] - - - $(RUSTC) -Zshare-generics=yes an_rlib.rs - $(RUSTC) -Zshare-generics=yes a_cdylib.rs - $(RUSTC) -Zshare-generics=yes a_rust_dylib.rs - $(RUSTC) -Zshare-generics=yes a_proc_macro.rs - $(RUSTC) -Zshare-generics=yes an_executable.rs - - # Check that a cdylib exports its public #[no_mangle] functions - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] - # Check that a cdylib exports the public #[no_mangle] functions of dependencies - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - # Check that a cdylib DOES NOT export any public Rust functions - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] - - # Check that a Rust dylib exports its monomorphic functions, including generics this time - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rust_dylib)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rust_dylib)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rust_dylib)" -eq "1" ] - - # Check that a Rust dylib exports the monomorphic functions from its dependencies - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rlib)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rlib)" -eq "1" ] - - # Check that a proc macro exports its public #[no_mangle] functions - # FIXME(#99978) avoid exporting #[no_mangle] symbols for proc macros - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] - # Check that a proc macro exports the public #[no_mangle] functions of dependencies - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] - # Check that a proc macro DOES NOT export any public Rust functions - [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] - -ifndef IS_WINDOWS - # Check that an executable does not export any dynamic symbols - [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "0" ] - [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_rust_function_from_exe)" -eq "0" ] -endif diff --git a/tests/run-make-fulldeps/symbol-visibility/a_cdylib.rs b/tests/run-make-fulldeps/symbol-visibility/a_cdylib.rs deleted file mode 100644 index d4fbff85bfe..00000000000 --- a/tests/run-make-fulldeps/symbol-visibility/a_cdylib.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type="cdylib"] - -extern crate an_rlib; - -// This should not be exported -pub fn public_rust_function_from_cdylib() {} - -// This should be exported -#[no_mangle] -pub extern "C" fn public_c_function_from_cdylib() { - an_rlib::public_c_function_from_rlib(); -} diff --git a/tests/run-make-fulldeps/symbol-visibility/a_proc_macro.rs b/tests/run-make-fulldeps/symbol-visibility/a_proc_macro.rs deleted file mode 100644 index 9fd1a8a6717..00000000000 --- a/tests/run-make-fulldeps/symbol-visibility/a_proc_macro.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_type = "proc-macro"] - -extern crate an_rlib; - -// This should not be exported -#[no_mangle] -extern "C" fn public_c_function_from_cdylib() { - an_rlib::public_c_function_from_rlib(); -} diff --git a/tests/run-make-fulldeps/symbol-visibility/a_rust_dylib.rs b/tests/run-make-fulldeps/symbol-visibility/a_rust_dylib.rs deleted file mode 100644 index a47df0ab7ee..00000000000 --- a/tests/run-make-fulldeps/symbol-visibility/a_rust_dylib.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![crate_type="dylib"] - -extern crate an_rlib; - -// This should be exported -pub fn public_rust_function_from_rust_dylib() {} - -// This should be exported -#[no_mangle] -pub extern "C" fn public_c_function_from_rust_dylib() { - let _ = public_generic_function_from_rust_dylib(1u16); -} - -// This should be exported if -Zshare-generics=yes -pub fn public_generic_function_from_rust_dylib(x: T) -> T { x } diff --git a/tests/run-make-fulldeps/symbol-visibility/an_executable.rs b/tests/run-make-fulldeps/symbol-visibility/an_executable.rs deleted file mode 100644 index 3f5e125ad19..00000000000 --- a/tests/run-make-fulldeps/symbol-visibility/an_executable.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type="bin"] - -extern crate an_rlib; - -pub fn public_rust_function_from_exe() {} - -fn main() {} diff --git a/tests/run-make-fulldeps/symbol-visibility/an_rlib.rs b/tests/run-make-fulldeps/symbol-visibility/an_rlib.rs deleted file mode 100644 index 3696422b11e..00000000000 --- a/tests/run-make-fulldeps/symbol-visibility/an_rlib.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type="rlib"] - -pub fn public_rust_function_from_rlib() {} - -#[no_mangle] -pub extern "C" fn public_c_function_from_rlib() { - let _ = public_generic_function_from_rlib(0u64); -} - -pub fn public_generic_function_from_rlib(x: T) -> T { - x -} diff --git a/tests/run-make-fulldeps/symbols-include-type-name/Makefile b/tests/run-make-fulldeps/symbols-include-type-name/Makefile deleted file mode 100644 index ac26a852e36..00000000000 --- a/tests/run-make-fulldeps/symbols-include-type-name/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# Check that symbol names for methods include type names, instead of . - -OUT=$(TMPDIR)/lib.s - -all: - $(RUSTC) --crate-type staticlib --emit asm lib.rs - $(CGREP) Def < $(OUT) diff --git a/tests/run-make-fulldeps/symbols-include-type-name/lib.rs b/tests/run-make-fulldeps/symbols-include-type-name/lib.rs deleted file mode 100644 index 37d44591767..00000000000 --- a/tests/run-make-fulldeps/symbols-include-type-name/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub struct Def { - pub id: i32, -} - -impl Def { - pub fn new(id: i32) -> Def { - Def { id: id } - } -} - -#[no_mangle] -pub fn user() { - let _ = Def::new(0); -} diff --git a/tests/run-make-fulldeps/symlinked-extern/Makefile b/tests/run-make-fulldeps/symlinked-extern/Makefile deleted file mode 100644 index 058f43e857a..00000000000 --- a/tests/run-make-fulldeps/symlinked-extern/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# ignore-windows -# `ln` is actually `cp` on msys. - -all: - $(RUSTC) foo.rs - mkdir -p $(TMPDIR)/other - ln -nsf $(TMPDIR)/libfoo.rlib $(TMPDIR)/other - $(RUSTC) bar.rs -L $(TMPDIR) - $(RUSTC) baz.rs --extern foo=$(TMPDIR)/other/libfoo.rlib -L $(TMPDIR) diff --git a/tests/run-make-fulldeps/symlinked-extern/bar.rs b/tests/run-make-fulldeps/symlinked-extern/bar.rs deleted file mode 100644 index cd9c959d5e6..00000000000 --- a/tests/run-make-fulldeps/symlinked-extern/bar.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "rlib"] - -extern crate foo; - -pub fn bar(_s: foo::S) { -} diff --git a/tests/run-make-fulldeps/symlinked-extern/baz.rs b/tests/run-make-fulldeps/symlinked-extern/baz.rs deleted file mode 100644 index cd433a3ac7a..00000000000 --- a/tests/run-make-fulldeps/symlinked-extern/baz.rs +++ /dev/null @@ -1,6 +0,0 @@ -extern crate bar; -extern crate foo; - -fn main() { - bar::bar(foo::foo()); -} diff --git a/tests/run-make-fulldeps/symlinked-extern/foo.rs b/tests/run-make-fulldeps/symlinked-extern/foo.rs deleted file mode 100644 index c00700b8cf8..00000000000 --- a/tests/run-make-fulldeps/symlinked-extern/foo.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![crate_type = "rlib"] - -pub struct S; - -pub fn foo() -> S { S } diff --git a/tests/run-make-fulldeps/symlinked-libraries/Makefile b/tests/run-make-fulldeps/symlinked-libraries/Makefile deleted file mode 100644 index 576bf7e54be..00000000000 --- a/tests/run-make-fulldeps/symlinked-libraries/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -include ../tools.mk - -# ignore-windows -# `ln` is actually `cp` on msys. - -all: - $(RUSTC) foo.rs -C prefer-dynamic - mkdir -p $(TMPDIR)/other - ln -nsf $(TMPDIR)/$(call DYLIB_GLOB,foo) $(TMPDIR)/other - $(RUSTC) bar.rs -L $(TMPDIR)/other diff --git a/tests/run-make-fulldeps/symlinked-libraries/bar.rs b/tests/run-make-fulldeps/symlinked-libraries/bar.rs deleted file mode 100644 index fde0d746634..00000000000 --- a/tests/run-make-fulldeps/symlinked-libraries/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::bar(); -} diff --git a/tests/run-make-fulldeps/symlinked-libraries/foo.rs b/tests/run-make-fulldeps/symlinked-libraries/foo.rs deleted file mode 100644 index cde9e291b45..00000000000 --- a/tests/run-make-fulldeps/symlinked-libraries/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![crate_type = "dylib"] - -pub fn bar() {} diff --git a/tests/run-make-fulldeps/symlinked-rlib/Makefile b/tests/run-make-fulldeps/symlinked-rlib/Makefile deleted file mode 100644 index 49d3f220a35..00000000000 --- a/tests/run-make-fulldeps/symlinked-rlib/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# ignore-windows -# `ln` is actually `cp` on msys. - -all: - $(RUSTC) foo.rs --crate-type=rlib -o $(TMPDIR)/foo.xxx - ln -nsf $(TMPDIR)/foo.xxx $(TMPDIR)/libfoo.rlib - $(RUSTC) bar.rs -L $(TMPDIR) diff --git a/tests/run-make-fulldeps/symlinked-rlib/bar.rs b/tests/run-make-fulldeps/symlinked-rlib/bar.rs deleted file mode 100644 index fde0d746634..00000000000 --- a/tests/run-make-fulldeps/symlinked-rlib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate foo; - -fn main() { - foo::bar(); -} diff --git a/tests/run-make-fulldeps/symlinked-rlib/foo.rs b/tests/run-make-fulldeps/symlinked-rlib/foo.rs deleted file mode 100644 index c5c0bc606cd..00000000000 --- a/tests/run-make-fulldeps/symlinked-rlib/foo.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make-fulldeps/sysroot-crates-are-unstable/Makefile b/tests/run-make-fulldeps/sysroot-crates-are-unstable/Makefile deleted file mode 100644 index 1e267fb9576..00000000000 --- a/tests/run-make-fulldeps/sysroot-crates-are-unstable/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - '$(PYTHON)' test.py diff --git a/tests/run-make-fulldeps/sysroot-crates-are-unstable/test.py b/tests/run-make-fulldeps/sysroot-crates-are-unstable/test.py deleted file mode 100644 index cb77eb34fef..00000000000 --- a/tests/run-make-fulldeps/sysroot-crates-are-unstable/test.py +++ /dev/null @@ -1,74 +0,0 @@ -import sys -import os -from os import listdir -from os.path import isfile, join -from subprocess import PIPE, Popen - - -# This is n list of files which are stable crates or simply are not crates, -# we don't check for the instability of these crates as they're all stable! -STABLE_CRATES = ['std', 'alloc', 'core', 'proc_macro', - 'rsbegin.o', 'rsend.o', 'dllcrt2.o', 'crt2.o', 'clang_rt'] - - -def convert_to_string(s): - if s.__class__.__name__ == 'bytes': - return s.decode('utf-8') - return s - - -def set_ld_lib_path(): - var = os.environ.get("LD_LIB_PATH_ENVVAR") - rpath = os.environ.get("HOST_RPATH_DIR") - if var and rpath: - path = os.environ.get(var) - if path: - os.environ[var] = rpath + os.pathsep + path - else: - os.environ[var] = rpath - - -def exec_command(command, to_input=None): - child = None - if to_input is None: - child = Popen(command, stdout=PIPE, stderr=PIPE) - else: - child = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE) - stdout, stderr = child.communicate(input=to_input) - return (convert_to_string(stdout), convert_to_string(stderr)) - - -def check_lib(lib): - if lib['name'] in STABLE_CRATES: - return True - print('verifying if {} is an unstable crate'.format(lib['name'])) - stdout, stderr = exec_command([os.environ['RUSTC'], '-', '--crate-type', 'rlib', - '--extern', '{}={}'.format(lib['name'], lib['path'])], - to_input=('extern crate {};'.format(lib['name'])).encode('utf-8')) - if not 'use of unstable library feature' in '{}{}'.format(stdout, stderr): - print('crate {} "{}" is not unstable'.format(lib['name'], lib['path'])) - print('{}{}'.format(stdout, stderr)) - print('') - return False - return True - -# Generate a list of all crates in the sysroot. To do this we list all files in -# rustc's sysroot, look at the filename, strip everything after the `-`, and -# strip the leading `lib` (if present) -def get_all_libs(dir_path): - return [{ 'path': join(dir_path, f), 'name': f[3:].split('-')[0] } - for f in listdir(dir_path) - if isfile(join(dir_path, f)) and f.endswith('.rlib') and f not in STABLE_CRATES] - - -set_ld_lib_path() -sysroot = exec_command([os.environ['RUSTC'], '--print', 'sysroot'])[0].replace('\n', '') -assert sysroot, "Could not read the rustc sysroot!" -libs = get_all_libs(join(sysroot, 'lib/rustlib/{}/lib'.format(os.environ['TARGET']))) - -ret = 0 -for lib in libs: - if not check_lib(lib): - # We continue so users can see all the not unstable crates. - ret = 1 -sys.exit(ret) diff --git a/tests/run-make-fulldeps/target-cpu-native/Makefile b/tests/run-make-fulldeps/target-cpu-native/Makefile deleted file mode 100644 index eb3ca1e13aa..00000000000 --- a/tests/run-make-fulldeps/target-cpu-native/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include ../tools.mk - -# only-linux -# only-x86_64 -# -# I *really* don't want to deal with a cross-platform way to compare file sizes, -# tests in `make` sort of are awful - -all: $(TMPDIR)/out.log - # Make sure no warnings about "unknown CPU `native`" were emitted - if [ "$$(wc -c $(TMPDIR)/out.log | cut -d' ' -f 1)" = "0" ]; then \ - echo no warnings generated; \ - else \ - exit 1; \ - fi - - -$(TMPDIR)/out.log: - $(RUSTC) foo.rs -C target-cpu=native 2>&1 | tee $(TMPDIR)/out.log - $(call RUN,foo) diff --git a/tests/run-make-fulldeps/target-cpu-native/foo.rs b/tests/run-make-fulldeps/target-cpu-native/foo.rs deleted file mode 100644 index f79c691f085..00000000000 --- a/tests/run-make-fulldeps/target-cpu-native/foo.rs +++ /dev/null @@ -1,2 +0,0 @@ -fn main() { -} diff --git a/tests/run-make-fulldeps/target-specs/Makefile b/tests/run-make-fulldeps/target-specs/Makefile deleted file mode 100644 index a33f5368e3c..00000000000 --- a/tests/run-make-fulldeps/target-specs/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk -all: - $(RUSTC) foo.rs --target=my-awesome-platform.json --crate-type=lib --emit=asm - $(CGREP) -v morestack < $(TMPDIR)/foo.s - $(RUSTC) foo.rs --target=my-invalid-platform.json 2>&1 | $(CGREP) "Error loading target specification" - $(RUSTC) foo.rs --target=my-incomplete-platform.json 2>&1 | $(CGREP) 'Field llvm-target' - RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-awesome-platform --crate-type=lib --emit=asm - RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-x86_64-unknown-linux-gnu-platform --crate-type=lib --emit=asm - $(RUSTC) -Z unstable-options --target=my-awesome-platform.json --print target-spec-json > $(TMPDIR)/test-platform.json && $(RUSTC) -Z unstable-options --target=$(TMPDIR)/test-platform.json --print target-spec-json | diff -q $(TMPDIR)/test-platform.json - - $(RUSTC) foo.rs --target=definitely-not-builtin-target 2>&1 | $(CGREP) 'may not set is_builtin' - $(RUSTC) foo.rs --target=mismatching-data-layout --crate-type=lib diff --git a/tests/run-make-fulldeps/target-specs/definitely-not-builtin-target.json b/tests/run-make-fulldeps/target-specs/definitely-not-builtin-target.json deleted file mode 100644 index b36fa993d97..00000000000 --- a/tests/run-make-fulldeps/target-specs/definitely-not-builtin-target.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "arch": "x86_64", - "is-builtin": true, - "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", - "llvm-target": "x86_64-unknown-unknown-gnu", - "target-pointer-width": "64" -} diff --git a/tests/run-make-fulldeps/target-specs/foo.rs b/tests/run-make-fulldeps/target-specs/foo.rs deleted file mode 100644 index 22939e87912..00000000000 --- a/tests/run-make-fulldeps/target-specs/foo.rs +++ /dev/null @@ -1,24 +0,0 @@ -#![feature(lang_items, no_core, auto_traits)] -#![no_core] - -#[lang = "copy"] -trait Copy {} - -#[lang = "sized"] -trait Sized {} - -#[lang = "freeze"] -auto trait Freeze {} - -#[lang = "start"] -fn start(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - 0 -} - -extern "C" { - fn _foo() -> [u8; 16]; -} - -fn _main() { - let _a = unsafe { _foo() }; -} diff --git a/tests/run-make-fulldeps/target-specs/mismatching-data-layout.json b/tests/run-make-fulldeps/target-specs/mismatching-data-layout.json deleted file mode 100644 index d12caaad14a..00000000000 --- a/tests/run-make-fulldeps/target-specs/mismatching-data-layout.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "arch": "x86_64", - "data-layout": "e-m:e-i64:16:32:64", - "llvm-target": "x86_64-unknown-unknown-gnu", - "target-pointer-width": "64" -} diff --git a/tests/run-make-fulldeps/target-specs/my-awesome-platform.json b/tests/run-make-fulldeps/target-specs/my-awesome-platform.json deleted file mode 100644 index 00de3de05f0..00000000000 --- a/tests/run-make-fulldeps/target-specs/my-awesome-platform.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", - "linker-flavor": "gcc", - "llvm-target": "i686-unknown-linux-gnu", - "target-endian": "little", - "target-pointer-width": "32", - "target-c-int-width": "32", - "arch": "x86", - "os": "linux", - "morestack": false -} diff --git a/tests/run-make-fulldeps/target-specs/my-incomplete-platform.json b/tests/run-make-fulldeps/target-specs/my-incomplete-platform.json deleted file mode 100644 index ceaa25cdf2f..00000000000 --- a/tests/run-make-fulldeps/target-specs/my-incomplete-platform.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "data-layout": "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32", - "linker-flavor": "gcc", - "target-endian": "little", - "target-pointer-width": "32", - "target-c-int-width": "32", - "arch": "x86", - "os": "foo", - "morestack": false -} diff --git a/tests/run-make-fulldeps/target-specs/my-invalid-platform.json b/tests/run-make-fulldeps/target-specs/my-invalid-platform.json deleted file mode 100644 index 3feac45b7d6..00000000000 --- a/tests/run-make-fulldeps/target-specs/my-invalid-platform.json +++ /dev/null @@ -1 +0,0 @@ -wow this json is really broke! diff --git a/tests/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json b/tests/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json deleted file mode 100644 index 6d5e964ed4f..00000000000 --- a/tests/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "pre-link-args": {"gcc": ["-m64"]}, - "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", - "linker-flavor": "gcc", - "llvm-target": "x86_64-unknown-linux-gnu", - "target-endian": "little", - "target-pointer-width": "64", - "target-c-int-width": "32", - "arch": "x86_64", - "os": "linux", - "morestack": false -} diff --git a/tests/run-make-fulldeps/target-without-atomic-cas/Makefile b/tests/run-make-fulldeps/target-without-atomic-cas/Makefile deleted file mode 100644 index 451f03d66cd..00000000000 --- a/tests/run-make-fulldeps/target-without-atomic-cas/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -# The target used below doesn't support atomic CAS operations. Verify that's the case -all: - $(RUSTC) --print cfg --target thumbv6m-none-eabi | $(CGREP) -v 'target_has_atomic="ptr"' diff --git a/tests/run-make-fulldeps/test-harness/Makefile b/tests/run-make-fulldeps/test-harness/Makefile deleted file mode 100644 index 1fe059b07d2..00000000000 --- a/tests/run-make-fulldeps/test-harness/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -all: - # check that #[cfg_attr(..., ignore)] does the right thing. - $(RUSTC) --test test-ignore-cfg.rs --cfg ignorecfg - $(call RUN,test-ignore-cfg) | $(CGREP) 'shouldnotignore ... ok' 'shouldignore ... ignored' - $(call RUN,test-ignore-cfg --quiet) | $(CGREP) -e "^i\.$$" - $(call RUN,test-ignore-cfg --quiet) | $(CGREP) -v 'should' diff --git a/tests/run-make-fulldeps/test-harness/test-ignore-cfg.rs b/tests/run-make-fulldeps/test-harness/test-ignore-cfg.rs deleted file mode 100644 index 31ef131f2ad..00000000000 --- a/tests/run-make-fulldeps/test-harness/test-ignore-cfg.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -#[cfg_attr(ignorecfg, ignore)] -fn shouldignore() { -} - -#[test] -#[cfg_attr(noignorecfg, ignore)] -fn shouldnotignore() { -} diff --git a/tests/run-make-fulldeps/type-mismatch-same-crate-name/Makefile b/tests/run-make-fulldeps/type-mismatch-same-crate-name/Makefile deleted file mode 100644 index a2a2a41c7a5..00000000000 --- a/tests/run-make-fulldeps/type-mismatch-same-crate-name/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../tools.mk - -all: - # compile two different versions of crateA - $(RUSTC) --crate-type=rlib crateA.rs -C metadata=-1 -C extra-filename=-1 - $(RUSTC) --crate-type=rlib crateA.rs -C metadata=-2 -C extra-filename=-2 - # make crateB depend on version 1 of crateA - $(RUSTC) --crate-type=rlib crateB.rs --extern crateA=$(TMPDIR)/libcrateA-1.rlib - # make crateC depend on version 2 of crateA - $(RUSTC) crateC.rs --extern crateA=$(TMPDIR)/libcrateA-2.rlib 2>&1 | \ - tr -d '\r\n' | $(CGREP) -e \ - "mismatched types.*\ - crateB::try_foo\(foo2\);.*\ - expected \`crateA::foo::Foo\`, found \`Foo\`.*\ - different versions of crate \`crateA\`.*\ - mismatched types.*\ - crateB::try_bar\(bar2\);.*\ - expected trait \`crateA::bar::Bar\`, found trait \`Bar\`.*\ - different versions of crate \`crateA\`" diff --git a/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateA.rs b/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateA.rs deleted file mode 100644 index 4871c8c2e9c..00000000000 --- a/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateA.rs +++ /dev/null @@ -1,16 +0,0 @@ -mod foo { - pub struct Foo; -} - -mod bar { - pub trait Bar{} - - pub fn bar() -> Box { - unimplemented!() - } -} - -// This makes the publicly accessible path -// differ from the internal one. -pub use foo::Foo; -pub use bar::{Bar, bar}; diff --git a/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateB.rs b/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateB.rs deleted file mode 100644 index 24fcc7cadc1..00000000000 --- a/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateB.rs +++ /dev/null @@ -1,4 +0,0 @@ -extern crate crateA; - -pub fn try_foo(x: crateA::Foo){} -pub fn try_bar(x: Box){} diff --git a/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs b/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs deleted file mode 100644 index 71b38a9f8ca..00000000000 --- a/tests/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs +++ /dev/null @@ -1,25 +0,0 @@ -// This tests the extra note reported when a type error deals with -// seemingly identical types. -// The main use case of this error is when there are two crates -// (generally different versions of the same crate) with the same name -// causing a type mismatch. - -// The test is nearly the same as the one in -// ui/type/type-mismatch-same-crate-name.rs -// but deals with the case where one of the crates -// is only introduced as an indirect dependency. -// and the type is accessed via a re-export. -// This is similar to how the error can be introduced -// when using cargo's automatic dependency resolution. - -extern crate crateA; - -fn main() { - let foo2 = crateA::Foo; - let bar2 = crateA::bar(); - { - extern crate crateB; - crateB::try_foo(foo2); - crateB::try_bar(bar2); - } -} diff --git a/tests/run-make-fulldeps/use-extern-for-plugins/Makefile b/tests/run-make-fulldeps/use-extern-for-plugins/Makefile deleted file mode 100644 index 6ae53afad20..00000000000 --- a/tests/run-make-fulldeps/use-extern-for-plugins/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -include ../tools.mk - -# ignore-freebsd -# ignore-openbsd -# ignore-sunos - -HOST := $(shell $(RUSTC) -vV | grep 'host:' | sed 's/host: //') -ifeq ($(findstring i686,$(HOST)),i686) -TARGET := $(subst i686,x86_64,$(HOST)) -else -TARGET := $(subst x86_64,i686,$(HOST)) -endif - -all: - $(RUSTC) foo.rs -C extra-filename=-host - $(RUSTC) bar.rs -C extra-filename=-targ --target $(TARGET) - $(RUSTC) baz.rs --extern a=$(TMPDIR)/liba-targ.rlib --target $(TARGET) diff --git a/tests/run-make-fulldeps/use-extern-for-plugins/bar.rs b/tests/run-make-fulldeps/use-extern-for-plugins/bar.rs deleted file mode 100644 index 704d2120362..00000000000 --- a/tests/run-make-fulldeps/use-extern-for-plugins/bar.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![feature(no_core)] -#![no_core] -#![crate_type = "lib"] -#![crate_name = "a"] - -#[macro_export] -macro_rules! bar { - () => () -} diff --git a/tests/run-make-fulldeps/use-extern-for-plugins/baz.rs b/tests/run-make-fulldeps/use-extern-for-plugins/baz.rs deleted file mode 100644 index 49a96a0c80b..00000000000 --- a/tests/run-make-fulldeps/use-extern-for-plugins/baz.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(no_core)] -#![no_core] -#![crate_type = "lib"] - -#[macro_use] -extern crate a; - -bar!(); diff --git a/tests/run-make-fulldeps/use-extern-for-plugins/foo.rs b/tests/run-make-fulldeps/use-extern-for-plugins/foo.rs deleted file mode 100644 index dffdc079887..00000000000 --- a/tests/run-make-fulldeps/use-extern-for-plugins/foo.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![no_std] -#![crate_type = "lib"] -#![crate_name = "a"] - -#[macro_export] -macro_rules! foo { - () => () -} diff --git a/tests/run-make-fulldeps/use-suggestions-rust-2018/Makefile b/tests/run-make-fulldeps/use-suggestions-rust-2018/Makefile deleted file mode 100644 index 37cd6283c0a..00000000000 --- a/tests/run-make-fulldeps/use-suggestions-rust-2018/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) ep-nested-lib.rs - - $(RUSTC) use-suggestions.rs --edition=2018 --extern ep_nested_lib=$(TMPDIR)/libep_nested_lib.rlib 2>&1 | $(CGREP) "use ep_nested_lib::foo::bar::Baz" - diff --git a/tests/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs b/tests/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs deleted file mode 100644 index 62a0a9d8f1b..00000000000 --- a/tests/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type = "rlib"] - -pub mod foo { - pub mod bar { - pub struct Baz; - } -} diff --git a/tests/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs b/tests/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs deleted file mode 100644 index d262d6f9877..00000000000 --- a/tests/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - let x = Baz{}; -} diff --git a/tests/run-make-fulldeps/used-cdylib-macos/Makefile b/tests/run-make-fulldeps/used-cdylib-macos/Makefile deleted file mode 100644 index 38a4c31c7b3..00000000000 --- a/tests/run-make-fulldeps/used-cdylib-macos/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -include ../tools.mk - -# only-macos -# -# This checks that `#[used]` passes through to the linker on -# darwin. This is subject to change in the future, see -# https://github.com/rust-lang/rust/pull/93718 for discussion - -all: - $(RUSTC) -Copt-level=3 dylib_used.rs - nm $(TMPDIR)/libdylib_used.dylib | $(CGREP) VERY_IMPORTANT_SYMBOL diff --git a/tests/run-make-fulldeps/used-cdylib-macos/dylib_used.rs b/tests/run-make-fulldeps/used-cdylib-macos/dylib_used.rs deleted file mode 100644 index 85f0ff92fe7..00000000000 --- a/tests/run-make-fulldeps/used-cdylib-macos/dylib_used.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "cdylib"] - -#[used] -static VERY_IMPORTANT_SYMBOL: u32 = 12345; diff --git a/tests/run-make-fulldeps/used/Makefile b/tests/run-make-fulldeps/used/Makefile deleted file mode 100644 index e80eb9e4020..00000000000 --- a/tests/run-make-fulldeps/used/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -# ignore-windows-msvc - -all: - $(RUSTC) -C opt-level=3 --emit=obj used.rs - nm $(TMPDIR)/used.o | $(CGREP) FOO diff --git a/tests/run-make-fulldeps/used/used.rs b/tests/run-make-fulldeps/used/used.rs deleted file mode 100644 index dca0a5e1167..00000000000 --- a/tests/run-make-fulldeps/used/used.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![crate_type = "lib"] - -#[used] -static FOO: u32 = 0; - -static BAR: u32 = 0; diff --git a/tests/run-make-fulldeps/version/Makefile b/tests/run-make-fulldeps/version/Makefile deleted file mode 100644 index 3a130545d69..00000000000 --- a/tests/run-make-fulldeps/version/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) -V - $(RUSTC) -vV - $(RUSTC) --version --verbose diff --git a/tests/run-make-fulldeps/volatile-intrinsics/Makefile b/tests/run-make-fulldeps/volatile-intrinsics/Makefile deleted file mode 100644 index 2a78c7b9cfe..00000000000 --- a/tests/run-make-fulldeps/volatile-intrinsics/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -all: - # The tests must pass... - $(RUSTC) main.rs - $(call RUN,main) - # ... and the loads/stores must not be optimized out. - $(RUSTC) main.rs --emit=llvm-ir - $(CGREP) "load volatile" "store volatile" < $(TMPDIR)/main.ll diff --git a/tests/run-make-fulldeps/volatile-intrinsics/main.rs b/tests/run-make-fulldeps/volatile-intrinsics/main.rs deleted file mode 100644 index 4295d95f3f3..00000000000 --- a/tests/run-make-fulldeps/volatile-intrinsics/main.rs +++ /dev/null @@ -1,24 +0,0 @@ -#![feature(core_intrinsics, volatile)] - -use std::intrinsics::{ - unaligned_volatile_load, unaligned_volatile_store, volatile_load, volatile_store, -}; -use std::ptr::{read_volatile, write_volatile}; - -pub fn main() { - unsafe { - let mut i: isize = 1; - volatile_store(&mut i, 2); - assert_eq!(volatile_load(&i), 2); - } - unsafe { - let mut i: isize = 1; - unaligned_volatile_store(&mut i, 2); - assert_eq!(unaligned_volatile_load(&i), 2); - } - unsafe { - let mut i: isize = 1; - write_volatile(&mut i, 2); - assert_eq!(read_volatile(&i), 2); - } -} diff --git a/tests/run-make-fulldeps/weird-output-filenames/Makefile b/tests/run-make-fulldeps/weird-output-filenames/Makefile deleted file mode 100644 index d3a34e3b46e..00000000000 --- a/tests/run-make-fulldeps/weird-output-filenames/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -include ../tools.mk - -all: - cp foo.rs $(TMPDIR)/.foo.rs - $(RUSTC) $(TMPDIR)/.foo.rs 2>&1 \ - | $(CGREP) -e "invalid character.*in crate name:" - cp foo.rs $(TMPDIR)/.foo.bar - $(RUSTC) $(TMPDIR)/.foo.bar 2>&1 \ - | $(CGREP) -e "invalid character.*in crate name:" - cp foo.rs $(TMPDIR)/+foo+bar.rs - $(RUSTC) $(TMPDIR)/+foo+bar.rs 2>&1 \ - | $(CGREP) -e "invalid character.*in crate name:" - cp foo.rs $(TMPDIR)/-foo.rs - $(RUSTC) $(TMPDIR)/-foo.rs 2>&1 \ - | $(CGREP) 'crate names cannot start with a `-`' diff --git a/tests/run-make-fulldeps/weird-output-filenames/foo.rs b/tests/run-make-fulldeps/weird-output-filenames/foo.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make-fulldeps/weird-output-filenames/foo.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make-fulldeps/windows-binary-no-external-deps/Makefile b/tests/run-make-fulldeps/windows-binary-no-external-deps/Makefile deleted file mode 100644 index 8960020fed5..00000000000 --- a/tests/run-make-fulldeps/windows-binary-no-external-deps/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# only-windows - -PATH=$(SYSTEMROOT)/system32 - -all: - $(RUSTC) hello.rs - $(TMPDIR)/hello.exe diff --git a/tests/run-make-fulldeps/windows-binary-no-external-deps/hello.rs b/tests/run-make-fulldeps/windows-binary-no-external-deps/hello.rs deleted file mode 100644 index 47ad8c63411..00000000000 --- a/tests/run-make-fulldeps/windows-binary-no-external-deps/hello.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello World!"); -} diff --git a/tests/run-make-fulldeps/windows-spawn/Makefile b/tests/run-make-fulldeps/windows-spawn/Makefile deleted file mode 100644 index b6cdb169bab..00000000000 --- a/tests/run-make-fulldeps/windows-spawn/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../tools.mk - -# only-windows - -all: - $(RUSTC) -o "$(TMPDIR)/hopefullydoesntexist bar.exe" hello.rs - $(RUSTC) spawn.rs - $(TMPDIR)/spawn.exe diff --git a/tests/run-make-fulldeps/windows-spawn/hello.rs b/tests/run-make-fulldeps/windows-spawn/hello.rs deleted file mode 100644 index 47ad8c63411..00000000000 --- a/tests/run-make-fulldeps/windows-spawn/hello.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello World!"); -} diff --git a/tests/run-make-fulldeps/windows-spawn/spawn.rs b/tests/run-make-fulldeps/windows-spawn/spawn.rs deleted file mode 100644 index c34da3d5fde..00000000000 --- a/tests/run-make-fulldeps/windows-spawn/spawn.rs +++ /dev/null @@ -1,12 +0,0 @@ -use std::io::ErrorKind; -use std::process::Command; - -fn main() { - // Make sure it doesn't try to run "hopefullydoesntexist bar.exe". - assert_eq!(Command::new("hopefullydoesntexist") - .arg("bar") - .spawn() - .unwrap_err() - .kind(), - ErrorKind::NotFound); -} diff --git a/tests/run-make-fulldeps/windows-subsystem/Makefile b/tests/run-make-fulldeps/windows-subsystem/Makefile deleted file mode 100644 index 78c4e2ac1e8..00000000000 --- a/tests/run-make-fulldeps/windows-subsystem/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) windows.rs - $(RUSTC) console.rs diff --git a/tests/run-make-fulldeps/windows-subsystem/console.rs b/tests/run-make-fulldeps/windows-subsystem/console.rs deleted file mode 100644 index 61a92eb6a9d..00000000000 --- a/tests/run-make-fulldeps/windows-subsystem/console.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![windows_subsystem = "console"] - -fn main() {} diff --git a/tests/run-make-fulldeps/windows-subsystem/windows.rs b/tests/run-make-fulldeps/windows-subsystem/windows.rs deleted file mode 100644 index 1138248f07d..00000000000 --- a/tests/run-make-fulldeps/windows-subsystem/windows.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![windows_subsystem = "windows"] - -fn main() {} diff --git a/tests/run-make/a-b-a-linker-guard/Makefile b/tests/run-make/a-b-a-linker-guard/Makefile new file mode 100644 index 00000000000..adc9e3d0916 --- /dev/null +++ b/tests/run-make/a-b-a-linker-guard/Makefile @@ -0,0 +1,15 @@ +include ../tools.mk + +# Test that if we build `b` against a version of `a` that has one set +# of types, it will not run with a dylib that has a different set of +# types. + +# NOTE(eddyb) this test only works with the `legacy` mangling, +# and will probably get removed once `legacy` is gone. + +all: + $(RUSTC) a.rs --cfg x -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy + $(RUSTC) b.rs -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy + $(call RUN,b) + $(RUSTC) a.rs --cfg y -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=legacy + $(call FAIL,b) diff --git a/tests/run-make/a-b-a-linker-guard/a.rs b/tests/run-make/a-b-a-linker-guard/a.rs new file mode 100644 index 00000000000..aa07b1e7160 --- /dev/null +++ b/tests/run-make/a-b-a-linker-guard/a.rs @@ -0,0 +1,8 @@ +#![crate_name = "a"] +#![crate_type = "dylib"] + +#[cfg(x)] +pub fn foo(x: u32) { } + +#[cfg(y)] +pub fn foo(x: i32) { } diff --git a/tests/run-make/a-b-a-linker-guard/b.rs b/tests/run-make/a-b-a-linker-guard/b.rs new file mode 100644 index 00000000000..f30df120a3b --- /dev/null +++ b/tests/run-make/a-b-a-linker-guard/b.rs @@ -0,0 +1,7 @@ +#![crate_name = "b"] + +extern crate a; + +fn main() { + a::foo(22_u32); +} diff --git a/tests/run-make/alloc-no-oom-handling/Makefile b/tests/run-make/alloc-no-oom-handling/Makefile new file mode 100644 index 00000000000..87f74c69c79 --- /dev/null +++ b/tests/run-make/alloc-no-oom-handling/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_global_oom_handling diff --git a/tests/run-make/alloc-no-rc/Makefile b/tests/run-make/alloc-no-rc/Makefile new file mode 100644 index 00000000000..9824b17e6c2 --- /dev/null +++ b/tests/run-make/alloc-no-rc/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_rc diff --git a/tests/run-make/alloc-no-sync/Makefile b/tests/run-make/alloc-no-sync/Makefile new file mode 100644 index 00000000000..04ec4c7d8bc --- /dev/null +++ b/tests/run-make/alloc-no-sync/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_sync diff --git a/tests/run-make/allow-non-lint-warnings-cmdline/Makefile b/tests/run-make/allow-non-lint-warnings-cmdline/Makefile new file mode 100644 index 00000000000..60d9c7c3745 --- /dev/null +++ b/tests/run-make/allow-non-lint-warnings-cmdline/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +# Test that -A warnings makes the 'empty trait list for derive' warning go away +OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" ) + +all: foo + test -z '$(OUT)' + +# This is just to make sure the above command actually succeeds +foo: + $(RUSTC) foo.rs -A warnings diff --git a/tests/run-make/allow-non-lint-warnings-cmdline/foo.rs b/tests/run-make/allow-non-lint-warnings-cmdline/foo.rs new file mode 100644 index 00000000000..46e72da2de9 --- /dev/null +++ b/tests/run-make/allow-non-lint-warnings-cmdline/foo.rs @@ -0,0 +1,5 @@ +#[derive()] +#[derive(Copy, Clone)] +pub struct Foo; + +pub fn main() { } diff --git a/tests/run-make/allow-warnings-cmdline-stability/Makefile b/tests/run-make/allow-warnings-cmdline-stability/Makefile new file mode 100644 index 00000000000..1ce8d0ec284 --- /dev/null +++ b/tests/run-make/allow-warnings-cmdline-stability/Makefile @@ -0,0 +1,15 @@ +include ../tools.mk + +# Test that -A warnings makes the 'empty trait list for derive' warning go away +DEP=$(shell $(RUSTC) bar.rs) +OUT=$(shell $(RUSTC) foo.rs -A warnings 2>&1 | grep "warning" ) + +all: foo bar + test -z '$(OUT)' + +# These are just to ensure that the above commands actually work +bar: + $(RUSTC) bar.rs + +foo: bar + $(RUSTC) foo.rs -A warnings diff --git a/tests/run-make/allow-warnings-cmdline-stability/bar.rs b/tests/run-make/allow-warnings-cmdline-stability/bar.rs new file mode 100644 index 00000000000..3dcfb9dadd8 --- /dev/null +++ b/tests/run-make/allow-warnings-cmdline-stability/bar.rs @@ -0,0 +1,5 @@ +#![crate_type = "lib"] +#![feature(staged_api)] +#![unstable(feature = "unstable_test_feature", issue = "none")] + +pub fn baz() {} diff --git a/tests/run-make/allow-warnings-cmdline-stability/foo.rs b/tests/run-make/allow-warnings-cmdline-stability/foo.rs new file mode 100644 index 00000000000..869b5435416 --- /dev/null +++ b/tests/run-make/allow-warnings-cmdline-stability/foo.rs @@ -0,0 +1,5 @@ +#![feature(unstable_test_feature)] + +extern crate bar; + +pub fn main() { bar::baz() } diff --git a/tests/run-make/archive-duplicate-names/Makefile b/tests/run-make/archive-duplicate-names/Makefile new file mode 100644 index 00000000000..bbdcd2a34fe --- /dev/null +++ b/tests/run-make/archive-duplicate-names/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +all: + mkdir $(TMPDIR)/a + mkdir $(TMPDIR)/b + $(call COMPILE_OBJ,$(TMPDIR)/a/foo.o,foo.c) + $(call COMPILE_OBJ,$(TMPDIR)/b/foo.o,bar.c) + $(AR) crus $(TMPDIR)/libfoo.a $(TMPDIR)/a/foo.o $(TMPDIR)/b/foo.o + $(RUSTC) foo.rs + $(RUSTC) bar.rs + $(call RUN,bar) diff --git a/tests/run-make/archive-duplicate-names/bar.c b/tests/run-make/archive-duplicate-names/bar.c new file mode 100644 index 00000000000..e4259998678 --- /dev/null +++ b/tests/run-make/archive-duplicate-names/bar.c @@ -0,0 +1 @@ +void bar() {} diff --git a/tests/run-make/archive-duplicate-names/bar.rs b/tests/run-make/archive-duplicate-names/bar.rs new file mode 100644 index 00000000000..994a98c2cd8 --- /dev/null +++ b/tests/run-make/archive-duplicate-names/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::baz(); +} diff --git a/tests/run-make/archive-duplicate-names/foo.c b/tests/run-make/archive-duplicate-names/foo.c new file mode 100644 index 00000000000..85e6cd8c390 --- /dev/null +++ b/tests/run-make/archive-duplicate-names/foo.c @@ -0,0 +1 @@ +void foo() {} diff --git a/tests/run-make/archive-duplicate-names/foo.rs b/tests/run-make/archive-duplicate-names/foo.rs new file mode 100644 index 00000000000..0bf13c406ab --- /dev/null +++ b/tests/run-make/archive-duplicate-names/foo.rs @@ -0,0 +1,14 @@ +#![crate_type = "rlib"] + +#[link(name = "foo", kind = "static")] +extern "C" { + fn foo(); + fn bar(); +} + +pub fn baz() { + unsafe { + foo(); + bar(); + } +} diff --git a/tests/run-make/arguments-non-c-like-enum/Makefile b/tests/run-make/arguments-non-c-like-enum/Makefile new file mode 100644 index 00000000000..513311c8289 --- /dev/null +++ b/tests/run-make/arguments-non-c-like-enum/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) --crate-type=staticlib nonclike.rs + $(CC) test.c $(call STATICLIB,nonclike) $(call OUT_EXE,test) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + $(call RUN,test) diff --git a/tests/run-make/arguments-non-c-like-enum/nonclike.rs b/tests/run-make/arguments-non-c-like-enum/nonclike.rs new file mode 100644 index 00000000000..57c2c6127ed --- /dev/null +++ b/tests/run-make/arguments-non-c-like-enum/nonclike.rs @@ -0,0 +1,31 @@ +#[repr(C, u8)] +pub enum TT { + AA(u64, u64), + BB, +} + +#[no_mangle] +pub extern "C" fn tt_add(a: TT, b: TT) -> u64 { + match (a, b) { + (TT::AA(a1, b1), TT::AA(a2, b2)) => a1 + a2 + b1 + b2, + (TT::AA(a1, b1), TT::BB) => a1 + b1, + (TT::BB, TT::AA(a1, b1)) => a1 + b1, + _ => 0, + } +} + +#[repr(C, u8)] +pub enum T { + A(u64), + B, +} + +#[no_mangle] +pub extern "C" fn t_add(a: T, b: T) -> u64 { + match (a, b) { + (T::A(a), T::A(b)) => a + b, + (T::A(a), T::B) => a, + (T::B, T::A(b)) => b, + _ => 0, + } +} diff --git a/tests/run-make/arguments-non-c-like-enum/test.c b/tests/run-make/arguments-non-c-like-enum/test.c new file mode 100644 index 00000000000..0a1621e49f2 --- /dev/null +++ b/tests/run-make/arguments-non-c-like-enum/test.c @@ -0,0 +1,66 @@ +#include +#include + +#include + +/* This is the code generated by cbindgen 0.12.1 for the `enum TT` + * type in nonclike.rs . */ +enum TT_Tag { + AA, + BB, +}; +typedef uint8_t TT_Tag; + +typedef struct { + uint64_t _0; + uint64_t _1; +} AA_Body; + +typedef struct { + TT_Tag tag; + union { + AA_Body aa; + }; +} TT; + +/* This is the code generated by cbindgen 0.12.1 for the `enum T` type + * in nonclike.rs . */ +enum T_Tag { + A, + B, +}; +typedef uint8_t T_Tag; + +typedef struct { + uint64_t _0; +} A_Body; + +typedef struct { + T_Tag tag; + union { + A_Body a; + }; +} T; + +/* These symbols are defined by the Rust staticlib built from + * nonclike.rs. */ +extern uint64_t t_add(T a, T b); +extern uint64_t tt_add(TT a, TT b); + +int main(int argc, char *argv[]) { + (void)argc; (void)argv; + + /* This example works. */ + TT xx = { .tag = AA, .aa = { ._0 = 1, ._1 = 2 } }; + TT yy = { .tag = AA, .aa = { ._0 = 10, ._1 = 20 } }; + uint64_t rr = tt_add(xx, yy); + assert(33 == rr); + + /* This one used to return an incorrect result (see issue #68190). */ + T x = { .tag = A, .a = { ._0 = 1 } }; + T y = { .tag = A, .a = { ._0 = 10 } }; + uint64_t r = t_add(x, y); + assert(11 == r); + + return 0; +} diff --git a/tests/run-make/atomic-lock-free/Makefile b/tests/run-make/atomic-lock-free/Makefile new file mode 100644 index 00000000000..37e59624a25 --- /dev/null +++ b/tests/run-make/atomic-lock-free/Makefile @@ -0,0 +1,48 @@ +include ../tools.mk + +# This tests ensure that atomic types are never lowered into runtime library calls that are not +# guaranteed to be lock-free. + +all: +ifeq ($(UNAME),Linux) +ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) + $(RUSTC) --target=i686-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=x86_64-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add +endif +ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm) + $(RUSTC) --target=arm-unknown-linux-gnueabi atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=arm-unknown-linux-gnueabihf atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=armv7-unknown-linux-gnueabihf atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=thumbv7neon-unknown-linux-gnueabihf atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add +endif +ifeq ($(filter aarch64,$(LLVM_COMPONENTS)),aarch64) + $(RUSTC) --target=aarch64-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add +endif +ifeq ($(filter mips,$(LLVM_COMPONENTS)),mips) + $(RUSTC) --target=mips-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=mipsel-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add +endif +ifeq ($(filter powerpc,$(LLVM_COMPONENTS)),powerpc) + $(RUSTC) --target=powerpc-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=powerpc-unknown-linux-gnuspe atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=powerpc64-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=powerpc64le-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add +endif +ifeq ($(filter systemz,$(LLVM_COMPONENTS)),systemz) + $(RUSTC) --target=s390x-unknown-linux-gnu atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add +endif +endif diff --git a/tests/run-make/atomic-lock-free/atomic_lock_free.rs b/tests/run-make/atomic-lock-free/atomic_lock_free.rs new file mode 100644 index 00000000000..47d90b1856b --- /dev/null +++ b/tests/run-make/atomic-lock-free/atomic_lock_free.rs @@ -0,0 +1,66 @@ +#![feature(no_core, intrinsics, lang_items)] +#![crate_type="rlib"] +#![no_core] + +extern "rust-intrinsic" { + fn atomic_xadd_seqcst(dst: *mut T, src: T) -> T; +} + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} +#[lang = "freeze"] +trait Freeze {} + +impl Copy for *mut T {} + +#[cfg(target_has_atomic = "8")] +pub unsafe fn atomic_u8(x: *mut u8) { + atomic_xadd_seqcst(x, 1); + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "8")] +pub unsafe fn atomic_i8(x: *mut i8) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "16")] +pub unsafe fn atomic_u16(x: *mut u16) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "16")] +pub unsafe fn atomic_i16(x: *mut i16) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "32")] +pub unsafe fn atomic_u32(x: *mut u32) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "32")] +pub unsafe fn atomic_i32(x: *mut i32) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "64")] +pub unsafe fn atomic_u64(x: *mut u64) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "64")] +pub unsafe fn atomic_i64(x: *mut i64) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "128")] +pub unsafe fn atomic_u128(x: *mut u128) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "128")] +pub unsafe fn atomic_i128(x: *mut i128) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "ptr")] +pub unsafe fn atomic_usize(x: *mut usize) { + atomic_xadd_seqcst(x, 1); +} +#[cfg(target_has_atomic = "ptr")] +pub unsafe fn atomic_isize(x: *mut isize) { + atomic_xadd_seqcst(x, 1); +} diff --git a/tests/run-make/bare-outfile/Makefile b/tests/run-make/bare-outfile/Makefile new file mode 100644 index 00000000000..858466e942b --- /dev/null +++ b/tests/run-make/bare-outfile/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + cp foo.rs $(TMPDIR) + cd $(TMPDIR) && $(RUSTC) -o foo foo.rs + $(call RUN,foo) diff --git a/tests/run-make/bare-outfile/foo.rs b/tests/run-make/bare-outfile/foo.rs new file mode 100644 index 00000000000..f79c691f085 --- /dev/null +++ b/tests/run-make/bare-outfile/foo.rs @@ -0,0 +1,2 @@ +fn main() { +} diff --git a/tests/run-make/c-dynamic-dylib/Makefile b/tests/run-make/c-dynamic-dylib/Makefile new file mode 100644 index 00000000000..ac68778922d --- /dev/null +++ b/tests/run-make/c-dynamic-dylib/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +# ignore-macos +# +# This hits an assertion in the linker on older versions of osx apparently + +all: $(call DYLIB,cfoo) + $(RUSTC) foo.rs -C prefer-dynamic + $(RUSTC) bar.rs + $(call RUN,bar) + $(call REMOVE_DYLIBS,cfoo) + $(call FAIL,bar) diff --git a/tests/run-make/c-dynamic-dylib/bar.rs b/tests/run-make/c-dynamic-dylib/bar.rs new file mode 100644 index 00000000000..b8c798ffdb4 --- /dev/null +++ b/tests/run-make/c-dynamic-dylib/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::rsfoo(); +} diff --git a/tests/run-make/c-dynamic-dylib/cfoo.c b/tests/run-make/c-dynamic-dylib/cfoo.c new file mode 100644 index 00000000000..fea490cf9b4 --- /dev/null +++ b/tests/run-make/c-dynamic-dylib/cfoo.c @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int foo() { return 0; } diff --git a/tests/run-make/c-dynamic-dylib/foo.rs b/tests/run-make/c-dynamic-dylib/foo.rs new file mode 100644 index 00000000000..9f7a9e2213c --- /dev/null +++ b/tests/run-make/c-dynamic-dylib/foo.rs @@ -0,0 +1,10 @@ +#![crate_type = "dylib"] + +#[link(name = "cfoo")] +extern "C" { + fn foo(); +} + +pub fn rsfoo() { + unsafe { foo() } +} diff --git a/tests/run-make/c-dynamic-rlib/Makefile b/tests/run-make/c-dynamic-rlib/Makefile new file mode 100644 index 00000000000..c65d648b929 --- /dev/null +++ b/tests/run-make/c-dynamic-rlib/Makefile @@ -0,0 +1,15 @@ +include ../tools.mk + +# ignore-macos +# +# This hits an assertion in the linker on older versions of osx apparently + +# This overrides the LD_LIBRARY_PATH for RUN +TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR) + +all: $(call DYLIB,cfoo) + $(RUSTC) foo.rs + $(RUSTC) bar.rs + $(call RUN,bar) + $(call REMOVE_DYLIBS,cfoo) + $(call FAIL,bar) diff --git a/tests/run-make/c-dynamic-rlib/bar.rs b/tests/run-make/c-dynamic-rlib/bar.rs new file mode 100644 index 00000000000..b8c798ffdb4 --- /dev/null +++ b/tests/run-make/c-dynamic-rlib/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::rsfoo(); +} diff --git a/tests/run-make/c-dynamic-rlib/cfoo.c b/tests/run-make/c-dynamic-rlib/cfoo.c new file mode 100644 index 00000000000..fea490cf9b4 --- /dev/null +++ b/tests/run-make/c-dynamic-rlib/cfoo.c @@ -0,0 +1,4 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int foo() { return 0; } diff --git a/tests/run-make/c-dynamic-rlib/foo.rs b/tests/run-make/c-dynamic-rlib/foo.rs new file mode 100644 index 00000000000..3dd376f1ff5 --- /dev/null +++ b/tests/run-make/c-dynamic-rlib/foo.rs @@ -0,0 +1,10 @@ +#![crate_type = "rlib"] + +#[link(name = "cfoo")] +extern "C" { + fn foo(); +} + +pub fn rsfoo() { + unsafe { foo() } +} diff --git a/tests/run-make/c-link-to-rust-dylib/Makefile b/tests/run-make/c-link-to-rust-dylib/Makefile new file mode 100644 index 00000000000..2a371b54541 --- /dev/null +++ b/tests/run-make/c-link-to-rust-dylib/Makefile @@ -0,0 +1,17 @@ +include ../tools.mk + +all: $(TMPDIR)/$(call BIN,bar) + $(call RUN,bar) + $(call REMOVE_DYLIBS,foo) + $(call FAIL,bar) + +ifdef IS_MSVC +$(TMPDIR)/$(call BIN,bar): $(call DYLIB,foo) + $(CC) bar.c $(TMPDIR)/foo.dll.lib $(call OUT_EXE,bar) +else +$(TMPDIR)/$(call BIN,bar): $(call DYLIB,foo) + $(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) -L $(TMPDIR) +endif + +$(call DYLIB,foo): foo.rs + $(RUSTC) foo.rs diff --git a/tests/run-make/c-link-to-rust-dylib/bar.c b/tests/run-make/c-link-to-rust-dylib/bar.c new file mode 100644 index 00000000000..bb4036b06e1 --- /dev/null +++ b/tests/run-make/c-link-to-rust-dylib/bar.c @@ -0,0 +1,6 @@ +void foo(); + +int main() { + foo(); + return 0; +} diff --git a/tests/run-make/c-link-to-rust-dylib/foo.rs b/tests/run-make/c-link-to-rust-dylib/foo.rs new file mode 100644 index 00000000000..f197fa51334 --- /dev/null +++ b/tests/run-make/c-link-to-rust-dylib/foo.rs @@ -0,0 +1,4 @@ +#![crate_type = "dylib"] + +#[no_mangle] +pub extern "C" fn foo() {} diff --git a/tests/run-make/c-link-to-rust-staticlib/Makefile b/tests/run-make/c-link-to-rust-staticlib/Makefile new file mode 100644 index 00000000000..d38bcef309a --- /dev/null +++ b/tests/run-make/c-link-to-rust-staticlib/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +# ignore-freebsd +# FIXME + +all: + $(RUSTC) foo.rs + $(CC) bar.c $(call STATICLIB,foo) $(call OUT_EXE,bar) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + $(call RUN,bar) + rm $(call STATICLIB,foo) + $(call RUN,bar) diff --git a/tests/run-make/c-link-to-rust-staticlib/bar.c b/tests/run-make/c-link-to-rust-staticlib/bar.c new file mode 100644 index 00000000000..bb4036b06e1 --- /dev/null +++ b/tests/run-make/c-link-to-rust-staticlib/bar.c @@ -0,0 +1,6 @@ +void foo(); + +int main() { + foo(); + return 0; +} diff --git a/tests/run-make/c-link-to-rust-staticlib/foo.rs b/tests/run-make/c-link-to-rust-staticlib/foo.rs new file mode 100644 index 00000000000..2e59432cdb1 --- /dev/null +++ b/tests/run-make/c-link-to-rust-staticlib/foo.rs @@ -0,0 +1,4 @@ +#![crate_type = "staticlib"] + +#[no_mangle] +pub extern "C" fn foo() {} diff --git a/tests/run-make/c-link-to-rust-va-list-fn/Makefile b/tests/run-make/c-link-to-rust-va-list-fn/Makefile new file mode 100644 index 00000000000..9ce2a34e677 --- /dev/null +++ b/tests/run-make/c-link-to-rust-va-list-fn/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + $(RUSTC) checkrust.rs + $(CC) test.c $(call STATICLIB,checkrust) $(call OUT_EXE,test) $(EXTRACFLAGS) + $(call RUN,test) diff --git a/tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs b/tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs new file mode 100644 index 00000000000..5830ef033d3 --- /dev/null +++ b/tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs @@ -0,0 +1,148 @@ +#![crate_type = "staticlib"] +#![feature(c_variadic)] +#![feature(rustc_private)] + +extern crate libc; + +use libc::{c_char, c_double, c_int, c_long, c_longlong}; +use std::ffi::VaList; +use std::ffi::{CString, CStr}; + +macro_rules! continue_if { + ($cond:expr) => { + if !($cond) { + return 0xff; + } + } +} + +unsafe fn compare_c_str(ptr: *const c_char, val: &str) -> bool { + let cstr0 = CStr::from_ptr(ptr); + match CString::new(val) { + Ok(cstr1) => &*cstr1 == cstr0, + Err(_) => false, + } +} + +#[no_mangle] +pub unsafe extern "C" fn check_list_0(mut ap: VaList) -> usize { + continue_if!(ap.arg::() == 1); + continue_if!(ap.arg::() == 2); + continue_if!(ap.arg::() == 3); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_list_1(mut ap: VaList) -> usize { + continue_if!(ap.arg::() == -1); + continue_if!(ap.arg::() == 'A' as c_char); + continue_if!(ap.arg::() == '4' as c_char); + continue_if!(ap.arg::() == ';' as c_char); + continue_if!(ap.arg::() == 0x32); + continue_if!(ap.arg::() == 0x10000001); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Valid!")); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_list_2(mut ap: VaList) -> usize { + continue_if!(ap.arg::().floor() == 3.14f64.floor()); + continue_if!(ap.arg::() == 12); + continue_if!(ap.arg::() == 'a' as c_char); + continue_if!(ap.arg::().floor() == 6.18f64.floor()); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello")); + continue_if!(ap.arg::() == 42); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "World")); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_list_copy_0(mut ap: VaList) -> usize { + continue_if!(ap.arg::().floor() == 6.28f64.floor()); + continue_if!(ap.arg::() == 16); + continue_if!(ap.arg::() == 'A' as c_char); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Skip Me!")); + ap.with_copy(|mut ap| { + if compare_c_str(ap.arg::<*const c_char>(), "Correct") { + 0 + } else { + 0xff + } + }) +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_0(_: c_int, mut ap: ...) -> usize { + continue_if!(ap.arg::() == 42); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello, World!")); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_1(_: c_int, mut ap: ...) -> usize { + continue_if!(ap.arg::().floor() == 3.14f64.floor()); + continue_if!(ap.arg::() == 12); + continue_if!(ap.arg::() == 'A' as c_char); + continue_if!(ap.arg::() == 1); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_2(_: c_int, _ap: ...) -> usize { + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_3(_: c_int, mut ap: ...) -> usize { + continue_if!(ap.arg::() == 1); + continue_if!(ap.arg::() == 2); + continue_if!(ap.arg::() == 3); + continue_if!(ap.arg::() == 4); + continue_if!(ap.arg::() == 5); + continue_if!(ap.arg::() == 6); + continue_if!(ap.arg::() == 7); + continue_if!(ap.arg::() == 8); + continue_if!(ap.arg::() == 9); + continue_if!(ap.arg::() == 10); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_4(_: c_double, mut ap: ...) -> usize { + continue_if!(ap.arg::() == 1.0); + continue_if!(ap.arg::() == 2.0); + continue_if!(ap.arg::() == 3.0); + continue_if!(ap.arg::() == 4.0); + continue_if!(ap.arg::() == 5.0); + continue_if!(ap.arg::() == 6.0); + continue_if!(ap.arg::() == 7.0); + continue_if!(ap.arg::() == 8.0); + continue_if!(ap.arg::() == 9.0); + continue_if!(ap.arg::() == 10.0); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_5(_: c_int, mut ap: ...) -> usize { + continue_if!(ap.arg::() == 1.0); + continue_if!(ap.arg::() == 1); + continue_if!(ap.arg::() == 2.0); + continue_if!(ap.arg::() == 2); + continue_if!(ap.arg::() == 3.0); + continue_if!(ap.arg::() == 3); + continue_if!(ap.arg::() == 4.0); + continue_if!(ap.arg::() == 4); + continue_if!(ap.arg::() == 5); + continue_if!(ap.arg::() == 5.0); + continue_if!(ap.arg::() == 6); + continue_if!(ap.arg::() == 6.0); + continue_if!(ap.arg::() == 7); + continue_if!(ap.arg::() == 7.0); + continue_if!(ap.arg::() == 8); + continue_if!(ap.arg::() == 8.0); + continue_if!(ap.arg::() == 9); + continue_if!(ap.arg::() == 9.0); + continue_if!(ap.arg::() == 10); + continue_if!(ap.arg::() == 10.0); + 0 +} diff --git a/tests/run-make/c-link-to-rust-va-list-fn/test.c b/tests/run-make/c-link-to-rust-va-list-fn/test.c new file mode 100644 index 00000000000..5bdb51680a6 --- /dev/null +++ b/tests/run-make/c-link-to-rust-va-list-fn/test.c @@ -0,0 +1,50 @@ +#include +#include +#include +#include +#include + +extern size_t check_list_0(va_list ap); +extern size_t check_list_1(va_list ap); +extern size_t check_list_2(va_list ap); +extern size_t check_list_copy_0(va_list ap); +extern size_t check_varargs_0(int fixed, ...); +extern size_t check_varargs_1(int fixed, ...); +extern size_t check_varargs_2(int fixed, ...); +extern size_t check_varargs_3(int fixed, ...); +extern size_t check_varargs_4(double fixed, ...); +extern size_t check_varargs_5(int fixed, ...); + +int test_rust(size_t (*fn)(va_list), ...) { + size_t ret = 0; + va_list ap; + va_start(ap, fn); + ret = fn(ap); + va_end(ap); + return ret; +} + +int main(int argc, char* argv[]) { + assert(test_rust(check_list_0, 0x01LL, 0x02, 0x03LL) == 0); + + assert(test_rust(check_list_1, -1, 'A', '4', ';', 0x32, 0x10000001, "Valid!") == 0); + + assert(test_rust(check_list_2, 3.14, 12l, 'a', 6.28, "Hello", 42, "World") == 0); + + assert(test_rust(check_list_copy_0, 6.28, 16, 'A', "Skip Me!", "Correct") == 0); + + assert(check_varargs_0(0, 42, "Hello, World!") == 0); + + assert(check_varargs_1(0, 3.14, 12l, 'A', 0x1LL) == 0); + + assert(check_varargs_2(0, "All", "of", "these", "are", "ignored", ".") == 0); + + assert(check_varargs_3(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) == 0); + + assert(check_varargs_4(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0) == 0); + + assert(check_varargs_5(0, 1.0, 1, 2.0, 2, 3.0, 3, 4.0, 4, 5, 5.0, 6, 6.0, 7, 7.0, 8, 8.0, + 9, 9.0, 10, 10.0) == 0); + + return 0; +} diff --git a/tests/run-make/c-static-dylib/Makefile b/tests/run-make/c-static-dylib/Makefile new file mode 100644 index 00000000000..5b78005e3ee --- /dev/null +++ b/tests/run-make/c-static-dylib/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,cfoo) + $(RUSTC) foo.rs -C prefer-dynamic + $(RUSTC) bar.rs + rm $(call NATIVE_STATICLIB,cfoo) + $(call RUN,bar) + $(call REMOVE_DYLIBS,foo) + $(call FAIL,bar) diff --git a/tests/run-make/c-static-dylib/bar.rs b/tests/run-make/c-static-dylib/bar.rs new file mode 100644 index 00000000000..b8c798ffdb4 --- /dev/null +++ b/tests/run-make/c-static-dylib/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::rsfoo(); +} diff --git a/tests/run-make/c-static-dylib/cfoo.c b/tests/run-make/c-static-dylib/cfoo.c new file mode 100644 index 00000000000..9fe07f82f9e --- /dev/null +++ b/tests/run-make/c-static-dylib/cfoo.c @@ -0,0 +1 @@ +int foo() { return 0; } diff --git a/tests/run-make/c-static-dylib/foo.rs b/tests/run-make/c-static-dylib/foo.rs new file mode 100644 index 00000000000..1e8af4d4404 --- /dev/null +++ b/tests/run-make/c-static-dylib/foo.rs @@ -0,0 +1,10 @@ +#![crate_type = "dylib"] + +#[link(name = "cfoo", kind = "static")] +extern "C" { + fn foo(); +} + +pub fn rsfoo() { + unsafe { foo() } +} diff --git a/tests/run-make/c-static-rlib/Makefile b/tests/run-make/c-static-rlib/Makefile new file mode 100644 index 00000000000..11a3cf1940c --- /dev/null +++ b/tests/run-make/c-static-rlib/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,cfoo) + $(RUSTC) foo.rs + $(RUSTC) bar.rs + $(call REMOVE_RLIBS,foo) + rm $(call NATIVE_STATICLIB,cfoo) + $(call RUN,bar) diff --git a/tests/run-make/c-static-rlib/bar.rs b/tests/run-make/c-static-rlib/bar.rs new file mode 100644 index 00000000000..b8c798ffdb4 --- /dev/null +++ b/tests/run-make/c-static-rlib/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::rsfoo(); +} diff --git a/tests/run-make/c-static-rlib/cfoo.c b/tests/run-make/c-static-rlib/cfoo.c new file mode 100644 index 00000000000..9fe07f82f9e --- /dev/null +++ b/tests/run-make/c-static-rlib/cfoo.c @@ -0,0 +1 @@ +int foo() { return 0; } diff --git a/tests/run-make/c-static-rlib/foo.rs b/tests/run-make/c-static-rlib/foo.rs new file mode 100644 index 00000000000..9c6d2080ef4 --- /dev/null +++ b/tests/run-make/c-static-rlib/foo.rs @@ -0,0 +1,10 @@ +#![crate_type = "rlib"] + +#[link(name = "cfoo", kind = "static")] +extern "C" { + fn foo(); +} + +pub fn rsfoo() { + unsafe { foo() } +} diff --git a/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile b/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile new file mode 100644 index 00000000000..134f000d453 --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile @@ -0,0 +1,30 @@ +include ../tools.mk + +all: archive + # Compile `main.rs`, which will link into our library, and run it. + $(RUSTC) main.rs + $(call RUN,main) + +ifdef IS_MSVC +archive: add.o panic.o + # Now, create an archive using these two objects. + $(AR) crus $(TMPDIR)/add.lib $(TMPDIR)/add.o $(TMPDIR)/panic.o +else +archive: add.o panic.o + # Now, create an archive using these two objects. + $(AR) crus $(TMPDIR)/libadd.a $(TMPDIR)/add.o $(TMPDIR)/panic.o +endif + +# Compile `panic.rs` into an object file. +# +# Note that we invoke `rustc` directly, so we may emit an object rather +# than an archive. We'll do that later. +panic.o: + $(BARE_RUSTC) $(RUSTFLAGS) \ + --out-dir $(TMPDIR) \ + --emit=obj panic.rs + +# Compile `add.c` into an object file. +add.o: + $(call COMPILE_OBJ,$(TMPDIR)/add.o,add.c) + diff --git a/tests/run-make/c-unwind-abi-catch-lib-panic/add.c b/tests/run-make/c-unwind-abi-catch-lib-panic/add.c new file mode 100644 index 00000000000..444359451f6 --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-lib-panic/add.c @@ -0,0 +1,12 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + +// An external function, defined in Rust. +extern void panic_if_greater_than_10(unsigned x); + +unsigned add_small_numbers(unsigned a, unsigned b) { + unsigned c = a + b; + panic_if_greater_than_10(c); + return c; +} diff --git a/tests/run-make/c-unwind-abi-catch-lib-panic/main.rs b/tests/run-make/c-unwind-abi-catch-lib-panic/main.rs new file mode 100644 index 00000000000..78a71219c78 --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-lib-panic/main.rs @@ -0,0 +1,35 @@ +//! A test for calling `C-unwind` functions across foreign function boundaries. +//! +//! This test triggers a panic in a Rust library that our foreign function invokes. This shows +//! that we can unwind through the C code in that library, and catch the underlying panic. +#![feature(c_unwind)] + +use std::panic::{catch_unwind, AssertUnwindSafe}; + +fn main() { + // Call `add_small_numbers`, passing arguments that will NOT trigger a panic. + let (a, b) = (9, 1); + let c = unsafe { add_small_numbers(a, b) }; + assert_eq!(c, 10); + + // Call `add_small_numbers`, passing arguments that will trigger a panic, and catch it. + let caught_unwind = catch_unwind(AssertUnwindSafe(|| { + let (a, b) = (10, 1); + let _c = unsafe { add_small_numbers(a, b) }; + unreachable!("should have unwound instead of returned"); + })); + + // Assert that we did indeed panic, then unwrap and downcast the panic into the sum. + assert!(caught_unwind.is_err()); + let panic_obj = caught_unwind.unwrap_err(); + let msg = panic_obj.downcast_ref::().unwrap(); + assert_eq!(msg, "11"); +} + +#[link(name = "add", kind = "static")] +extern "C-unwind" { + /// An external function, defined in C. + /// + /// Returns the sum of two numbers, or panics if the sum is greater than 10. + fn add_small_numbers(a: u32, b: u32) -> u32; +} diff --git a/tests/run-make/c-unwind-abi-catch-lib-panic/panic.rs b/tests/run-make/c-unwind-abi-catch-lib-panic/panic.rs new file mode 100644 index 00000000000..a99a04d5c6f --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-lib-panic/panic.rs @@ -0,0 +1,12 @@ +#![crate_type = "staticlib"] +#![feature(c_unwind)] + +/// This function will panic if `x` is greater than 10. +/// +/// This function is called by `add_small_numbers`. +#[no_mangle] +pub extern "C-unwind" fn panic_if_greater_than_10(x: u32) { + if x > 10 { + panic!("{}", x); // That is too big! + } +} diff --git a/tests/run-make/c-unwind-abi-catch-panic/Makefile b/tests/run-make/c-unwind-abi-catch-panic/Makefile new file mode 100644 index 00000000000..e93ec99da2a --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-panic/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,add) + $(RUSTC) main.rs + $(call RUN,main) || exit 1 diff --git a/tests/run-make/c-unwind-abi-catch-panic/add.c b/tests/run-make/c-unwind-abi-catch-panic/add.c new file mode 100644 index 00000000000..444359451f6 --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-panic/add.c @@ -0,0 +1,12 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + +// An external function, defined in Rust. +extern void panic_if_greater_than_10(unsigned x); + +unsigned add_small_numbers(unsigned a, unsigned b) { + unsigned c = a + b; + panic_if_greater_than_10(c); + return c; +} diff --git a/tests/run-make/c-unwind-abi-catch-panic/main.rs b/tests/run-make/c-unwind-abi-catch-panic/main.rs new file mode 100644 index 00000000000..15d38d72160 --- /dev/null +++ b/tests/run-make/c-unwind-abi-catch-panic/main.rs @@ -0,0 +1,44 @@ +//! A test for calling `C-unwind` functions across foreign function boundaries. +//! +//! This test triggers a panic when calling a foreign function that calls *back* into Rust. +#![feature(c_unwind)] + +use std::panic::{catch_unwind, AssertUnwindSafe}; + +fn main() { + // Call `add_small_numbers`, passing arguments that will NOT trigger a panic. + let (a, b) = (9, 1); + let c = unsafe { add_small_numbers(a, b) }; + assert_eq!(c, 10); + + // Call `add_small_numbers`, passing arguments that will trigger a panic, and catch it. + let caught_unwind = catch_unwind(AssertUnwindSafe(|| { + let (a, b) = (10, 1); + let _c = unsafe { add_small_numbers(a, b) }; + unreachable!("should have unwound instead of returned"); + })); + + // Assert that we did indeed panic, then unwrap and downcast the panic into the sum. + assert!(caught_unwind.is_err()); + let panic_obj = caught_unwind.unwrap_err(); + let msg = panic_obj.downcast_ref::().unwrap(); + assert_eq!(msg, "11"); +} + +#[link(name = "add", kind = "static")] +extern "C-unwind" { + /// An external function, defined in C. + /// + /// Returns the sum of two numbers, or panics if the sum is greater than 10. + fn add_small_numbers(a: u32, b: u32) -> u32; +} + +/// This function will panic if `x` is greater than 10. +/// +/// This function is called by `add_small_numbers`. +#[no_mangle] +pub extern "C-unwind" fn panic_if_greater_than_10(x: u32) { + if x > 10 { + panic!("{}", x); // That is too big! + } +} diff --git a/tests/run-make/cat-and-grep-sanity-check/Makefile b/tests/run-make/cat-and-grep-sanity-check/Makefile new file mode 100644 index 00000000000..82351e22009 --- /dev/null +++ b/tests/run-make/cat-and-grep-sanity-check/Makefile @@ -0,0 +1,46 @@ +include ../tools.mk + +all: + echo a | $(CGREP) a + ! echo b | $(CGREP) a + echo xyz | $(CGREP) x y z + ! echo abc | $(CGREP) b c d + printf "x\ny\nz" | $(CGREP) x y z + + echo AbCd | $(CGREP) -i a b C D + ! echo AbCd | $(CGREP) a b C D + + true | $(CGREP) -v nothing + ! echo nothing | $(CGREP) -v nothing + ! echo xyz | $(CGREP) -v w x y + ! echo xyz | $(CGREP) -v x y z + echo xyz | $(CGREP) -v a b c + + ! echo 'foo bar baz' | $(CGREP) 'foo baz' + echo 'foo bar baz' | $(CGREP) foo baz + echo 'x a `b` c y z' | $(CGREP) 'a `b` c' + + echo baaac | $(CGREP) -e 'ba*c' + echo bc | $(CGREP) -e 'ba*c' + ! echo aaac | $(CGREP) -e 'ba*c' + + echo aaa | $(CGREP) -e 'a+' + ! echo bbb | $(CGREP) -e 'a+' + + echo abc | $(CGREP) -e 'a|e|i|o|u' + ! echo fgh | $(CGREP) -e 'a|e|i|o|u' + echo abc | $(CGREP) -e '[aeiou]' + ! echo fgh | $(CGREP) -e '[aeiou]' + ! echo abc | $(CGREP) -e '[^aeiou]{3}' + echo fgh | $(CGREP) -e '[^aeiou]{3}' + echo ab cd ef gh | $(CGREP) -e '\bcd\b' + ! echo abcdefgh | $(CGREP) -e '\bcd\b' + echo xyz | $(CGREP) -e '...' + ! echo xy | $(CGREP) -e '...' + ! echo xyz | $(CGREP) -e '\.\.\.' + echo ... | $(CGREP) -e '\.\.\.' + + echo foo bar baz | $(CGREP) -e 'foo.*baz' + ! echo foo bar baz | $(CGREP) -ve 'foo.*baz' + ! echo foo bar baz | $(CGREP) -e 'baz.*foo' + echo foo bar baz | $(CGREP) -ve 'baz.*foo' diff --git a/tests/run-make/cdylib-dylib-linkage/Makefile b/tests/run-make/cdylib-dylib-linkage/Makefile new file mode 100644 index 00000000000..5c9b2d1bb2f --- /dev/null +++ b/tests/run-make/cdylib-dylib-linkage/Makefile @@ -0,0 +1,27 @@ +include ../tools.mk + +TARGET_SYSROOT := $(shell $(RUSTC) --print sysroot)/lib/rustlib/$(TARGET)/lib + +ifdef IS_MSVC +LIBSTD := $(wildcard $(TARGET_SYSROOT)/libstd-*.dll.lib) +else +LIBSTD := $(wildcard $(TARGET_SYSROOT)/$(call DYLIB_GLOB,std)) +STD := $(basename $(patsubst lib%,%, $(notdir $(LIBSTD)))) +endif + +all: $(call RUN_BINFILE,foo) + $(call RUN,foo) + +ifdef IS_MSVC +CLIBS := $(TMPDIR)/foo.dll.lib $(TMPDIR)/bar.dll.lib $(LIBSTD) +$(call RUN_BINFILE,foo): $(call DYLIB,foo) + $(CC) $(CFLAGS) foo.c $(CLIBS) $(call OUT_EXE,foo) +else +CLIBS := -lfoo -lbar -l$(STD) -L $(TMPDIR) -L $(TARGET_SYSROOT) +$(call RUN_BINFILE,foo): $(call DYLIB,foo) + $(CC) $(CFLAGS) foo.c $(CLIBS) -o $(call RUN_BINFILE,foo) +endif + +$(call DYLIB,foo): + $(RUSTC) -C prefer-dynamic bar.rs + $(RUSTC) foo.rs diff --git a/tests/run-make/cdylib-dylib-linkage/bar.rs b/tests/run-make/cdylib-dylib-linkage/bar.rs new file mode 100644 index 00000000000..b3a7539abae --- /dev/null +++ b/tests/run-make/cdylib-dylib-linkage/bar.rs @@ -0,0 +1,5 @@ +#![crate_type = "dylib"] + +pub fn bar() { + println!("hello!"); +} diff --git a/tests/run-make/cdylib-dylib-linkage/foo.c b/tests/run-make/cdylib-dylib-linkage/foo.c new file mode 100644 index 00000000000..154f9682ef8 --- /dev/null +++ b/tests/run-make/cdylib-dylib-linkage/foo.c @@ -0,0 +1,10 @@ +#include + +extern void foo(); +extern unsigned bar(unsigned a, unsigned b); + +int main() { + foo(); + assert(bar(1, 2) == 3); + return 0; +} diff --git a/tests/run-make/cdylib-dylib-linkage/foo.rs b/tests/run-make/cdylib-dylib-linkage/foo.rs new file mode 100644 index 00000000000..c4069495aaf --- /dev/null +++ b/tests/run-make/cdylib-dylib-linkage/foo.rs @@ -0,0 +1,13 @@ +#![crate_type = "cdylib"] + +extern crate bar; + +#[no_mangle] +pub extern "C" fn foo() { + bar::bar(); +} + +#[no_mangle] +pub extern "C" fn bar(a: u32, b: u32) -> u32 { + a + b +} diff --git a/tests/run-make/cdylib-fewer-symbols/Makefile b/tests/run-make/cdylib-fewer-symbols/Makefile new file mode 100644 index 00000000000..324791af8de --- /dev/null +++ b/tests/run-make/cdylib-fewer-symbols/Makefile @@ -0,0 +1,12 @@ +# Test that allocator-related symbols don't show up as exported from a cdylib as +# they're internal to Rust and not part of the public ABI. + +include ../tools.mk + +# ignore-windows +# FIXME: The __rdl_ and __rust_ symbol still remains, no matter using MSVC or GNU +# See https://github.com/rust-lang/rust/pull/46207#issuecomment-347561753 + +all: + $(RUSTC) foo.rs + nm -g "$(call DYLIB,foo)" | $(CGREP) -v __rdl_ __rde_ __rg_ __rust_ diff --git a/tests/run-make/cdylib-fewer-symbols/foo.rs b/tests/run-make/cdylib-fewer-symbols/foo.rs new file mode 100644 index 00000000000..af37bc8e953 --- /dev/null +++ b/tests/run-make/cdylib-fewer-symbols/foo.rs @@ -0,0 +1,6 @@ +#![crate_type = "cdylib"] + +#[no_mangle] +pub extern "C" fn foo() -> u32 { + 3 +} diff --git a/tests/run-make/cdylib/Makefile b/tests/run-make/cdylib/Makefile new file mode 100644 index 00000000000..47ec762b3e9 --- /dev/null +++ b/tests/run-make/cdylib/Makefile @@ -0,0 +1,19 @@ +include ../tools.mk + +all: $(call RUN_BINFILE,foo) + $(call RUN,foo) + rm $(call DYLIB,foo) + $(RUSTC) foo.rs -C lto + $(call RUN,foo) + +ifdef IS_MSVC +$(call RUN_BINFILE,foo): $(call DYLIB,foo) + $(CC) $(CFLAGS) foo.c $(TMPDIR)/foo.dll.lib $(call OUT_EXE,foo) +else +$(call RUN_BINFILE,foo): $(call DYLIB,foo) + $(CC) $(CFLAGS) foo.c -lfoo -o $(call RUN_BINFILE,foo) -L $(TMPDIR) +endif + +$(call DYLIB,foo): + $(RUSTC) bar.rs + $(RUSTC) foo.rs diff --git a/tests/run-make/cdylib/bar.rs b/tests/run-make/cdylib/bar.rs new file mode 100644 index 00000000000..fe665abc7c1 --- /dev/null +++ b/tests/run-make/cdylib/bar.rs @@ -0,0 +1,5 @@ +#![crate_type = "rlib"] + +pub fn bar() { + println!("hello!"); +} diff --git a/tests/run-make/cdylib/foo.c b/tests/run-make/cdylib/foo.c new file mode 100644 index 00000000000..154f9682ef8 --- /dev/null +++ b/tests/run-make/cdylib/foo.c @@ -0,0 +1,10 @@ +#include + +extern void foo(); +extern unsigned bar(unsigned a, unsigned b); + +int main() { + foo(); + assert(bar(1, 2) == 3); + return 0; +} diff --git a/tests/run-make/cdylib/foo.rs b/tests/run-make/cdylib/foo.rs new file mode 100644 index 00000000000..c4069495aaf --- /dev/null +++ b/tests/run-make/cdylib/foo.rs @@ -0,0 +1,13 @@ +#![crate_type = "cdylib"] + +extern crate bar; + +#[no_mangle] +pub extern "C" fn foo() { + bar::bar(); +} + +#[no_mangle] +pub extern "C" fn bar(a: u32, b: u32) -> u32 { + a + b +} diff --git a/tests/run-make/codegen-options-parsing/Makefile b/tests/run-make/codegen-options-parsing/Makefile new file mode 100644 index 00000000000..b063593c9d9 --- /dev/null +++ b/tests/run-make/codegen-options-parsing/Makefile @@ -0,0 +1,31 @@ +include ../tools.mk + +all: + #Option taking a number + $(RUSTC) -C codegen-units dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `codegen-units` requires a number' + $(RUSTC) -C codegen-units= dummy.rs 2>&1 | \ + $(CGREP) 'incorrect value `` for codegen option `codegen-units` - a number was expected' + $(RUSTC) -C codegen-units=foo dummy.rs 2>&1 | \ + $(CGREP) 'incorrect value `foo` for codegen option `codegen-units` - a number was expected' + $(RUSTC) -C codegen-units=1 dummy.rs + #Option taking a string + $(RUSTC) -C extra-filename dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `extra-filename` requires a string' + $(RUSTC) -C extra-filename= dummy.rs 2>&1 + $(RUSTC) -C extra-filename=foo dummy.rs 2>&1 + #Option taking no argument + $(RUSTC) -C lto= dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted' + $(RUSTC) -C lto=1 dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted' + $(RUSTC) -C lto=foo dummy.rs 2>&1 | \ + $(CGREP) 'codegen option `lto` - either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted' + $(RUSTC) -C lto dummy.rs + + # Should not link dead code... + $(RUSTC) --print link-args dummy.rs 2>&1 | \ + $(CGREP) -e '--gc-sections|-z[^ ]* [^ ]*|-dead_strip|/OPT:REF' + # ... unless you specifically ask to keep it + $(RUSTC) --print link-args -C link-dead-code dummy.rs 2>&1 | \ + $(CGREP) -ve '--gc-sections|-z[^ ]* [^ ]*|-dead_strip|/OPT:REF' diff --git a/tests/run-make/codegen-options-parsing/dummy.rs b/tests/run-make/codegen-options-parsing/dummy.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/codegen-options-parsing/dummy.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/compile-stdin/Makefile b/tests/run-make/compile-stdin/Makefile new file mode 100644 index 00000000000..be15548690f --- /dev/null +++ b/tests/run-make/compile-stdin/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + echo 'fn main(){}' | $(RUSTC) - + $(call RUN,rust_out) diff --git a/tests/run-make/compiler-lookup-paths-2/Makefile b/tests/run-make/compiler-lookup-paths-2/Makefile new file mode 100644 index 00000000000..d4ff7d8daab --- /dev/null +++ b/tests/run-make/compiler-lookup-paths-2/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +all: + mkdir -p $(TMPDIR)/a $(TMPDIR)/b + $(RUSTC) a.rs && mv $(TMPDIR)/liba.rlib $(TMPDIR)/a + $(RUSTC) b.rs -L $(TMPDIR)/a && mv $(TMPDIR)/libb.rlib $(TMPDIR)/b + $(RUSTC) c.rs -L crate=$(TMPDIR)/b -L dependency=$(TMPDIR)/a \ + && exit 1 || exit 0 diff --git a/tests/run-make/compiler-lookup-paths-2/a.rs b/tests/run-make/compiler-lookup-paths-2/a.rs new file mode 100644 index 00000000000..83be6e807e0 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths-2/a.rs @@ -0,0 +1 @@ +#![crate_type = "lib"] diff --git a/tests/run-make/compiler-lookup-paths-2/b.rs b/tests/run-make/compiler-lookup-paths-2/b.rs new file mode 100644 index 00000000000..1be6cbc919d --- /dev/null +++ b/tests/run-make/compiler-lookup-paths-2/b.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +extern crate a; diff --git a/tests/run-make/compiler-lookup-paths-2/c.rs b/tests/run-make/compiler-lookup-paths-2/c.rs new file mode 100644 index 00000000000..e37bc2e1dce --- /dev/null +++ b/tests/run-make/compiler-lookup-paths-2/c.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] +extern crate b; +extern crate a; diff --git a/tests/run-make/compiler-lookup-paths/Makefile b/tests/run-make/compiler-lookup-paths/Makefile new file mode 100644 index 00000000000..c16bf7af6c4 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/Makefile @@ -0,0 +1,38 @@ +include ../tools.mk + +all: $(TMPDIR)/libnative.a + mkdir -p $(TMPDIR)/crate + mkdir -p $(TMPDIR)/native + mv $(TMPDIR)/libnative.a $(TMPDIR)/native + $(RUSTC) a.rs + mv $(TMPDIR)/liba.rlib $(TMPDIR)/crate + $(RUSTC) b.rs -L native=$(TMPDIR)/crate && exit 1 || exit 0 + $(RUSTC) b.rs -L dependency=$(TMPDIR)/crate && exit 1 || exit 0 + $(RUSTC) b.rs -L crate=$(TMPDIR)/crate + $(RUSTC) b.rs -L all=$(TMPDIR)/crate + $(RUSTC) c.rs -L native=$(TMPDIR)/crate && exit 1 || exit 0 + $(RUSTC) c.rs -L crate=$(TMPDIR)/crate && exit 1 || exit 0 + $(RUSTC) c.rs -L dependency=$(TMPDIR)/crate + $(RUSTC) c.rs -L all=$(TMPDIR)/crate + $(RUSTC) d.rs -L dependency=$(TMPDIR)/native && exit 1 || exit 0 + $(RUSTC) d.rs -L crate=$(TMPDIR)/native && exit 1 || exit 0 + $(RUSTC) d.rs -L native=$(TMPDIR)/native + $(RUSTC) d.rs -L all=$(TMPDIR)/native + # Deduplication tests: + # Same hash, no errors. + mkdir -p $(TMPDIR)/e1 + mkdir -p $(TMPDIR)/e2 + $(RUSTC) e.rs -o $(TMPDIR)/e1/libe.rlib + $(RUSTC) e.rs -o $(TMPDIR)/e2/libe.rlib + $(RUSTC) f.rs -L $(TMPDIR)/e1 -L $(TMPDIR)/e2 + $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L $(TMPDIR)/e2 + $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 + # Different hash, errors. + $(RUSTC) e2.rs -o $(TMPDIR)/e2/libe.rlib + $(RUSTC) f.rs -L $(TMPDIR)/e1 -L $(TMPDIR)/e2 && exit 1 || exit 0 + $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L $(TMPDIR)/e2 && exit 1 || exit 0 + $(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 && exit 1 || exit 0 + # Native/dependency paths don't cause errors. + $(RUSTC) f.rs -L native=$(TMPDIR)/e1 -L $(TMPDIR)/e2 + $(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L $(TMPDIR)/e2 + $(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 diff --git a/tests/run-make/compiler-lookup-paths/a.rs b/tests/run-make/compiler-lookup-paths/a.rs new file mode 100644 index 00000000000..83be6e807e0 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/a.rs @@ -0,0 +1 @@ +#![crate_type = "lib"] diff --git a/tests/run-make/compiler-lookup-paths/b.rs b/tests/run-make/compiler-lookup-paths/b.rs new file mode 100644 index 00000000000..1be6cbc919d --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/b.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +extern crate a; diff --git a/tests/run-make/compiler-lookup-paths/c.rs b/tests/run-make/compiler-lookup-paths/c.rs new file mode 100644 index 00000000000..4c7ce01b6a0 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/c.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +extern crate b; diff --git a/tests/run-make/compiler-lookup-paths/d.rs b/tests/run-make/compiler-lookup-paths/d.rs new file mode 100644 index 00000000000..6cd9916b6f6 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/d.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] + +#[link(name = "native", kind = "static")] +extern "C" {} diff --git a/tests/run-make/compiler-lookup-paths/e.rs b/tests/run-make/compiler-lookup-paths/e.rs new file mode 100644 index 00000000000..18eb60aca97 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/e.rs @@ -0,0 +1,2 @@ +#![crate_name = "e"] +#![crate_type = "rlib"] diff --git a/tests/run-make/compiler-lookup-paths/e2.rs b/tests/run-make/compiler-lookup-paths/e2.rs new file mode 100644 index 00000000000..cbf08b98e7e --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/e2.rs @@ -0,0 +1,4 @@ +#![crate_name = "e"] +#![crate_type = "rlib"] + +pub fn f() {} diff --git a/tests/run-make/compiler-lookup-paths/f.rs b/tests/run-make/compiler-lookup-paths/f.rs new file mode 100644 index 00000000000..483deaaea49 --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/f.rs @@ -0,0 +1,2 @@ +#![crate_type = "rlib"] +extern crate e; diff --git a/tests/run-make/compiler-lookup-paths/native.c b/tests/run-make/compiler-lookup-paths/native.c new file mode 100644 index 00000000000..d11c69f812a --- /dev/null +++ b/tests/run-make/compiler-lookup-paths/native.c @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/run-make/compiler-rt-works-on-mingw/Makefile b/tests/run-make/compiler-rt-works-on-mingw/Makefile new file mode 100644 index 00000000000..74917570a01 --- /dev/null +++ b/tests/run-make/compiler-rt-works-on-mingw/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# only-windows-gnu + +all: + $(CXX) foo.cpp -c -o $(TMPDIR)/foo.o + $(AR) crus $(TMPDIR)/libfoo.a $(TMPDIR)/foo.o + $(RUSTC) foo.rs -lfoo -lstdc++ + $(call RUN,foo) diff --git a/tests/run-make/compiler-rt-works-on-mingw/foo.cpp b/tests/run-make/compiler-rt-works-on-mingw/foo.cpp new file mode 100644 index 00000000000..4c2fb9cdb87 --- /dev/null +++ b/tests/run-make/compiler-rt-works-on-mingw/foo.cpp @@ -0,0 +1,4 @@ +extern "C" void foo() { + int *a = new int(3); + delete a; +} diff --git a/tests/run-make/compiler-rt-works-on-mingw/foo.rs b/tests/run-make/compiler-rt-works-on-mingw/foo.rs new file mode 100644 index 00000000000..7fdb8158871 --- /dev/null +++ b/tests/run-make/compiler-rt-works-on-mingw/foo.rs @@ -0,0 +1,10 @@ +extern "C" { + fn foo(); +} + +pub fn main() { + unsafe { + foo(); + } + assert_eq!(7f32.powi(3), 343f32); +} diff --git a/tests/run-make/core-no-fp-fmt-parse/Makefile b/tests/run-make/core-no-fp-fmt-parse/Makefile new file mode 100644 index 00000000000..837664d92b9 --- /dev/null +++ b/tests/run-make/core-no-fp-fmt-parse/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/core/src/lib.rs --cfg no_fp_fmt_parse diff --git a/tests/run-make/crate-data-smoke/Makefile b/tests/run-make/crate-data-smoke/Makefile new file mode 100644 index 00000000000..a453f65ff3e --- /dev/null +++ b/tests/run-make/crate-data-smoke/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +all: + [ `$(RUSTC) --print crate-name crate.rs` = "foo" ] + [ `$(RUSTC) --print file-names crate.rs` = "$(call BIN,foo)" ] + [ `$(RUSTC) --print file-names --crate-type=lib \ + --test crate.rs` = "$(call BIN,foo)" ] + [ `$(RUSTC) --print file-names --test lib.rs` = "$(call BIN,mylib)" ] + $(RUSTC) --print file-names lib.rs + $(RUSTC) --print file-names rlib.rs diff --git a/tests/run-make/crate-data-smoke/crate.rs b/tests/run-make/crate-data-smoke/crate.rs new file mode 100644 index 00000000000..a48a6f51c42 --- /dev/null +++ b/tests/run-make/crate-data-smoke/crate.rs @@ -0,0 +1,7 @@ +#![crate_name = "foo"] + +// Querying about the crate metadata should *not* parse the entire crate, it +// only needs the crate attributes (which are guaranteed to be at the top) be +// sure that if we have an error like a missing module that we can still query +// about the crate id. +mod error; diff --git a/tests/run-make/crate-data-smoke/lib.rs b/tests/run-make/crate-data-smoke/lib.rs new file mode 100644 index 00000000000..8002f11ec87 --- /dev/null +++ b/tests/run-make/crate-data-smoke/lib.rs @@ -0,0 +1,2 @@ +#![crate_name = "mylib"] +#![crate_type = "lib"] diff --git a/tests/run-make/crate-data-smoke/rlib.rs b/tests/run-make/crate-data-smoke/rlib.rs new file mode 100644 index 00000000000..47fcce4a7f6 --- /dev/null +++ b/tests/run-make/crate-data-smoke/rlib.rs @@ -0,0 +1,2 @@ +#![crate_name = "mylib"] +#![crate_type = "rlib"] diff --git a/tests/run-make/crate-hash-rustc-version/Makefile b/tests/run-make/crate-hash-rustc-version/Makefile new file mode 100644 index 00000000000..4f25a865ebd --- /dev/null +++ b/tests/run-make/crate-hash-rustc-version/Makefile @@ -0,0 +1,37 @@ +include ../../run-make-fulldeps/tools.mk + +# Ensure that crates compiled with different rustc versions cannot +# be dynamically linked. + +FLAGS := -Cprefer-dynamic -Zsymbol-mangling-version=v0 +UNAME := $(shell uname) +ifeq ($(UNAME),Linux) + EXT=".so" + NM_CMD := nm -D +endif +ifeq ($(UNAME),Darwin) + EXT=".dylib" + NM_CMD := nm +endif + +ifndef NM_CMD +all: + exit 0 +else +all: + # a.rs is a dylib + $(RUSTC) a.rs --crate-type=dylib $(FLAGS) + # Write symbols to disk. + $(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsbefore + # b.rs is a binary + $(RUSTC) b.rs --extern a=$(TMPDIR)/liba$(EXT) --crate-type=bin -Crpath $(FLAGS) + $(call RUN,b) + # Now re-compile a.rs with another rustc version + RUSTC_FORCE_RUSTC_VERSION=deadfeed $(RUSTC) a.rs --crate-type=dylib $(FLAGS) + # After compiling with a different rustc version, write symbols to disk again. + $(NM_CMD) $(call DYLIB,a) > $(TMPDIR)/symbolsafter + # As a sanity check, test if the symbols changed: + # If the symbols are identical, there's been an error. + if diff $(TMPDIR)/symbolsbefore $(TMPDIR)/symbolsafter; then exit 1; fi + $(call FAIL,b) +endif diff --git a/tests/run-make/crate-hash-rustc-version/a.rs b/tests/run-make/crate-hash-rustc-version/a.rs new file mode 100644 index 00000000000..d65b5ce8e88 --- /dev/null +++ b/tests/run-make/crate-hash-rustc-version/a.rs @@ -0,0 +1,4 @@ +pub fn foo(mut x: String) -> String { + x.push_str(", world!"); + x +} diff --git a/tests/run-make/crate-hash-rustc-version/b.rs b/tests/run-make/crate-hash-rustc-version/b.rs new file mode 100644 index 00000000000..316ac26e73f --- /dev/null +++ b/tests/run-make/crate-hash-rustc-version/b.rs @@ -0,0 +1,8 @@ +extern crate a; + +use a::foo; + +fn main() { + let x = String::from("Hello"); + println!("{}", foo(x)); +} diff --git a/tests/run-make/crate-name-priority/Makefile b/tests/run-make/crate-name-priority/Makefile new file mode 100644 index 00000000000..08a07c325e3 --- /dev/null +++ b/tests/run-make/crate-name-priority/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --crate-name bar + rm $(TMPDIR)/$(call BIN,bar) + $(RUSTC) foo1.rs + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo1.rs -o $(TMPDIR)/$(call BIN,bar1) + rm $(TMPDIR)/$(call BIN,bar1) diff --git a/tests/run-make/crate-name-priority/foo.rs b/tests/run-make/crate-name-priority/foo.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/crate-name-priority/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/crate-name-priority/foo1.rs b/tests/run-make/crate-name-priority/foo1.rs new file mode 100644 index 00000000000..4ff3bd9516b --- /dev/null +++ b/tests/run-make/crate-name-priority/foo1.rs @@ -0,0 +1,3 @@ +#![crate_name = "foo"] + +fn main() {} diff --git a/tests/run-make/cross-lang-lto-clang/Makefile b/tests/run-make/cross-lang-lto-clang/Makefile new file mode 100644 index 00000000000..acaebf439d6 --- /dev/null +++ b/tests/run-make/cross-lang-lto-clang/Makefile @@ -0,0 +1,25 @@ +# needs-matching-clang + +# This test makes sure that cross-language inlining actually works by checking +# the generated machine code. + +include ../tools.mk + +all: cpp-executable rust-executable + +cpp-executable: + $(RUSTC) -Clinker-plugin-lto=on -o $(TMPDIR)/librustlib-xlto.a -Copt-level=2 -Ccodegen-units=1 ./rustlib.rs + $(CLANG) -flto=thin -fuse-ld=lld -L $(TMPDIR) -lrustlib-xlto -o $(TMPDIR)/cmain ./cmain.c -O3 + # Make sure we don't find a call instruction to the function we expect to + # always be inlined. + "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -v -e "call.*rust_always_inlined" + # As a sanity check, make sure we do find a call instruction to a + # non-inlined function + "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -e "call.*rust_never_inlined" + +rust-executable: + $(CLANG) ./clib.c -flto=thin -c -o $(TMPDIR)/clib.o -O2 + (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) + $(RUSTC) -Clinker-plugin-lto=on -L$(TMPDIR) -Copt-level=2 -Clinker=$(CLANG) -Clink-arg=-fuse-ld=lld ./main.rs -o $(TMPDIR)/rsmain + "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -e "call.*c_never_inlined" + "$(LLVM_BIN_DIR)"/llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -v -e "call.*c_always_inlined" diff --git a/tests/run-make/cross-lang-lto-clang/clib.c b/tests/run-make/cross-lang-lto-clang/clib.c new file mode 100644 index 00000000000..90f33f24dc4 --- /dev/null +++ b/tests/run-make/cross-lang-lto-clang/clib.c @@ -0,0 +1,9 @@ +#include + +uint32_t c_always_inlined() { + return 1234; +} + +__attribute__((noinline)) uint32_t c_never_inlined() { + return 12345; +} diff --git a/tests/run-make/cross-lang-lto-clang/cmain.c b/tests/run-make/cross-lang-lto-clang/cmain.c new file mode 100644 index 00000000000..e62a40117ce --- /dev/null +++ b/tests/run-make/cross-lang-lto-clang/cmain.c @@ -0,0 +1,12 @@ +#include + +// A trivial function defined in Rust, returning a constant value. This should +// always be inlined. +uint32_t rust_always_inlined(); + + +uint32_t rust_never_inlined(); + +int main(int argc, char** argv) { + return rust_never_inlined() + rust_always_inlined(); +} diff --git a/tests/run-make/cross-lang-lto-clang/main.rs b/tests/run-make/cross-lang-lto-clang/main.rs new file mode 100644 index 00000000000..8129dcb85d9 --- /dev/null +++ b/tests/run-make/cross-lang-lto-clang/main.rs @@ -0,0 +1,11 @@ +#[link(name = "xyz")] +extern "C" { + fn c_always_inlined() -> u32; + fn c_never_inlined() -> u32; +} + +fn main() { + unsafe { + println!("blub: {}", c_always_inlined() + c_never_inlined()); + } +} diff --git a/tests/run-make/cross-lang-lto-clang/rustlib.rs b/tests/run-make/cross-lang-lto-clang/rustlib.rs new file mode 100644 index 00000000000..8a74d74a420 --- /dev/null +++ b/tests/run-make/cross-lang-lto-clang/rustlib.rs @@ -0,0 +1,12 @@ +#![crate_type="staticlib"] + +#[no_mangle] +pub extern "C" fn rust_always_inlined() -> u32 { + 42 +} + +#[no_mangle] +#[inline(never)] +pub extern "C" fn rust_never_inlined() -> u32 { + 421 +} diff --git a/tests/run-make/cross-lang-lto-pgo-smoketest/Makefile b/tests/run-make/cross-lang-lto-pgo-smoketest/Makefile new file mode 100644 index 00000000000..70085d9bde1 --- /dev/null +++ b/tests/run-make/cross-lang-lto-pgo-smoketest/Makefile @@ -0,0 +1,87 @@ +# needs-matching-clang + +# This test makes sure that cross-language inlining can be used in conjunction +# with profile-guided optimization. The test only tests that the whole workflow +# can be executed without anything crashing. It does not test whether PGO or +# xLTO have any specific effect on the generated code. + +include ../tools.mk + +COMMON_FLAGS=-Copt-level=3 -Ccodegen-units=1 + +# LLVM doesn't support instrumenting binaries that use SEH: +# https://bugs.llvm.org/show_bug.cgi?id=41279 +# +# Things work fine with -Cpanic=abort though. +ifdef IS_MSVC +COMMON_FLAGS+= -Cpanic=abort +endif + +all: cpp-executable rust-executable + +cpp-executable: + $(RUSTC) -Clinker-plugin-lto=on \ + -Cprofile-generate="$(TMPDIR)"/cpp-profdata \ + -o "$(TMPDIR)"/librustlib-xlto.a \ + $(COMMON_FLAGS) \ + ./rustlib.rs + $(CLANG) -flto=thin \ + -fprofile-generate="$(TMPDIR)"/cpp-profdata \ + -fuse-ld=lld \ + -L "$(TMPDIR)" \ + -lrustlib-xlto \ + -o "$(TMPDIR)"/cmain \ + -O3 \ + ./cmain.c + $(TMPDIR)/cmain + # Postprocess the profiling data so it can be used by the compiler + "$(LLVM_BIN_DIR)"/llvm-profdata merge \ + -o "$(TMPDIR)"/cpp-profdata/merged.profdata \ + "$(TMPDIR)"/cpp-profdata/default_*.profraw + $(RUSTC) -Clinker-plugin-lto=on \ + -Cprofile-use="$(TMPDIR)"/cpp-profdata/merged.profdata \ + -o "$(TMPDIR)"/librustlib-xlto.a \ + $(COMMON_FLAGS) \ + ./rustlib.rs + $(CLANG) -flto=thin \ + -fprofile-use="$(TMPDIR)"/cpp-profdata/merged.profdata \ + -fuse-ld=lld \ + -L "$(TMPDIR)" \ + -lrustlib-xlto \ + -o "$(TMPDIR)"/cmain \ + -O3 \ + ./cmain.c + +rust-executable: + exit + $(CLANG) ./clib.c -fprofile-generate="$(TMPDIR)"/rs-profdata -flto=thin -c -o $(TMPDIR)/clib.o -O3 + (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) + $(RUSTC) -Clinker-plugin-lto=on \ + -Cprofile-generate="$(TMPDIR)"/rs-profdata \ + -L$(TMPDIR) \ + $(COMMON_FLAGS) \ + -Clinker=$(CLANG) \ + -Clink-arg=-fuse-ld=lld \ + -o $(TMPDIR)/rsmain \ + ./main.rs + $(TMPDIR)/rsmain + # Postprocess the profiling data so it can be used by the compiler + "$(LLVM_BIN_DIR)"/llvm-profdata merge \ + -o "$(TMPDIR)"/rs-profdata/merged.profdata \ + "$(TMPDIR)"/rs-profdata/default_*.profraw + $(CLANG) ./clib.c \ + -fprofile-use="$(TMPDIR)"/rs-profdata/merged.profdata \ + -flto=thin \ + -c \ + -o $(TMPDIR)/clib.o \ + -O3 + rm "$(TMPDIR)"/libxyz.a + (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) + $(RUSTC) -Clinker-plugin-lto=on \ + -Cprofile-use="$(TMPDIR)"/rs-profdata/merged.profdata \ + -L$(TMPDIR) \ + $(COMMON_FLAGS) \ + -Clinker=$(CLANG) \ + -Clink-arg=-fuse-ld=lld \ + -o $(TMPDIR)/rsmain \ + ./main.rs diff --git a/tests/run-make/cross-lang-lto-pgo-smoketest/clib.c b/tests/run-make/cross-lang-lto-pgo-smoketest/clib.c new file mode 100644 index 00000000000..90f33f24dc4 --- /dev/null +++ b/tests/run-make/cross-lang-lto-pgo-smoketest/clib.c @@ -0,0 +1,9 @@ +#include + +uint32_t c_always_inlined() { + return 1234; +} + +__attribute__((noinline)) uint32_t c_never_inlined() { + return 12345; +} diff --git a/tests/run-make/cross-lang-lto-pgo-smoketest/cmain.c b/tests/run-make/cross-lang-lto-pgo-smoketest/cmain.c new file mode 100644 index 00000000000..e3f24828be3 --- /dev/null +++ b/tests/run-make/cross-lang-lto-pgo-smoketest/cmain.c @@ -0,0 +1,12 @@ +#include + +// A trivial function defined in Rust, returning a constant value. This should +// always be inlined. +uint32_t rust_always_inlined(); + + +uint32_t rust_never_inlined(); + +int main(int argc, char** argv) { + return (rust_never_inlined() + rust_always_inlined()) * 0; +} diff --git a/tests/run-make/cross-lang-lto-pgo-smoketest/main.rs b/tests/run-make/cross-lang-lto-pgo-smoketest/main.rs new file mode 100644 index 00000000000..8129dcb85d9 --- /dev/null +++ b/tests/run-make/cross-lang-lto-pgo-smoketest/main.rs @@ -0,0 +1,11 @@ +#[link(name = "xyz")] +extern "C" { + fn c_always_inlined() -> u32; + fn c_never_inlined() -> u32; +} + +fn main() { + unsafe { + println!("blub: {}", c_always_inlined() + c_never_inlined()); + } +} diff --git a/tests/run-make/cross-lang-lto-pgo-smoketest/rustlib.rs b/tests/run-make/cross-lang-lto-pgo-smoketest/rustlib.rs new file mode 100644 index 00000000000..8a74d74a420 --- /dev/null +++ b/tests/run-make/cross-lang-lto-pgo-smoketest/rustlib.rs @@ -0,0 +1,12 @@ +#![crate_type="staticlib"] + +#[no_mangle] +pub extern "C" fn rust_always_inlined() -> u32 { + 42 +} + +#[no_mangle] +#[inline(never)] +pub extern "C" fn rust_never_inlined() -> u32 { + 421 +} diff --git a/tests/run-make/cross-lang-lto-upstream-rlibs/Makefile b/tests/run-make/cross-lang-lto-upstream-rlibs/Makefile new file mode 100644 index 00000000000..6f1caa31a80 --- /dev/null +++ b/tests/run-make/cross-lang-lto-upstream-rlibs/Makefile @@ -0,0 +1,32 @@ +include ../tools.mk + +# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same +# (so fixing it is harder). See #57765 for context +ifndef IS_WINDOWS + +# This test makes sure that we don't loose upstream object files when compiling +# staticlibs with -C linker-plugin-lto + +all: staticlib.rs upstream.rs + $(RUSTC) upstream.rs -C linker-plugin-lto -Ccodegen-units=1 + + # Check No LTO + $(RUSTC) staticlib.rs -C linker-plugin-lto -Ccodegen-units=1 -L. -o $(TMPDIR)/staticlib.a + (cd $(TMPDIR); "$(LLVM_BIN_DIR)"/llvm-ar x ./staticlib.a) + # Make sure the upstream object file was included + ls $(TMPDIR)/upstream.*.rcgu.o + + # Cleanup + rm $(TMPDIR)/* + + # Check ThinLTO + $(RUSTC) upstream.rs -C linker-plugin-lto -Ccodegen-units=1 -Clto=thin + $(RUSTC) staticlib.rs -C linker-plugin-lto -Ccodegen-units=1 -Clto=thin -L. -o $(TMPDIR)/staticlib.a + (cd $(TMPDIR); "$(LLVM_BIN_DIR)"/llvm-ar x ./staticlib.a) + ls $(TMPDIR)/upstream.*.rcgu.o + +else + +all: + +endif diff --git a/tests/run-make/cross-lang-lto-upstream-rlibs/staticlib.rs b/tests/run-make/cross-lang-lto-upstream-rlibs/staticlib.rs new file mode 100644 index 00000000000..34951dda3b6 --- /dev/null +++ b/tests/run-make/cross-lang-lto-upstream-rlibs/staticlib.rs @@ -0,0 +1,8 @@ +#![crate_type="staticlib"] + +extern crate upstream; + +#[no_mangle] +pub extern "C" fn bar() { + upstream::foo(); +} diff --git a/tests/run-make/cross-lang-lto-upstream-rlibs/upstream.rs b/tests/run-make/cross-lang-lto-upstream-rlibs/upstream.rs new file mode 100644 index 00000000000..bd6820098ee --- /dev/null +++ b/tests/run-make/cross-lang-lto-upstream-rlibs/upstream.rs @@ -0,0 +1,3 @@ +#![crate_type = "rlib"] + +pub fn foo() {} diff --git a/tests/run-make/cross-lang-lto/Makefile b/tests/run-make/cross-lang-lto/Makefile new file mode 100644 index 00000000000..92058f952a9 --- /dev/null +++ b/tests/run-make/cross-lang-lto/Makefile @@ -0,0 +1,57 @@ + +include ../tools.mk + +# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same +# (so fixing it is harder). See #57765 for context +ifndef IS_WINDOWS + +# This test makes sure that the object files we generate are actually +# LLVM bitcode files (as used by linker LTO plugins) when compiling with +# -Clinker-plugin-lto. + +# this only succeeds for bitcode files +ASSERT_IS_BITCODE_OBJ=("$(LLVM_BIN_DIR)"/llvm-bcanalyzer $(1)) +EXTRACT_OBJS=(cd $(TMPDIR); rm -f ./*.o; "$(LLVM_BIN_DIR)"/llvm-ar x $(1)) + +BUILD_LIB=$(RUSTC) lib.rs -Copt-level=2 -Clinker-plugin-lto -Ccodegen-units=1 +BUILD_EXE=$(RUSTC) main.rs -Copt-level=2 -Clinker-plugin-lto -Ccodegen-units=1 --emit=obj + +all: staticlib staticlib-fat-lto staticlib-thin-lto rlib exe cdylib rdylib + +staticlib: lib.rs + $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib.a + $(call EXTRACT_OBJS, liblib.a) + for file in $(TMPDIR)/liblib.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done + +staticlib-fat-lto: lib.rs + $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-fat-lto.a -Clto=fat + $(call EXTRACT_OBJS, liblib-fat-lto.a) + for file in $(TMPDIR)/liblib-fat-lto.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done + +staticlib-thin-lto: lib.rs + $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-thin-lto.a -Clto=thin + $(call EXTRACT_OBJS, liblib-thin-lto.a) + for file in $(TMPDIR)/liblib-thin-lto.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done + +rlib: lib.rs + $(BUILD_LIB) --crate-type=rlib -o $(TMPDIR)/liblib.rlib + $(call EXTRACT_OBJS, liblib.rlib) + for file in $(TMPDIR)/liblib.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done + +cdylib: lib.rs + $(BUILD_LIB) --crate-type=cdylib --emit=obj -o $(TMPDIR)/cdylib.o + $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/cdylib.o) + +rdylib: lib.rs + $(BUILD_LIB) --crate-type=dylib --emit=obj -o $(TMPDIR)/rdylib.o + $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/rdylib.o) + +exe: lib.rs + $(BUILD_EXE) -o $(TMPDIR)/exe.o + $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/exe.o) + +else + +all: + +endif diff --git a/tests/run-make/cross-lang-lto/lib.rs b/tests/run-make/cross-lang-lto/lib.rs new file mode 100644 index 00000000000..94cfef6ada5 --- /dev/null +++ b/tests/run-make/cross-lang-lto/lib.rs @@ -0,0 +1,4 @@ +#[no_mangle] +pub extern "C" fn foo() { + println!("abc"); +} diff --git a/tests/run-make/cross-lang-lto/main.rs b/tests/run-make/cross-lang-lto/main.rs new file mode 100644 index 00000000000..f6320bcb04a --- /dev/null +++ b/tests/run-make/cross-lang-lto/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello World"); +} diff --git a/tests/run-make/debug-assertions/Makefile b/tests/run-make/debug-assertions/Makefile new file mode 100644 index 00000000000..73beb4b03ae --- /dev/null +++ b/tests/run-make/debug-assertions/Makefile @@ -0,0 +1,25 @@ +include ../tools.mk + +all: + $(RUSTC) debug.rs -C debug-assertions=no + $(call RUN,debug) good + $(RUSTC) debug.rs -C opt-level=0 + $(call RUN,debug) bad + $(RUSTC) debug.rs -C opt-level=1 + $(call RUN,debug) good + $(RUSTC) debug.rs -C opt-level=2 + $(call RUN,debug) good + $(RUSTC) debug.rs -C opt-level=3 + $(call RUN,debug) good + $(RUSTC) debug.rs -C opt-level=s + $(call RUN,debug) good + $(RUSTC) debug.rs -C opt-level=z + $(call RUN,debug) good + $(RUSTC) debug.rs -O + $(call RUN,debug) good + $(RUSTC) debug.rs + $(call RUN,debug) bad + $(RUSTC) debug.rs -C debug-assertions=yes -O + $(call RUN,debug) bad + $(RUSTC) debug.rs -C debug-assertions=yes -C opt-level=1 + $(call RUN,debug) bad diff --git a/tests/run-make/debug-assertions/debug.rs b/tests/run-make/debug-assertions/debug.rs new file mode 100644 index 00000000000..76ca60a71c8 --- /dev/null +++ b/tests/run-make/debug-assertions/debug.rs @@ -0,0 +1,33 @@ +#![feature(rustc_attrs)] +#![deny(warnings)] + +use std::env; +use std::thread; + +fn main() { + let should_fail = env::args().nth(1) == Some("bad".to_string()); + + assert_eq!(thread::spawn(debug_assert_eq).join().is_err(), should_fail); + assert_eq!(thread::spawn(debug_assert).join().is_err(), should_fail); + assert_eq!(thread::spawn(overflow).join().is_err(), should_fail); +} + +fn debug_assert_eq() { + let mut hit1 = false; + let mut hit2 = false; + debug_assert_eq!({ hit1 = true; 1 }, { hit2 = true; 2 }); + assert!(!hit1); + assert!(!hit2); +} + +fn debug_assert() { + let mut hit = false; + debug_assert!({ hit = true; false }); + assert!(!hit); +} + +fn overflow() { + fn add(a: u8, b: u8) -> u8 { a + b } + + add(200u8, 200u8); +} diff --git a/tests/run-make/dep-info-doesnt-run-much/Makefile b/tests/run-make/dep-info-doesnt-run-much/Makefile new file mode 100644 index 00000000000..b4dc44ad2be --- /dev/null +++ b/tests/run-make/dep-info-doesnt-run-much/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs --emit dep-info diff --git a/tests/run-make/dep-info-doesnt-run-much/foo.rs b/tests/run-make/dep-info-doesnt-run-much/foo.rs new file mode 100644 index 00000000000..316e681293e --- /dev/null +++ b/tests/run-make/dep-info-doesnt-run-much/foo.rs @@ -0,0 +1,5 @@ +// We're only emitting dep info, so we shouldn't be running static analysis to +// figure out that this program is erroneous. +fn main() { + let a: u8 = "a"; +} diff --git a/tests/run-make/dep-info-spaces/Makefile b/tests/run-make/dep-info-spaces/Makefile new file mode 100644 index 00000000000..0cfe513e490 --- /dev/null +++ b/tests/run-make/dep-info-spaces/Makefile @@ -0,0 +1,19 @@ +include ../tools.mk + +# ignore-windows +# ignore-freebsd +# FIXME: (windows: see `../dep-info/Makefile`) + +all: + cp lib.rs $(TMPDIR)/ + cp 'foo foo.rs' $(TMPDIR)/ + cp bar.rs $(TMPDIR)/ + $(RUSTC) --emit link,dep-info --crate-type=lib $(TMPDIR)/lib.rs + sleep 1 + touch $(TMPDIR)/'foo foo.rs' + -rm -f $(TMPDIR)/done + $(MAKE) -drf Makefile.foo + rm $(TMPDIR)/done + pwd + $(MAKE) -drf Makefile.foo + rm $(TMPDIR)/done && exit 1 || exit 0 diff --git a/tests/run-make/dep-info-spaces/Makefile.foo b/tests/run-make/dep-info-spaces/Makefile.foo new file mode 100644 index 00000000000..80a5d4333cd --- /dev/null +++ b/tests/run-make/dep-info-spaces/Makefile.foo @@ -0,0 +1,7 @@ +LIB := $(shell $(RUSTC) --print file-names --crate-type=lib $(TMPDIR)/lib.rs) + +$(TMPDIR)/$(LIB): + $(RUSTC) --emit link,dep-info --crate-type=lib $(TMPDIR)/lib.rs + touch $(TMPDIR)/done + +-include $(TMPDIR)/lib.d diff --git a/tests/run-make/dep-info-spaces/bar.rs b/tests/run-make/dep-info-spaces/bar.rs new file mode 100644 index 00000000000..c5c0bc606cd --- /dev/null +++ b/tests/run-make/dep-info-spaces/bar.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/dep-info-spaces/foo foo.rs b/tests/run-make/dep-info-spaces/foo foo.rs new file mode 100644 index 00000000000..b76b4321d62 --- /dev/null +++ b/tests/run-make/dep-info-spaces/foo foo.rs @@ -0,0 +1 @@ +pub fn foo() {} diff --git a/tests/run-make/dep-info-spaces/lib.rs b/tests/run-make/dep-info-spaces/lib.rs new file mode 100644 index 00000000000..6264e7b67ec --- /dev/null +++ b/tests/run-make/dep-info-spaces/lib.rs @@ -0,0 +1,4 @@ +#[path="foo foo.rs"] +pub mod foo; + +pub mod bar; diff --git a/tests/run-make/dep-info/Makefile b/tests/run-make/dep-info/Makefile new file mode 100644 index 00000000000..c76f43a8eed --- /dev/null +++ b/tests/run-make/dep-info/Makefile @@ -0,0 +1,25 @@ +include ../tools.mk + +# ignore-windows +# ignore-freebsd +# FIXME: on windows `rustc --dep-info` produces Makefile dependency with +# windows native paths (e.g. `c:\path\to\libfoo.a`) +# but msys make seems to fail to recognize such paths, so test fails. + +all: + cp *.rs $(TMPDIR) + $(RUSTC) --emit dep-info,link --crate-type=lib $(TMPDIR)/lib.rs + sleep 2 + touch $(TMPDIR)/foo.rs + -rm -f $(TMPDIR)/done + $(MAKE) -drf Makefile.foo + sleep 2 + rm $(TMPDIR)/done + pwd + $(MAKE) -drf Makefile.foo + rm $(TMPDIR)/done && exit 1 || exit 0 + + # When a source file is deleted `make` should still work + rm $(TMPDIR)/bar.rs + cp $(TMPDIR)/lib2.rs $(TMPDIR)/lib.rs + $(MAKE) -drf Makefile.foo diff --git a/tests/run-make/dep-info/Makefile.foo b/tests/run-make/dep-info/Makefile.foo new file mode 100644 index 00000000000..e5df31f88c1 --- /dev/null +++ b/tests/run-make/dep-info/Makefile.foo @@ -0,0 +1,7 @@ +LIB := $(shell $(RUSTC) --print file-names --crate-type=lib lib.rs) + +$(TMPDIR)/$(LIB): + $(RUSTC) --emit dep-info,link --crate-type=lib lib.rs + touch $(TMPDIR)/done + +-include $(TMPDIR)/foo.d diff --git a/tests/run-make/dep-info/bar.rs b/tests/run-make/dep-info/bar.rs new file mode 100644 index 00000000000..c5c0bc606cd --- /dev/null +++ b/tests/run-make/dep-info/bar.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/dep-info/foo.rs b/tests/run-make/dep-info/foo.rs new file mode 100644 index 00000000000..b76b4321d62 --- /dev/null +++ b/tests/run-make/dep-info/foo.rs @@ -0,0 +1 @@ +pub fn foo() {} diff --git a/tests/run-make/dep-info/lib.rs b/tests/run-make/dep-info/lib.rs new file mode 100644 index 00000000000..eb8631259d4 --- /dev/null +++ b/tests/run-make/dep-info/lib.rs @@ -0,0 +1,4 @@ +#![crate_name = "foo"] + +pub mod foo; +pub mod bar; diff --git a/tests/run-make/dep-info/lib2.rs b/tests/run-make/dep-info/lib2.rs new file mode 100644 index 00000000000..f4fda9c93c5 --- /dev/null +++ b/tests/run-make/dep-info/lib2.rs @@ -0,0 +1,3 @@ +#![crate_name = "foo"] + +pub mod foo; diff --git a/tests/run-make/doctests-keep-binaries/Makefile b/tests/run-make/doctests-keep-binaries/Makefile new file mode 100644 index 00000000000..273c8980b02 --- /dev/null +++ b/tests/run-make/doctests-keep-binaries/Makefile @@ -0,0 +1,21 @@ +include ../../run-make-fulldeps/tools.mk + +# Check that valid binaries are persisted by running them, regardless of whether the --run or --no-run option is used. + +all: run no_run + +run: + mkdir -p $(TMPDIR)/doctests + $(RUSTC) --crate-type rlib t.rs + $(RUSTDOC) -Zunstable-options --test --persist-doctests $(TMPDIR)/doctests --extern t=$(TMPDIR)/libt.rlib t.rs + $(TMPDIR)/doctests/t_rs_2_0/rust_out + $(TMPDIR)/doctests/t_rs_8_0/rust_out + rm -rf $(TMPDIR)/doctests + +no_run: + mkdir -p $(TMPDIR)/doctests + $(RUSTC) --crate-type rlib t.rs + $(RUSTDOC) -Zunstable-options --test --persist-doctests $(TMPDIR)/doctests --extern t=$(TMPDIR)/libt.rlib t.rs --no-run + $(TMPDIR)/doctests/t_rs_2_0/rust_out + $(TMPDIR)/doctests/t_rs_8_0/rust_out + rm -rf $(TMPDIR)/doctests diff --git a/tests/run-make/doctests-keep-binaries/t.rs b/tests/run-make/doctests-keep-binaries/t.rs new file mode 100644 index 00000000000..c38cf0a0b25 --- /dev/null +++ b/tests/run-make/doctests-keep-binaries/t.rs @@ -0,0 +1,11 @@ +/// Fungle the foople. +/// ``` +/// t::foople(); +/// ``` +pub fn foople() {} + +/// Flomble the florp +/// ``` +/// t::florp(); +/// ``` +pub fn florp() {} diff --git a/tests/run-make/duplicate-output-flavors/Makefile b/tests/run-make/duplicate-output-flavors/Makefile new file mode 100644 index 00000000000..e33279966c9 --- /dev/null +++ b/tests/run-make/duplicate-output-flavors/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=rlib,rlib foo.rs diff --git a/tests/run-make/duplicate-output-flavors/foo.rs b/tests/run-make/duplicate-output-flavors/foo.rs new file mode 100644 index 00000000000..c1bfaa6cab5 --- /dev/null +++ b/tests/run-make/duplicate-output-flavors/foo.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/dylib-chain/Makefile b/tests/run-make/dylib-chain/Makefile new file mode 100644 index 00000000000..1139822f4ea --- /dev/null +++ b/tests/run-make/dylib-chain/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +all: + $(RUSTC) m1.rs -C prefer-dynamic + $(RUSTC) m2.rs -C prefer-dynamic + $(RUSTC) m3.rs -C prefer-dynamic + $(RUSTC) m4.rs + $(call RUN,m4) + $(call REMOVE_DYLIBS,m1) + $(call REMOVE_DYLIBS,m2) + $(call REMOVE_DYLIBS,m3) + $(call FAIL,m4) diff --git a/tests/run-make/dylib-chain/m1.rs b/tests/run-make/dylib-chain/m1.rs new file mode 100644 index 00000000000..08c3f37522c --- /dev/null +++ b/tests/run-make/dylib-chain/m1.rs @@ -0,0 +1,2 @@ +#![crate_type = "dylib"] +pub fn m1() {} diff --git a/tests/run-make/dylib-chain/m2.rs b/tests/run-make/dylib-chain/m2.rs new file mode 100644 index 00000000000..62176ddc9f3 --- /dev/null +++ b/tests/run-make/dylib-chain/m2.rs @@ -0,0 +1,4 @@ +#![crate_type = "dylib"] +extern crate m1; + +pub fn m2() { m1::m1() } diff --git a/tests/run-make/dylib-chain/m3.rs b/tests/run-make/dylib-chain/m3.rs new file mode 100644 index 00000000000..d213aeda9ac --- /dev/null +++ b/tests/run-make/dylib-chain/m3.rs @@ -0,0 +1,4 @@ +#![crate_type = "dylib"] +extern crate m2; + +pub fn m3() { m2::m2() } diff --git a/tests/run-make/dylib-chain/m4.rs b/tests/run-make/dylib-chain/m4.rs new file mode 100644 index 00000000000..fa8ec6079de --- /dev/null +++ b/tests/run-make/dylib-chain/m4.rs @@ -0,0 +1,3 @@ +extern crate m3; + +fn main() { m3::m3() } diff --git a/tests/run-make/emit-stack-sizes/Makefile b/tests/run-make/emit-stack-sizes/Makefile new file mode 100644 index 00000000000..f636ebd28f2 --- /dev/null +++ b/tests/run-make/emit-stack-sizes/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +# ignore-windows +# ignore-macos +# +# This feature only works when the output object format is ELF so we ignore +# macOS and Windows + +# check that the .stack_sizes section is generated +all: + $(RUSTC) -C opt-level=3 -Z emit-stack-sizes --emit=obj foo.rs + size -A $(TMPDIR)/foo.o | $(CGREP) .stack_sizes diff --git a/tests/run-make/emit-stack-sizes/foo.rs b/tests/run-make/emit-stack-sizes/foo.rs new file mode 100644 index 00000000000..ee51ae32886 --- /dev/null +++ b/tests/run-make/emit-stack-sizes/foo.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] + +pub fn foo() {} diff --git a/tests/run-make/emit/Makefile b/tests/run-make/emit/Makefile new file mode 100644 index 00000000000..78e68bd6111 --- /dev/null +++ b/tests/run-make/emit/Makefile @@ -0,0 +1,21 @@ +include ../tools.mk + +all: + $(RUSTC) -Copt-level=0 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs + $(RUSTC) -Copt-level=1 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs + $(RUSTC) -Copt-level=2 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs + $(RUSTC) -Copt-level=3 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs + $(RUSTC) -Copt-level=s --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs + $(RUSTC) -Copt-level=z --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs + $(RUSTC) -Copt-level=0 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs + $(call RUN,test-26235) || exit 1 + $(RUSTC) -Copt-level=1 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs + $(call RUN,test-26235) || exit 1 + $(RUSTC) -Copt-level=2 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs + $(call RUN,test-26235) || exit 1 + $(RUSTC) -Copt-level=3 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs + $(call RUN,test-26235) || exit 1 + $(RUSTC) -Copt-level=s --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs + $(call RUN,test-26235) || exit 1 + $(RUSTC) -Copt-level=z --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs + $(call RUN,test-26235) || exit 1 diff --git a/tests/run-make/emit/test-24876.rs b/tests/run-make/emit/test-24876.rs new file mode 100644 index 00000000000..734e2ee4bd4 --- /dev/null +++ b/tests/run-make/emit/test-24876.rs @@ -0,0 +1,9 @@ +// Checks for issue #24876 + +fn main() { + let mut v = 0; + for i in 0..0 { + v += i; + } + println!("{}", v) +} diff --git a/tests/run-make/emit/test-26235.rs b/tests/run-make/emit/test-26235.rs new file mode 100644 index 00000000000..07d975f3317 --- /dev/null +++ b/tests/run-make/emit/test-26235.rs @@ -0,0 +1,46 @@ +// Checks for issue #26235 + +fn main() { + use std::thread; + + type Key = u32; + const NUM_THREADS: usize = 2; + + #[derive(Clone,Copy)] + struct Stats { + upsert: S, + delete: S, + insert: S, + update: S + }; + + impl Stats where S: Copy { + fn dot(self, s: Stats, f: F) -> Stats where F: Fn(S, T) -> B { + let Stats { upsert: u1, delete: d1, insert: i1, update: p1 } = self; + let Stats { upsert: u2, delete: d2, insert: i2, update: p2 } = s; + Stats { upsert: f(u1, u2), delete: f(d1, d2), insert: f(i1, i2), update: f(p1, p2) } + } + + fn new(init: S) -> Self { + Stats { upsert: init, delete: init, insert: init, update: init } + } + } + + fn make_threads() -> Vec> { + let mut t = Vec::with_capacity(NUM_THREADS); + for _ in 0..NUM_THREADS { + t.push(thread::spawn(move || {})); + } + t + } + + let stats = [Stats::new(0); NUM_THREADS]; + make_threads(); + + { + let Stats { ref upsert, ref delete, ref insert, ref update } = stats.iter().fold( + Stats::new(0), |res, &s| res.dot(s, |x: Key, y: Key| x.wrapping_add(y))); + println!("upserts: {}, deletes: {}, inserts: {}, updates: {}", + upsert, delete, insert, update); + } +} diff --git a/tests/run-make/error-found-staticlib-instead-crate/Makefile b/tests/run-make/error-found-staticlib-instead-crate/Makefile new file mode 100644 index 00000000000..0eae41d720c --- /dev/null +++ b/tests/run-make/error-found-staticlib-instead-crate/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs --crate-type staticlib + $(RUSTC) bar.rs 2>&1 | $(CGREP) "found staticlib" diff --git a/tests/run-make/error-found-staticlib-instead-crate/bar.rs b/tests/run-make/error-found-staticlib-instead-crate/bar.rs new file mode 100644 index 00000000000..fe35f1f8e2e --- /dev/null +++ b/tests/run-make/error-found-staticlib-instead-crate/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::foo(); +} diff --git a/tests/run-make/error-found-staticlib-instead-crate/foo.rs b/tests/run-make/error-found-staticlib-instead-crate/foo.rs new file mode 100644 index 00000000000..b76b4321d62 --- /dev/null +++ b/tests/run-make/error-found-staticlib-instead-crate/foo.rs @@ -0,0 +1 @@ +pub fn foo() {} diff --git a/tests/run-make/error-writing-dependencies/Makefile b/tests/run-make/error-writing-dependencies/Makefile new file mode 100644 index 00000000000..a5d30a647f8 --- /dev/null +++ b/tests/run-make/error-writing-dependencies/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +all: + # Let's get a nice error message + $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | \ + $(CGREP) "error writing dependencies" + # Make sure the filename shows up + $(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | $(CGREP) "baz" diff --git a/tests/run-make/error-writing-dependencies/foo.rs b/tests/run-make/error-writing-dependencies/foo.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/error-writing-dependencies/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/exit-code/Makefile b/tests/run-make/exit-code/Makefile new file mode 100644 index 00000000000..3ffaafe9065 --- /dev/null +++ b/tests/run-make/exit-code/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +all: + $(RUSTC) success.rs; [ $$? -eq 0 ] + $(RUSTC) --invalid-arg-foo; [ $$? -eq 1 ] + $(RUSTC) compile-error.rs; [ $$? -eq 1 ] + $(RUSTC) -Ztreat-err-as-bug compile-error.rs; [ $$? -eq 101 ] + $(RUSTDOC) -o $(TMPDIR)/exit-code success.rs; [ $$? -eq 0 ] + $(RUSTDOC) --invalid-arg-foo; [ $$? -eq 1 ] + $(RUSTDOC) compile-error.rs; [ $$? -eq 1 ] + $(RUSTDOC) lint-failure.rs; [ $$? -eq 1 ] diff --git a/tests/run-make/exit-code/compile-error.rs b/tests/run-make/exit-code/compile-error.rs new file mode 100644 index 00000000000..a96c197606c --- /dev/null +++ b/tests/run-make/exit-code/compile-error.rs @@ -0,0 +1,3 @@ +fn main() { + compile_error!("kaboom"); +} diff --git a/tests/run-make/exit-code/lint-failure.rs b/tests/run-make/exit-code/lint-failure.rs new file mode 100644 index 00000000000..df876ec237f --- /dev/null +++ b/tests/run-make/exit-code/lint-failure.rs @@ -0,0 +1,6 @@ +#![deny(broken_intra_doc_links)] + +/// [intradoc::failure] +pub fn main() { + println!("Hello, world!"); +} diff --git a/tests/run-make/exit-code/success.rs b/tests/run-make/exit-code/success.rs new file mode 100644 index 00000000000..55b8e42b6e2 --- /dev/null +++ b/tests/run-make/exit-code/success.rs @@ -0,0 +1,4 @@ +/// Main function +fn main() { + println!("Hello, world!"); +} diff --git a/tests/run-make/extern-diff-internal-name/Makefile b/tests/run-make/extern-diff-internal-name/Makefile new file mode 100644 index 00000000000..54596c2f029 --- /dev/null +++ b/tests/run-make/extern-diff-internal-name/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) lib.rs + $(RUSTC) test.rs --extern foo=$(TMPDIR)/libbar.rlib diff --git a/tests/run-make/extern-diff-internal-name/lib.rs b/tests/run-make/extern-diff-internal-name/lib.rs new file mode 100644 index 00000000000..ad96f70866e --- /dev/null +++ b/tests/run-make/extern-diff-internal-name/lib.rs @@ -0,0 +1,2 @@ +#![crate_name = "bar"] +#![crate_type = "rlib"] diff --git a/tests/run-make/extern-diff-internal-name/test.rs b/tests/run-make/extern-diff-internal-name/test.rs new file mode 100644 index 00000000000..4c53dc28a80 --- /dev/null +++ b/tests/run-make/extern-diff-internal-name/test.rs @@ -0,0 +1,5 @@ +#[macro_use] +extern crate foo; + +fn main() { +} diff --git a/tests/run-make/extern-flag-disambiguates/Makefile b/tests/run-make/extern-flag-disambiguates/Makefile new file mode 100644 index 00000000000..a8f142a6402 --- /dev/null +++ b/tests/run-make/extern-flag-disambiguates/Makefile @@ -0,0 +1,25 @@ +include ../tools.mk + +# Attempt to build this dependency tree: +# +# A.1 A.2 +# |\ | +# | \ | +# B \ C +# \ | / +# \|/ +# D +# +# Note that A.1 and A.2 are crates with the same name. + +all: + $(RUSTC) -C metadata=1 -C extra-filename=-1 a.rs + $(RUSTC) -C metadata=2 -C extra-filename=-2 a.rs + $(RUSTC) b.rs --extern a=$(TMPDIR)/liba-1.rlib + $(RUSTC) c.rs --extern a=$(TMPDIR)/liba-2.rlib + @echo before + $(RUSTC) --cfg before d.rs --extern a=$(TMPDIR)/liba-1.rlib + $(call RUN,d) + @echo after + $(RUSTC) --cfg after d.rs --extern a=$(TMPDIR)/liba-1.rlib + $(call RUN,d) diff --git a/tests/run-make/extern-flag-disambiguates/a.rs b/tests/run-make/extern-flag-disambiguates/a.rs new file mode 100644 index 00000000000..2b1a3190150 --- /dev/null +++ b/tests/run-make/extern-flag-disambiguates/a.rs @@ -0,0 +1,6 @@ +#![crate_name = "a"] +#![crate_type = "rlib"] + +static FOO: usize = 3; + +pub fn token() -> &'static usize { &FOO } diff --git a/tests/run-make/extern-flag-disambiguates/b.rs b/tests/run-make/extern-flag-disambiguates/b.rs new file mode 100644 index 00000000000..1d7a7339ce2 --- /dev/null +++ b/tests/run-make/extern-flag-disambiguates/b.rs @@ -0,0 +1,9 @@ +#![crate_name = "b"] +#![crate_type = "rlib"] + +extern crate a; + +static FOO: usize = 3; + +pub fn token() -> &'static usize { &FOO } +pub fn a_token() -> &'static usize { a::token() } diff --git a/tests/run-make/extern-flag-disambiguates/c.rs b/tests/run-make/extern-flag-disambiguates/c.rs new file mode 100644 index 00000000000..3f9d143ed2d --- /dev/null +++ b/tests/run-make/extern-flag-disambiguates/c.rs @@ -0,0 +1,9 @@ +#![crate_name = "c"] +#![crate_type = "rlib"] + +extern crate a; + +static FOO: usize = 3; + +pub fn token() -> &'static usize { &FOO } +pub fn a_token() -> &'static usize { a::token() } diff --git a/tests/run-make/extern-flag-disambiguates/d.rs b/tests/run-make/extern-flag-disambiguates/d.rs new file mode 100644 index 00000000000..249c6a107ff --- /dev/null +++ b/tests/run-make/extern-flag-disambiguates/d.rs @@ -0,0 +1,11 @@ +#[cfg(before)] extern crate a; +extern crate b; +extern crate c; +#[cfg(after)] extern crate a; + +fn t(a: &'static usize) -> usize { a as *const _ as usize } + +fn main() { + assert_eq!(t(a::token()), t(b::a_token())); + assert!(t(a::token()) != t(c::a_token())); +} diff --git a/tests/run-make/extern-flag-fun/Makefile b/tests/run-make/extern-flag-fun/Makefile new file mode 100644 index 00000000000..a0b7c15edb9 --- /dev/null +++ b/tests/run-make/extern-flag-fun/Makefile @@ -0,0 +1,19 @@ +include ../tools.mk + +all: + $(RUSTC) bar.rs --crate-type=rlib + $(RUSTC) bar.rs --crate-type=rlib -C extra-filename=-a + $(RUSTC) bar-alt.rs --crate-type=rlib + $(RUSTC) foo.rs --extern bar=no-exist && exit 1 || exit 0 + $(RUSTC) foo.rs --extern bar=foo.rs && exit 1 || exit 0 + $(RUSTC) foo.rs \ + --extern bar=$(TMPDIR)/libbar.rlib \ + --extern bar=$(TMPDIR)/libbar-alt.rlib \ + && exit 1 || exit 0 + $(RUSTC) foo.rs \ + --extern bar=$(TMPDIR)/libbar.rlib \ + --extern bar=$(TMPDIR)/libbar-a.rlib + $(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib + # Try to be sneaky and load a private crate from with a non-private name. + $(RUSTC) rustc.rs -Zforce-unstable-if-unmarked --crate-type=rlib + $(RUSTC) gated_unstable.rs --extern alloc=$(TMPDIR)/librustc.rlib 2>&1 | $(CGREP) 'rustc_private' diff --git a/tests/run-make/extern-flag-fun/bar-alt.rs b/tests/run-make/extern-flag-fun/bar-alt.rs new file mode 100644 index 00000000000..cdc6c27d800 --- /dev/null +++ b/tests/run-make/extern-flag-fun/bar-alt.rs @@ -0,0 +1 @@ +pub fn f() {} diff --git a/tests/run-make/extern-flag-fun/bar.rs b/tests/run-make/extern-flag-fun/bar.rs new file mode 100644 index 00000000000..d11c69f812a --- /dev/null +++ b/tests/run-make/extern-flag-fun/bar.rs @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/run-make/extern-flag-fun/foo.rs b/tests/run-make/extern-flag-fun/foo.rs new file mode 100644 index 00000000000..0edda7d7b88 --- /dev/null +++ b/tests/run-make/extern-flag-fun/foo.rs @@ -0,0 +1,3 @@ +extern crate bar; + +fn main() {} diff --git a/tests/run-make/extern-flag-fun/gated_unstable.rs b/tests/run-make/extern-flag-fun/gated_unstable.rs new file mode 100644 index 00000000000..03600c830ff --- /dev/null +++ b/tests/run-make/extern-flag-fun/gated_unstable.rs @@ -0,0 +1,3 @@ +extern crate alloc; + +fn main() {} diff --git a/tests/run-make/extern-flag-fun/rustc.rs b/tests/run-make/extern-flag-fun/rustc.rs new file mode 100644 index 00000000000..b76b4321d62 --- /dev/null +++ b/tests/run-make/extern-flag-fun/rustc.rs @@ -0,0 +1 @@ +pub fn foo() {} diff --git a/tests/run-make/extern-flag-pathless/Makefile b/tests/run-make/extern-flag-pathless/Makefile new file mode 100644 index 00000000000..0f23815b650 --- /dev/null +++ b/tests/run-make/extern-flag-pathless/Makefile @@ -0,0 +1,18 @@ +include ../tools.mk + +# Test mixing pathless --extern with paths. + +all: + $(RUSTC) bar-static.rs --crate-name=bar --crate-type=rlib + $(RUSTC) bar-dynamic.rs --crate-name=bar --crate-type=dylib -C prefer-dynamic + # rlib preferred over dylib + $(RUSTC) foo.rs --extern bar + $(call RUN,foo) | $(CGREP) 'static' + $(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib --extern bar + $(call RUN,foo) | $(CGREP) 'static' + # explicit --extern overrides pathless + $(RUSTC) foo.rs --extern bar=$(call DYLIB,bar) --extern bar + $(call RUN,foo) | $(CGREP) 'dynamic' + # prefer-dynamic does what it says + $(RUSTC) foo.rs --extern bar -C prefer-dynamic + $(call RUN,foo) | $(CGREP) 'dynamic' diff --git a/tests/run-make/extern-flag-pathless/bar-dynamic.rs b/tests/run-make/extern-flag-pathless/bar-dynamic.rs new file mode 100644 index 00000000000..e2d68d517ff --- /dev/null +++ b/tests/run-make/extern-flag-pathless/bar-dynamic.rs @@ -0,0 +1,3 @@ +pub fn f() { + println!("dynamic"); +} diff --git a/tests/run-make/extern-flag-pathless/bar-static.rs b/tests/run-make/extern-flag-pathless/bar-static.rs new file mode 100644 index 00000000000..240d8bde4d1 --- /dev/null +++ b/tests/run-make/extern-flag-pathless/bar-static.rs @@ -0,0 +1,3 @@ +pub fn f() { + println!("static"); +} diff --git a/tests/run-make/extern-flag-pathless/foo.rs b/tests/run-make/extern-flag-pathless/foo.rs new file mode 100644 index 00000000000..1ea64da7dad --- /dev/null +++ b/tests/run-make/extern-flag-pathless/foo.rs @@ -0,0 +1,3 @@ +fn main() { + bar::f(); +} diff --git a/tests/run-make/extern-flag-rename-transitive/Makefile b/tests/run-make/extern-flag-rename-transitive/Makefile new file mode 100644 index 00000000000..d16a8e20868 --- /dev/null +++ b/tests/run-make/extern-flag-rename-transitive/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs + $(RUSTC) bar.rs + $(RUSTC) baz.rs --extern a=$(TMPDIR)/libfoo.rlib + diff --git a/tests/run-make/extern-flag-rename-transitive/bar.rs b/tests/run-make/extern-flag-rename-transitive/bar.rs new file mode 100644 index 00000000000..94446a07d6c --- /dev/null +++ b/tests/run-make/extern-flag-rename-transitive/bar.rs @@ -0,0 +1,3 @@ +#![crate_type = "rlib"] + +extern crate foo; diff --git a/tests/run-make/extern-flag-rename-transitive/baz.rs b/tests/run-make/extern-flag-rename-transitive/baz.rs new file mode 100644 index 00000000000..c3908db3429 --- /dev/null +++ b/tests/run-make/extern-flag-rename-transitive/baz.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] + +extern crate a; +extern crate bar; diff --git a/tests/run-make/extern-flag-rename-transitive/foo.rs b/tests/run-make/extern-flag-rename-transitive/foo.rs new file mode 100644 index 00000000000..c1bfaa6cab5 --- /dev/null +++ b/tests/run-make/extern-flag-rename-transitive/foo.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/extern-fn-generic/Makefile b/tests/run-make/extern-fn-generic/Makefile new file mode 100644 index 00000000000..71746fb10cb --- /dev/null +++ b/tests/run-make/extern-fn-generic/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) testcrate.rs + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-generic/test.c b/tests/run-make/extern-fn-generic/test.c new file mode 100644 index 00000000000..a8504ff2afb --- /dev/null +++ b/tests/run-make/extern-fn-generic/test.c @@ -0,0 +1,16 @@ +#include + +typedef struct TestStruct { + uint8_t x; + int32_t y; +} TestStruct; + +typedef int callback(TestStruct s); + +uint32_t call(callback *c) { + TestStruct s; + s.x = 'a'; + s.y = 3; + + return c(s); +} diff --git a/tests/run-make/extern-fn-generic/test.rs b/tests/run-make/extern-fn-generic/test.rs new file mode 100644 index 00000000000..c9baa489881 --- /dev/null +++ b/tests/run-make/extern-fn-generic/test.rs @@ -0,0 +1,20 @@ +extern crate testcrate; + +extern "C" fn bar(ts: testcrate::TestStruct) -> T { + ts.y +} + +#[link(name = "test", kind = "static")] +extern "C" { + fn call(c: extern "C" fn(testcrate::TestStruct) -> i32) -> i32; +} + +fn main() { + // Let's test calling it cross crate + let back = unsafe { testcrate::call(testcrate::foo::) }; + assert_eq!(3, back); + + // And just within this crate + let back = unsafe { call(bar::) }; + assert_eq!(3, back); +} diff --git a/tests/run-make/extern-fn-generic/testcrate.rs b/tests/run-make/extern-fn-generic/testcrate.rs new file mode 100644 index 00000000000..39f76e59ca0 --- /dev/null +++ b/tests/run-make/extern-fn-generic/testcrate.rs @@ -0,0 +1,16 @@ +#![crate_type = "lib"] + +#[repr(C)] +pub struct TestStruct { + pub x: u8, + pub y: T, +} + +pub extern "C" fn foo(ts: TestStruct) -> T { + ts.y +} + +#[link(name = "test", kind = "static")] +extern "C" { + pub fn call(c: extern "C" fn(TestStruct) -> i32) -> i32; +} diff --git a/tests/run-make/extern-fn-mangle/Makefile b/tests/run-make/extern-fn-mangle/Makefile new file mode 100644 index 00000000000..4f5d026f213 --- /dev/null +++ b/tests/run-make/extern-fn-mangle/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-mangle/test.c b/tests/run-make/extern-fn-mangle/test.c new file mode 100644 index 00000000000..e94d75083b8 --- /dev/null +++ b/tests/run-make/extern-fn-mangle/test.c @@ -0,0 +1,8 @@ +#include + +uint32_t foo(); +uint32_t bar(); + +uint32_t add() { + return foo() + bar(); +} diff --git a/tests/run-make/extern-fn-mangle/test.rs b/tests/run-make/extern-fn-mangle/test.rs new file mode 100644 index 00000000000..40b08f1ed70 --- /dev/null +++ b/tests/run-make/extern-fn-mangle/test.rs @@ -0,0 +1,19 @@ +#[no_mangle] +pub extern "C" fn foo() -> i32 { + 3 +} + +#[no_mangle] +pub extern "C" fn bar() -> i32 { + 5 +} + +#[link(name = "test", kind = "static")] +extern "C" { + fn add() -> i32; +} + +fn main() { + let back = unsafe { add() }; + assert_eq!(8, back); +} diff --git a/tests/run-make/extern-fn-reachable/Makefile b/tests/run-make/extern-fn-reachable/Makefile new file mode 100644 index 00000000000..05bdb8d65b7 --- /dev/null +++ b/tests/run-make/extern-fn-reachable/Makefile @@ -0,0 +1,25 @@ +include ../tools.mk + +# ignore-windows-msvc + +NM=nm -D + +ifeq ($(UNAME),Darwin) +NM=nm -gU +endif + +ifdef IS_WINDOWS +NM=nm -g +endif + +# This overrides the LD_LIBRARY_PATH for RUN +TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR) + +all: + $(RUSTC) dylib.rs -o $(TMPDIR)/libdylib.so -C prefer-dynamic + + [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun1)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun2)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun3)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun4)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/libdylib.so | grep -v __imp_ | grep -c fun5)" -eq "1" ] diff --git a/tests/run-make/extern-fn-reachable/dylib.rs b/tests/run-make/extern-fn-reachable/dylib.rs new file mode 100644 index 00000000000..cd017934870 --- /dev/null +++ b/tests/run-make/extern-fn-reachable/dylib.rs @@ -0,0 +1,14 @@ +#![crate_type = "dylib"] +#![allow(dead_code)] + +#[no_mangle] pub extern "C" fn fun1() {} +#[no_mangle] extern "C" fn fun2() {} + +mod foo { + #[no_mangle] pub extern "C" fn fun3() {} +} +pub mod bar { + #[no_mangle] pub extern "C" fn fun4() {} +} + +#[no_mangle] pub fn fun5() {} diff --git a/tests/run-make/extern-fn-struct-passing-abi/Makefile b/tests/run-make/extern-fn-struct-passing-abi/Makefile new file mode 100644 index 00000000000..4f5d026f213 --- /dev/null +++ b/tests/run-make/extern-fn-struct-passing-abi/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-struct-passing-abi/test.c b/tests/run-make/extern-fn-struct-passing-abi/test.c new file mode 100644 index 00000000000..136b07129e1 --- /dev/null +++ b/tests/run-make/extern-fn-struct-passing-abi/test.c @@ -0,0 +1,314 @@ +#include +#include + +struct Rect { + int32_t a; + int32_t b; + int32_t c; + int32_t d; +}; + +struct BiggerRect { + struct Rect s; + int32_t a; + int32_t b; +}; + +struct FloatRect { + int32_t a; + int32_t b; + double c; +}; + +struct Huge { + int32_t a; + int32_t b; + int32_t c; + int32_t d; + int32_t e; +}; + +struct FloatPoint { + double x; + double y; +}; + +struct FloatOne { + double x; +}; + +struct IntOdd { + int8_t a; + int8_t b; + int8_t c; +}; + +// System V x86_64 ABI: +// a, b, c, d, e should be in registers +// s should be byval pointer +// +// Win64 ABI: +// a, b, c, d should be in registers +// e should be on the stack +// s should be byval pointer +void byval_rect(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(c == 3); + assert(d == 4); + assert(e == 5); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); +} + +// System V x86_64 ABI: +// a, b, c, d, e, f should be in registers +// s should be byval pointer on the stack +// +// Win64 ABI: +// a, b, c, d should be in registers +// e, f should be on the stack +// s should be byval pointer on the stack +void byval_many_rect(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, + int32_t f, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(c == 3); + assert(d == 4); + assert(e == 5); + assert(f == 6); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); +} + +// System V x86_64 ABI: +// a, b, c, d, e, f, g should be in sse registers +// s should be split across 2 registers +// t should be byval pointer +// +// Win64 ABI: +// a, b, c, d should be in sse registers +// e, f, g should be on the stack +// s should be on the stack (treated as 2 i64's) +// t should be on the stack (treated as an i64 and a double) +void byval_rect_floats(float a, float b, double c, float d, float e, + float f, double g, struct Rect s, struct FloatRect t) { + assert(a == 1.); + assert(b == 2.); + assert(c == 3.); + assert(d == 4.); + assert(e == 5.); + assert(f == 6.); + assert(g == 7.); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); + assert(t.a == 3489); + assert(t.b == 3490); + assert(t.c == 8.); +} + +// System V x86_64 ABI: +// a, b, d, e, f should be in registers +// c passed via sse registers +// s should be byval pointer +// +// Win64 ABI: +// a, b, d should be in registers +// c passed via sse registers +// e, f should be on the stack +// s should be byval pointer +void byval_rect_with_float(int32_t a, int32_t b, float c, int32_t d, + int32_t e, int32_t f, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(c == 3.); + assert(d == 4); + assert(e == 5); + assert(f == 6); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); +} + +// System V x86_64 ABI: +// a, b, d, e, f should be byval pointer (on the stack) +// g passed via register (fixes #41375) +// +// Win64 ABI: +// a, b, d, e, f, g should be byval pointer +void byval_rect_with_many_huge(struct Huge a, struct Huge b, struct Huge c, + struct Huge d, struct Huge e, struct Huge f, + struct Rect g) { + assert(g.a == 123); + assert(g.b == 456); + assert(g.c == 789); + assert(g.d == 420); +} + +// System V x86_64 & Win64 ABI: +// a, b should be in registers +// s should be split across 2 integer registers +void split_rect(int32_t a, int32_t b, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); +} + +// System V x86_64 & Win64 ABI: +// a, b should be in sse registers +// s should be split across integer & sse registers +void split_rect_floats(float a, float b, struct FloatRect s) { + assert(a == 1.); + assert(b == 2.); + assert(s.a == 3489); + assert(s.b == 3490); + assert(s.c == 8.); +} + +// System V x86_64 ABI: +// a, b, d, f should be in registers +// c, e passed via sse registers +// s should be split across 2 registers +// +// Win64 ABI: +// a, b, d should be in registers +// c passed via sse registers +// e, f should be on the stack +// s should be on the stack (treated as 2 i64's) +void split_rect_with_floats(int32_t a, int32_t b, float c, + int32_t d, float e, int32_t f, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(c == 3.); + assert(d == 4); + assert(e == 5.); + assert(f == 6); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); +} + +// System V x86_64 & Win64 ABI: +// a, b, c should be in registers +// s should be split across 2 registers +// t should be a byval pointer +void split_and_byval_rect(int32_t a, int32_t b, int32_t c, struct Rect s, struct Rect t) { + assert(a == 1); + assert(b == 2); + assert(c == 3); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); + assert(t.a == 553); + assert(t.b == 554); + assert(t.c == 555); + assert(t.d == 556); +} + +// System V x86_64 & Win64 ABI: +// a, b should in registers +// s and return should be split across 2 registers +struct Rect split_ret_byval_struct(int32_t a, int32_t b, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); + return s; +} + +// System V x86_64 & Win64 ABI: +// a, b, c, d should be in registers +// return should be in a hidden sret pointer +// s should be a byval pointer +struct BiggerRect sret_byval_struct(int32_t a, int32_t b, int32_t c, int32_t d, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(c == 3); + assert(d == 4); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); + + struct BiggerRect t; + t.s = s; t.a = 27834; t.b = 7657; + return t; +} + +// System V x86_64 & Win64 ABI: +// a, b should be in registers +// return should be in a hidden sret pointer +// s should be split across 2 registers +struct BiggerRect sret_split_struct(int32_t a, int32_t b, struct Rect s) { + assert(a == 1); + assert(b == 2); + assert(s.a == 553); + assert(s.b == 554); + assert(s.c == 555); + assert(s.d == 556); + + struct BiggerRect t; + t.s = s; t.a = 27834; t.b = 7657; + return t; +} + +// System V x86_64 & Win64 ABI: +// s should be byval pointer (since sizeof(s) > 16) +// return should in a hidden sret pointer +struct Huge huge_struct(struct Huge s) { + assert(s.a == 5647); + assert(s.b == 5648); + assert(s.c == 5649); + assert(s.d == 5650); + assert(s.e == 5651); + + return s; +} + +// System V x86_64 ABI: +// p should be in registers +// return should be in registers +// +// Win64 ABI and 64-bit PowerPC ELFv1 ABI: +// p should be a byval pointer +// return should be in a hidden sret pointer +struct FloatPoint float_point(struct FloatPoint p) { + assert(p.x == 5.); + assert(p.y == -3.); + + return p; +} + +// 64-bit PowerPC ELFv1 ABI: +// f1 should be in a register +// return should be in a hidden sret pointer +struct FloatOne float_one(struct FloatOne f1) { + assert(f1.x == 7.); + + return f1; +} + +// 64-bit PowerPC ELFv1 ABI: +// i should be in the least-significant bits of a register +// return should be in a hidden sret pointer +struct IntOdd int_odd(struct IntOdd i) { + assert(i.a == 1); + assert(i.b == 2); + assert(i.c == 3); + + return i; +} diff --git a/tests/run-make/extern-fn-struct-passing-abi/test.rs b/tests/run-make/extern-fn-struct-passing-abi/test.rs new file mode 100644 index 00000000000..afe0f52ef0b --- /dev/null +++ b/tests/run-make/extern-fn-struct-passing-abi/test.rs @@ -0,0 +1,138 @@ +// Passing structs via FFI should work regardless of whether +// they get passed in multiple registers, byval pointers or the stack + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct Rect { + a: i32, + b: i32, + c: i32, + d: i32, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct BiggerRect { + s: Rect, + a: i32, + b: i32, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct FloatRect { + a: i32, + b: i32, + c: f64, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct Huge { + a: i32, + b: i32, + c: i32, + d: i32, + e: i32, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct FloatPoint { + x: f64, + y: f64, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct FloatOne { + x: f64, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +#[repr(C)] +struct IntOdd { + a: i8, + b: i8, + c: i8, +} + +#[link(name = "test", kind = "static")] +extern "C" { + fn byval_rect(a: i32, b: i32, c: i32, d: i32, e: i32, s: Rect); + + fn byval_many_rect(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, s: Rect); + + fn byval_rect_floats( + a: f32, + b: f32, + c: f64, + d: f32, + e: f32, + f: f32, + g: f64, + s: Rect, + t: FloatRect, + ); + + fn byval_rect_with_float(a: i32, b: i32, c: f32, d: i32, e: i32, f: i32, s: Rect); + + fn byval_rect_with_many_huge(a: Huge, b: Huge, c: Huge, d: Huge, e: Huge, f: Huge, g: Rect); + + fn split_rect(a: i32, b: i32, s: Rect); + + fn split_rect_floats(a: f32, b: f32, s: FloatRect); + + fn split_rect_with_floats(a: i32, b: i32, c: f32, d: i32, e: f32, f: i32, s: Rect); + + fn split_and_byval_rect(a: i32, b: i32, c: i32, s: Rect, t: Rect); + + fn split_ret_byval_struct(a: i32, b: i32, s: Rect) -> Rect; + + fn sret_byval_struct(a: i32, b: i32, c: i32, d: i32, s: Rect) -> BiggerRect; + + fn sret_split_struct(a: i32, b: i32, s: Rect) -> BiggerRect; + + fn huge_struct(s: Huge) -> Huge; + + fn float_point(p: FloatPoint) -> FloatPoint; + + fn float_one(f: FloatOne) -> FloatOne; + + fn int_odd(i: IntOdd) -> IntOdd; +} + +fn main() { + let s = Rect { a: 553, b: 554, c: 555, d: 556 }; + let t = BiggerRect { s: s, a: 27834, b: 7657 }; + let u = FloatRect { a: 3489, b: 3490, c: 8. }; + let v = Huge { a: 5647, b: 5648, c: 5649, d: 5650, e: 5651 }; + let p = FloatPoint { x: 5., y: -3. }; + let f1 = FloatOne { x: 7. }; + let i = IntOdd { a: 1, b: 2, c: 3 }; + + unsafe { + byval_rect(1, 2, 3, 4, 5, s); + byval_many_rect(1, 2, 3, 4, 5, 6, s); + byval_rect_floats(1., 2., 3., 4., 5., 6., 7., s, u); + byval_rect_with_float(1, 2, 3.0, 4, 5, 6, s); + byval_rect_with_many_huge(v, v, v, v, v, v, Rect { a: 123, b: 456, c: 789, d: 420 }); + split_rect(1, 2, s); + split_rect_floats(1., 2., u); + split_rect_with_floats(1, 2, 3.0, 4, 5.0, 6, s); + split_and_byval_rect(1, 2, 3, s, s); + split_rect(1, 2, s); + assert_eq!(huge_struct(v), v); + assert_eq!(split_ret_byval_struct(1, 2, s), s); + assert_eq!(sret_byval_struct(1, 2, 3, 4, s), t); + assert_eq!(sret_split_struct(1, 2, s), t); + assert_eq!(float_point(p), p); + assert_eq!(int_odd(i), i); + + // MSVC/GCC/Clang are not consistent in the ABI of single-float aggregates. + // x86_64: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82028 + // i686: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82041 + #[cfg(not(all(windows, target_env = "gnu")))] + assert_eq!(float_one(f1), f1); + } +} diff --git a/tests/run-make/extern-fn-with-extern-types/Makefile b/tests/run-make/extern-fn-with-extern-types/Makefile new file mode 100644 index 00000000000..1fa708950d4 --- /dev/null +++ b/tests/run-make/extern-fn-with-extern-types/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,ctest) + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-with-extern-types/ctest.c b/tests/run-make/extern-fn-with-extern-types/ctest.c new file mode 100644 index 00000000000..3b6fb4cfce9 --- /dev/null +++ b/tests/run-make/extern-fn-with-extern-types/ctest.c @@ -0,0 +1,16 @@ +#include +#include + +typedef struct data { + uint32_t magic; +} data; + +data* data_create(uint32_t magic) { + static data d; + d.magic = magic; + return &d; +} + +uint32_t data_get(data* p) { + return p->magic; +} diff --git a/tests/run-make/extern-fn-with-extern-types/test.rs b/tests/run-make/extern-fn-with-extern-types/test.rs new file mode 100644 index 00000000000..90a6ebaf1aa --- /dev/null +++ b/tests/run-make/extern-fn-with-extern-types/test.rs @@ -0,0 +1,17 @@ +#![feature(extern_types)] + +#[link(name = "ctest", kind = "static")] +extern "C" { + type data; + + fn data_create(magic: u32) -> *mut data; + fn data_get(data: *mut data) -> u32; +} + +const MAGIC: u32 = 0xdeadbeef; +fn main() { + unsafe { + let data = data_create(MAGIC); + assert_eq!(data_get(data), MAGIC); + } +} diff --git a/tests/run-make/extern-fn-with-packed-struct/Makefile b/tests/run-make/extern-fn-with-packed-struct/Makefile new file mode 100644 index 00000000000..4f5d026f213 --- /dev/null +++ b/tests/run-make/extern-fn-with-packed-struct/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-with-packed-struct/test.c b/tests/run-make/extern-fn-with-packed-struct/test.c new file mode 100644 index 00000000000..c89f8272b1e --- /dev/null +++ b/tests/run-make/extern-fn-with-packed-struct/test.c @@ -0,0 +1,26 @@ +// Pragma needed cause of gcc bug on windows: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 + +#include + +#ifdef _MSC_VER +#pragma pack(push,1) +struct Foo { + char a; + short b; + char c; +}; +#else +#pragma pack(1) +struct __attribute__((packed)) Foo { + char a; + short b; + char c; +}; +#endif + +struct Foo foo(struct Foo foo) { + assert(foo.a == 1); + assert(foo.b == 2); + assert(foo.c == 3); + return foo; +} diff --git a/tests/run-make/extern-fn-with-packed-struct/test.rs b/tests/run-make/extern-fn-with-packed-struct/test.rs new file mode 100644 index 00000000000..2f261efb510 --- /dev/null +++ b/tests/run-make/extern-fn-with-packed-struct/test.rs @@ -0,0 +1,20 @@ +#[repr(C, packed)] +#[derive(Copy, Clone, Debug, PartialEq)] +struct Foo { + a: i8, + b: i16, + c: i8, +} + +#[link(name = "test", kind = "static")] +extern "C" { + fn foo(f: Foo) -> Foo; +} + +fn main() { + unsafe { + let a = Foo { a: 1, b: 2, c: 3 }; + let b = foo(a); + assert_eq!(a, b); + } +} diff --git a/tests/run-make/extern-fn-with-union/Makefile b/tests/run-make/extern-fn-with-union/Makefile new file mode 100644 index 00000000000..40bae923e30 --- /dev/null +++ b/tests/run-make/extern-fn-with-union/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,ctest) + $(RUSTC) testcrate.rs + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/extern-fn-with-union/ctest.c b/tests/run-make/extern-fn-with-union/ctest.c new file mode 100644 index 00000000000..86cb6453723 --- /dev/null +++ b/tests/run-make/extern-fn-with-union/ctest.c @@ -0,0 +1,10 @@ +#include +#include + +typedef union TestUnion { + uint64_t bits; +} TestUnion; + +uint64_t give_back(TestUnion tu) { + return tu.bits; +} diff --git a/tests/run-make/extern-fn-with-union/test.rs b/tests/run-make/extern-fn-with-union/test.rs new file mode 100644 index 00000000000..438fbddf31f --- /dev/null +++ b/tests/run-make/extern-fn-with-union/test.rs @@ -0,0 +1,19 @@ +extern crate testcrate; + +use std::mem; + +extern "C" { + fn give_back(tu: testcrate::TestUnion) -> u64; +} + +fn main() { + let magic: u64 = 0xDEADBEEF; + + // Let's test calling it cross crate + let back = unsafe { testcrate::give_back(mem::transmute(magic)) }; + assert_eq!(magic, back); + + // And just within this crate + let back = unsafe { give_back(mem::transmute(magic)) }; + assert_eq!(magic, back); +} diff --git a/tests/run-make/extern-fn-with-union/testcrate.rs b/tests/run-make/extern-fn-with-union/testcrate.rs new file mode 100644 index 00000000000..28d91ff37c3 --- /dev/null +++ b/tests/run-make/extern-fn-with-union/testcrate.rs @@ -0,0 +1,11 @@ +#![crate_type = "lib"] + +#[repr(C)] +pub struct TestUnion { + _val: u64, +} + +#[link(name = "ctest", kind = "static")] +extern "C" { + pub fn give_back(tu: TestUnion) -> u64; +} diff --git a/tests/run-make/extern-multiple-copies/Makefile b/tests/run-make/extern-multiple-copies/Makefile new file mode 100644 index 00000000000..00668a6bc88 --- /dev/null +++ b/tests/run-make/extern-multiple-copies/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +all: + $(RUSTC) foo1.rs + $(RUSTC) foo2.rs + mkdir $(TMPDIR)/foo + cp $(TMPDIR)/libfoo1.rlib $(TMPDIR)/foo/libfoo1.rlib + $(RUSTC) bar.rs --extern foo1=$(TMPDIR)/libfoo1.rlib -L $(TMPDIR)/foo diff --git a/tests/run-make/extern-multiple-copies/bar.rs b/tests/run-make/extern-multiple-copies/bar.rs new file mode 100644 index 00000000000..c6b3595f677 --- /dev/null +++ b/tests/run-make/extern-multiple-copies/bar.rs @@ -0,0 +1,6 @@ +extern crate foo2; // foo2 first to exhibit the bug +extern crate foo1; + +fn main() { + /* ... */ +} diff --git a/tests/run-make/extern-multiple-copies/foo1.rs b/tests/run-make/extern-multiple-copies/foo1.rs new file mode 100644 index 00000000000..c1bfaa6cab5 --- /dev/null +++ b/tests/run-make/extern-multiple-copies/foo1.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/extern-multiple-copies/foo2.rs b/tests/run-make/extern-multiple-copies/foo2.rs new file mode 100644 index 00000000000..c1bfaa6cab5 --- /dev/null +++ b/tests/run-make/extern-multiple-copies/foo2.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/extern-multiple-copies2/Makefile b/tests/run-make/extern-multiple-copies2/Makefile new file mode 100644 index 00000000000..84de2ebf34d --- /dev/null +++ b/tests/run-make/extern-multiple-copies2/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +all: + $(RUSTC) foo1.rs + $(RUSTC) foo2.rs + mkdir $(TMPDIR)/foo + cp $(TMPDIR)/libfoo1.rlib $(TMPDIR)/foo/libfoo1.rlib + $(RUSTC) bar.rs \ + --extern foo1=$(TMPDIR)/foo/libfoo1.rlib \ + --extern foo2=$(TMPDIR)/libfoo2.rlib diff --git a/tests/run-make/extern-multiple-copies2/bar.rs b/tests/run-make/extern-multiple-copies2/bar.rs new file mode 100644 index 00000000000..b3088152d6a --- /dev/null +++ b/tests/run-make/extern-multiple-copies2/bar.rs @@ -0,0 +1,8 @@ +#[macro_use] +extern crate foo2; // foo2 first to exhibit the bug +#[macro_use] +extern crate foo1; + +fn main() { + foo2::foo2(foo1::A); +} diff --git a/tests/run-make/extern-multiple-copies2/foo1.rs b/tests/run-make/extern-multiple-copies2/foo1.rs new file mode 100644 index 00000000000..4c778e52ff4 --- /dev/null +++ b/tests/run-make/extern-multiple-copies2/foo1.rs @@ -0,0 +1,7 @@ +#![crate_type = "rlib"] + +pub struct A; + +pub fn foo1(a: A) { + drop(a); +} diff --git a/tests/run-make/extern-multiple-copies2/foo2.rs b/tests/run-make/extern-multiple-copies2/foo2.rs new file mode 100644 index 00000000000..2be103507df --- /dev/null +++ b/tests/run-make/extern-multiple-copies2/foo2.rs @@ -0,0 +1,8 @@ +#![crate_type = "rlib"] + +#[macro_use] +extern crate foo1; + +pub fn foo2(a: foo1::A) { + foo1::foo1(a); +} diff --git a/tests/run-make/extern-overrides-distribution/Makefile b/tests/run-make/extern-overrides-distribution/Makefile new file mode 100644 index 00000000000..c57b062cd5d --- /dev/null +++ b/tests/run-make/extern-overrides-distribution/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) libc.rs -Cmetadata=foo + $(RUSTC) main.rs --extern libc=$(TMPDIR)/liblibc.rlib diff --git a/tests/run-make/extern-overrides-distribution/libc.rs b/tests/run-make/extern-overrides-distribution/libc.rs new file mode 100644 index 00000000000..ee51ae32886 --- /dev/null +++ b/tests/run-make/extern-overrides-distribution/libc.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] + +pub fn foo() {} diff --git a/tests/run-make/extern-overrides-distribution/main.rs b/tests/run-make/extern-overrides-distribution/main.rs new file mode 100644 index 00000000000..1290a8c5670 --- /dev/null +++ b/tests/run-make/extern-overrides-distribution/main.rs @@ -0,0 +1,5 @@ +extern crate libc; + +fn main() { + libc::foo(); +} diff --git a/tests/run-make/extra-filename-with-temp-outputs/Makefile b/tests/run-make/extra-filename-with-temp-outputs/Makefile new file mode 100644 index 00000000000..470448cf50c --- /dev/null +++ b/tests/run-make/extra-filename-with-temp-outputs/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + $(RUSTC) -C extra-filename=bar foo.rs -C save-temps + rm $(TMPDIR)/foobar.foo*0.rcgu.o + rm $(TMPDIR)/$(call BIN,foobar) diff --git a/tests/run-make/extra-filename-with-temp-outputs/foo.rs b/tests/run-make/extra-filename-with-temp-outputs/foo.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/extra-filename-with-temp-outputs/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/foreign-double-unwind/Makefile b/tests/run-make/foreign-double-unwind/Makefile new file mode 100644 index 00000000000..ea2fe9ff881 --- /dev/null +++ b/tests/run-make/foreign-double-unwind/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +all: foo + $(call RUN,foo) | $(CGREP) -v unreachable + +foo: foo.rs $(call NATIVE_STATICLIB,foo) + $(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS) + +$(TMPDIR)/libfoo.o: foo.cpp + $(call COMPILE_OBJ_CXX,$@,$<) diff --git a/tests/run-make/foreign-double-unwind/foo.cpp b/tests/run-make/foreign-double-unwind/foo.cpp new file mode 100644 index 00000000000..69a8f11c2db --- /dev/null +++ b/tests/run-make/foreign-double-unwind/foo.cpp @@ -0,0 +1,33 @@ +#include +#include + +void println(const char* s) { + puts(s); + fflush(stdout); +} + +struct outer_exception {}; +struct inner_exception {}; + +extern "C" { + void throw_cxx_exception() { + if (std::uncaught_exception()) { + println("throwing inner C++ exception"); + throw inner_exception(); + } else { + println("throwing outer C++ exception"); + throw outer_exception(); + } + } + + void cxx_catch_callback(void (*cb)()) { + try { + cb(); + println("unreachable: callback returns"); + } catch (outer_exception) { + println("unreachable: caught outer exception in catch (...)"); + } catch (inner_exception) { + println("unreachable: caught inner exception in catch (...)"); + } + } +} diff --git a/tests/run-make/foreign-double-unwind/foo.rs b/tests/run-make/foreign-double-unwind/foo.rs new file mode 100644 index 00000000000..cae8aa9402d --- /dev/null +++ b/tests/run-make/foreign-double-unwind/foo.rs @@ -0,0 +1,26 @@ +// Tests that C++ double unwinding through Rust code will be properly guarded +// against instead of exhibiting undefined behaviour. + +#![feature(c_unwind)] + +extern "C-unwind" { + fn throw_cxx_exception(); + fn cxx_catch_callback(cb: extern "C-unwind" fn()); +} + +struct ThrowOnDrop; + +impl Drop for ThrowOnDrop { + fn drop(&mut self) { + unsafe { throw_cxx_exception() }; + } +} + +extern "C-unwind" fn test_double_unwind() { + let _a = ThrowOnDrop; + let _b = ThrowOnDrop; +} + +fn main() { + unsafe { cxx_catch_callback(test_double_unwind) }; +} diff --git a/tests/run-make/foreign-exceptions/Makefile b/tests/run-make/foreign-exceptions/Makefile new file mode 100644 index 00000000000..38fe2773df2 --- /dev/null +++ b/tests/run-make/foreign-exceptions/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +all: foo + $(call RUN,foo) + +foo: foo.rs $(call NATIVE_STATICLIB,foo) + $(RUSTC) $< -lfoo $(EXTRARSCXXFLAGS) + +$(TMPDIR)/libfoo.o: foo.cpp + $(call COMPILE_OBJ_CXX,$@,$<) diff --git a/tests/run-make/foreign-exceptions/foo.cpp b/tests/run-make/foreign-exceptions/foo.cpp new file mode 100644 index 00000000000..8182021a2cc --- /dev/null +++ b/tests/run-make/foreign-exceptions/foo.cpp @@ -0,0 +1,60 @@ +#include +#include +#include + +void println(const char* s) { + puts(s); + fflush(stdout); +} + +struct exception {}; +struct rust_panic {}; + +struct drop_check { + bool* ok; + ~drop_check() { + println("~drop_check"); + + if (ok) + *ok = true; + } +}; + +extern "C" { + void rust_catch_callback(void (*cb)(), bool* rust_ok); + + void throw_cxx_exception() { + println("throwing C++ exception"); + throw exception(); + } + + void test_cxx_exception() { + bool rust_ok = false; + try { + rust_catch_callback(throw_cxx_exception, &rust_ok); + assert(false && "unreachable"); + } catch (exception e) { + println("caught C++ exception"); + assert(rust_ok); + return; + } + assert(false && "did not catch thrown C++ exception"); + } + + void cxx_catch_callback(void (*cb)(), bool* cxx_ok) { + drop_check x; + x.ok = NULL; + try { + cb(); + } catch (rust_panic e) { + assert(false && "shouldn't be able to catch a rust panic"); + } catch (...) { + println("caught foreign exception in catch (...)"); + // Foreign exceptions are caught by catch (...). We only set the ok + // flag if we successfully caught the panic. The destructor of + // drop_check will then set the flag to true if it is executed. + x.ok = cxx_ok; + throw; + } + } +} diff --git a/tests/run-make/foreign-exceptions/foo.rs b/tests/run-make/foreign-exceptions/foo.rs new file mode 100644 index 00000000000..dd3b7c76f28 --- /dev/null +++ b/tests/run-make/foreign-exceptions/foo.rs @@ -0,0 +1,59 @@ +// Tests that C++ exceptions can unwind through Rust code run destructors and +// are caught by catch_unwind. Also tests that Rust panics can unwind through +// C++ code. + +#![feature(c_unwind)] + +use std::panic::{catch_unwind, AssertUnwindSafe}; + +struct DropCheck<'a>(&'a mut bool); +impl<'a> Drop for DropCheck<'a> { + fn drop(&mut self) { + println!("DropCheck::drop"); + *self.0 = true; + } +} + +extern "C" { + fn test_cxx_exception(); +} + +extern "C-unwind" { + fn cxx_catch_callback(cb: extern "C-unwind" fn(), ok: *mut bool); +} + +#[no_mangle] +extern "C-unwind" fn rust_catch_callback(cb: extern "C-unwind" fn(), rust_ok: &mut bool) { + let _drop = DropCheck(rust_ok); + cb(); + unreachable!("should have unwound instead of returned"); +} + +fn test_rust_panic() { + extern "C-unwind" fn callback() { + println!("throwing rust panic"); + panic!(1234i32); + } + + let mut dropped = false; + let mut cxx_ok = false; + let caught_unwind = catch_unwind(AssertUnwindSafe(|| { + let _drop = DropCheck(&mut dropped); + unsafe { + cxx_catch_callback(callback, &mut cxx_ok); + } + unreachable!("should have unwound instead of returned"); + })); + println!("caught rust panic"); + assert!(dropped); + assert!(caught_unwind.is_err()); + let panic_obj = caught_unwind.unwrap_err(); + let panic_int = *panic_obj.downcast_ref::().unwrap(); + assert_eq!(panic_int, 1234); + assert!(cxx_ok); +} + +fn main() { + unsafe { test_cxx_exception() }; + test_rust_panic(); +} diff --git a/tests/run-make/foreign-rust-exceptions/Makefile b/tests/run-make/foreign-rust-exceptions/Makefile new file mode 100644 index 00000000000..50fca7f24e6 --- /dev/null +++ b/tests/run-make/foreign-rust-exceptions/Makefile @@ -0,0 +1,11 @@ +# ignore-i686-pc-windows-gnu + +# This test doesn't work on 32-bit MinGW as cdylib has its own copy of unwinder +# so cross-DLL unwinding does not work. + +include ../tools.mk + +all: + $(RUSTC) bar.rs --crate-type=cdylib + $(RUSTC) foo.rs + $(call RUN,foo) 2>&1 | $(CGREP) "Rust cannot catch foreign exceptions" diff --git a/tests/run-make/foreign-rust-exceptions/bar.rs b/tests/run-make/foreign-rust-exceptions/bar.rs new file mode 100644 index 00000000000..5f9efe32360 --- /dev/null +++ b/tests/run-make/foreign-rust-exceptions/bar.rs @@ -0,0 +1,7 @@ +#![crate_type = "cdylib"] +#![feature(c_unwind)] + +#[no_mangle] +extern "C-unwind" fn panic() { + panic!(); +} diff --git a/tests/run-make/foreign-rust-exceptions/foo.rs b/tests/run-make/foreign-rust-exceptions/foo.rs new file mode 100644 index 00000000000..266987c5b6d --- /dev/null +++ b/tests/run-make/foreign-rust-exceptions/foo.rs @@ -0,0 +1,13 @@ +#![feature(c_unwind)] + +#[cfg_attr(not(windows), link(name = "bar"))] +#[cfg_attr(windows, link(name = "bar.dll"))] +extern "C-unwind" { + fn panic(); +} + +fn main() { + let _ = std::panic::catch_unwind(|| { + unsafe { panic() }; + }); +} diff --git a/tests/run-make/fpic/Makefile b/tests/run-make/fpic/Makefile new file mode 100644 index 00000000000..5986de3666f --- /dev/null +++ b/tests/run-make/fpic/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +# ignore-windows +# ignore-macos + +# Test for #39529. +# `-z text` causes ld to error if there are any non-PIC sections + +all: + $(RUSTC) hello.rs -C link-args=-Wl,-z,text diff --git a/tests/run-make/fpic/hello.rs b/tests/run-make/fpic/hello.rs new file mode 100644 index 00000000000..45590d86ba6 --- /dev/null +++ b/tests/run-make/fpic/hello.rs @@ -0,0 +1 @@ +fn main() { } diff --git a/tests/run-make/glibc-staticlib-args/Makefile b/tests/run-make/glibc-staticlib-args/Makefile new file mode 100644 index 00000000000..39e64bacf58 --- /dev/null +++ b/tests/run-make/glibc-staticlib-args/Makefile @@ -0,0 +1,12 @@ +# only-gnu +# only-linux + +include ../tools.mk + +# This ensures that std::env::args works in a library called from C on glibc Linux. + +all: + $(RUSTC) --crate-type=staticlib library.rs + $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + $(call RUN,program) diff --git a/tests/run-make/glibc-staticlib-args/library.rs b/tests/run-make/glibc-staticlib-args/library.rs new file mode 100644 index 00000000000..5ab627a2ac1 --- /dev/null +++ b/tests/run-make/glibc-staticlib-args/library.rs @@ -0,0 +1,4 @@ +#[no_mangle] +pub extern "C" fn args_check() { + assert_ne!(std::env::args_os().count(), 0); +} diff --git a/tests/run-make/glibc-staticlib-args/program.c b/tests/run-make/glibc-staticlib-args/program.c new file mode 100644 index 00000000000..30f6974b750 --- /dev/null +++ b/tests/run-make/glibc-staticlib-args/program.c @@ -0,0 +1,6 @@ +void args_check(); + +int main() { + args_check(); + return 0; +} diff --git a/tests/run-make/hir-tree/Makefile b/tests/run-make/hir-tree/Makefile new file mode 100644 index 00000000000..b0450ea4bc5 --- /dev/null +++ b/tests/run-make/hir-tree/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +# Test that hir-tree output doesn't crash and includes +# the string constant we would expect to see. + +all: + $(RUSTC) -o $(TMPDIR)/input.hir -Z unpretty=hir-tree input.rs + $(CGREP) '"Hello, Rustaceans!\n"' < $(TMPDIR)/input.hir diff --git a/tests/run-make/hir-tree/input.rs b/tests/run-make/hir-tree/input.rs new file mode 100644 index 00000000000..9d1a4e9e47d --- /dev/null +++ b/tests/run-make/hir-tree/input.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, Rustaceans!"); +} diff --git a/tests/run-make/hotplug_codegen_backend/Makefile b/tests/run-make/hotplug_codegen_backend/Makefile new file mode 100644 index 00000000000..4cda243ffb5 --- /dev/null +++ b/tests/run-make/hotplug_codegen_backend/Makefile @@ -0,0 +1,26 @@ +include ../tools.mk + +# ignore-stage1 + +# This test both exists as a check that -Zcodegen-backend is capable of loading external codegen +# backends and that this external codegen backend is only included in the dep info if +# -Zbinary-dep-depinfo is used. + +all: + /bin/echo || exit 0 # This test requires /bin/echo to exist + $(RUSTC) the_backend.rs --crate-name the_backend --crate-type dylib \ + -o $(TMPDIR)/the_backend.dylib + + $(RUSTC) some_crate.rs --crate-name some_crate --crate-type lib -o $(TMPDIR)/some_crate \ + -Z codegen-backend=$(TMPDIR)/the_backend.dylib -Z unstable-options \ + --emit link,dep-info + grep -x "This has been \"compiled\" successfully." $(TMPDIR)/libsome_crate.rlib + # don't declare a dependency on the codegen backend if -Zbinary-dep-depinfo isn't used. + grep -v "the_backend.dylib" $(TMPDIR)/some_crate.d + + $(RUSTC) some_crate.rs --crate-name some_crate --crate-type lib -o $(TMPDIR)/some_crate \ + -Z codegen-backend=$(TMPDIR)/the_backend.dylib -Z unstable-options \ + --emit link,dep-info -Zbinary-dep-depinfo + grep -x "This has been \"compiled\" successfully." $(TMPDIR)/libsome_crate.rlib + # but declare a dependency on the codegen backend if -Zbinary-dep-depinfo it used. + grep "the_backend.dylib" $(TMPDIR)/some_crate.d diff --git a/tests/run-make/hotplug_codegen_backend/some_crate.rs b/tests/run-make/hotplug_codegen_backend/some_crate.rs new file mode 100644 index 00000000000..da27b7f3463 --- /dev/null +++ b/tests/run-make/hotplug_codegen_backend/some_crate.rs @@ -0,0 +1,2 @@ +#![feature(no_core)] +#![no_core] diff --git a/tests/run-make/hotplug_codegen_backend/the_backend.rs b/tests/run-make/hotplug_codegen_backend/the_backend.rs new file mode 100644 index 00000000000..8dac53c2a62 --- /dev/null +++ b/tests/run-make/hotplug_codegen_backend/the_backend.rs @@ -0,0 +1,84 @@ +#![feature(rustc_private)] +#![deny(warnings)] + +extern crate rustc_codegen_ssa; +extern crate rustc_data_structures; +extern crate rustc_driver; +extern crate rustc_errors; +extern crate rustc_hir; +extern crate rustc_metadata; +extern crate rustc_middle; +extern crate rustc_session; +extern crate rustc_span; +extern crate rustc_symbol_mangling; +extern crate rustc_target; + +use rustc_codegen_ssa::traits::CodegenBackend; +use rustc_codegen_ssa::{CodegenResults, CrateInfo}; +use rustc_data_structures::fx::FxHashMap; +use rustc_errors::ErrorGuaranteed; +use rustc_metadata::EncodedMetadata; +use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; +use rustc_middle::ty::TyCtxt; +use rustc_session::config::OutputFilenames; +use rustc_session::Session; +use std::any::Any; + +struct TheBackend; + +impl CodegenBackend for TheBackend { + fn locale_resource(&self) -> &'static str { "" } + + fn codegen_crate<'a, 'tcx>( + &self, + tcx: TyCtxt<'tcx>, + metadata: EncodedMetadata, + _need_metadata_module: bool, + ) -> Box { + Box::new(CodegenResults { + modules: vec![], + allocator_module: None, + metadata_module: None, + metadata, + crate_info: CrateInfo::new(tcx, "fake_target_cpu".to_string()), + }) + } + + fn join_codegen( + &self, + ongoing_codegen: Box, + _sess: &Session, + _outputs: &OutputFilenames, + ) -> Result<(CodegenResults, FxHashMap), ErrorGuaranteed> { + let codegen_results = ongoing_codegen + .downcast::() + .expect("in join_codegen: ongoing_codegen is not a CodegenResults"); + Ok((*codegen_results, FxHashMap::default())) + } + + fn link( + &self, + sess: &Session, + codegen_results: CodegenResults, + outputs: &OutputFilenames, + ) -> Result<(), ErrorGuaranteed> { + use rustc_session::{config::CrateType, output::out_filename}; + use std::io::Write; + let crate_name = codegen_results.crate_info.local_crate_name; + for &crate_type in sess.opts.crate_types.iter() { + if crate_type != CrateType::Rlib { + sess.fatal(&format!("Crate type is {:?}", crate_type)); + } + let output_name = out_filename(sess, crate_type, &outputs, crate_name); + let mut out_file = ::std::fs::File::create(output_name).unwrap(); + write!(out_file, "This has been \"compiled\" successfully.").unwrap(); + } + Ok(()) + } +} + +/// This is the entrypoint for a hot plugged rustc_codegen_llvm +#[no_mangle] +pub fn __rustc_codegen_backend() -> Box { + Box::new(TheBackend) +} diff --git a/tests/run-make/include_bytes_deps/Makefile b/tests/run-make/include_bytes_deps/Makefile new file mode 100644 index 00000000000..696dfd207bb --- /dev/null +++ b/tests/run-make/include_bytes_deps/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +# ignore-freebsd + +all: + $(RUSTC) --emit dep-info main.rs + $(CGREP) "input.txt" "input.bin" "input.md" < $(TMPDIR)/main.d diff --git a/tests/run-make/include_bytes_deps/input.bin b/tests/run-make/include_bytes_deps/input.bin new file mode 100644 index 00000000000..cd0875583aa --- /dev/null +++ b/tests/run-make/include_bytes_deps/input.bin @@ -0,0 +1 @@ +Hello world! diff --git a/tests/run-make/include_bytes_deps/input.md b/tests/run-make/include_bytes_deps/input.md new file mode 100644 index 00000000000..2a19b7405f7 --- /dev/null +++ b/tests/run-make/include_bytes_deps/input.md @@ -0,0 +1 @@ +# Hello, world! diff --git a/tests/run-make/include_bytes_deps/input.txt b/tests/run-make/include_bytes_deps/input.txt new file mode 100644 index 00000000000..cd0875583aa --- /dev/null +++ b/tests/run-make/include_bytes_deps/input.txt @@ -0,0 +1 @@ +Hello world! diff --git a/tests/run-make/include_bytes_deps/main.rs b/tests/run-make/include_bytes_deps/main.rs new file mode 100644 index 00000000000..2fd55699d44 --- /dev/null +++ b/tests/run-make/include_bytes_deps/main.rs @@ -0,0 +1,10 @@ +#[doc = include_str!("input.md")] +pub struct SomeStruct; + +pub fn main() { + const INPUT_TXT: &'static str = include_str!("input.txt"); + const INPUT_BIN: &'static [u8] = include_bytes!("input.bin"); + + println!("{}", INPUT_TXT); + println!("{:?}", INPUT_BIN); +} diff --git a/tests/run-make/incr-add-rust-src-component/Makefile b/tests/run-make/incr-add-rust-src-component/Makefile new file mode 100644 index 00000000000..5c1d953cc05 --- /dev/null +++ b/tests/run-make/incr-add-rust-src-component/Makefile @@ -0,0 +1,44 @@ +include ../tools.mk + +# rust-lang/rust#70924: Test that if we add rust-src component in between two +# incremental compiles, the compiler does not ICE on the second. + +# This test uses `ln -s` rather than copying to save testing time, but its +# usage doesn't work on windows. So ignore windows. + +# ignore-windows + +SYSROOT:=$(shell $(RUSTC) --print sysroot) +FAKEROOT=$(TMPDIR)/fakeroot +INCR=$(TMPDIR)/incr + +# Make a local copy of the sysroot; then remove the rust-src part of it, if +# present, for the *first* build. Then put in a facsimile of the rust-src +# component for the second build, in order to expose the ICE from issue #70924. +# +# Note that it is much easier to just do `cp -a $(SYSROOT)/* $(FAKEROOT)` as a +# first step, but I am concerned that would be too expensive in a unit test +# compared to making symbolic links. +# +# Anyway, the pattern you'll see here is: For every prefix in +# root/lib/rustlib/src, link all of prefix parent content, then remove the +# prefix, then loop on the next prefix. This way, we basically create a copy of +# the context around root/lib/rustlib/src, and can freely add/remove the src +# component itself. +all: + mkdir $(FAKEROOT) + ln -s $(SYSROOT)/* $(FAKEROOT) + rm -f $(FAKEROOT)/lib + mkdir $(FAKEROOT)/lib + ln -s $(SYSROOT)/lib/* $(FAKEROOT)/lib + rm -f $(FAKEROOT)/lib/rustlib + mkdir $(FAKEROOT)/lib/rustlib + ln -s $(SYSROOT)/lib/rustlib/* $(FAKEROOT)/lib/rustlib + rm -f $(FAKEROOT)/lib/rustlib/src + mkdir $(FAKEROOT)/lib/rustlib/src + ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src + rm -f $(FAKEROOT)/lib/rustlib/src/rust + $(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs + mkdir -p $(FAKEROOT)/lib/rustlib/src/rust/src/libstd + touch $(FAKEROOT)/lib/rustlib/src/rust/src/libstd/lib.rs + $(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs diff --git a/tests/run-make/incr-add-rust-src-component/main.rs b/tests/run-make/incr-add-rust-src-component/main.rs new file mode 100644 index 00000000000..f6320bcb04a --- /dev/null +++ b/tests/run-make/incr-add-rust-src-component/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello World"); +} diff --git a/tests/run-make/inline-always-many-cgu/Makefile b/tests/run-make/inline-always-many-cgu/Makefile new file mode 100644 index 00000000000..9945821db28 --- /dev/null +++ b/tests/run-make/inline-always-many-cgu/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs --emit llvm-ir -C codegen-units=2 + if cat $(TMPDIR)/*.ll | $(CGREP) -e '\bcall\b'; then \ + echo "found call instruction when one wasn't expected"; \ + exit 1; \ + fi diff --git a/tests/run-make/inline-always-many-cgu/foo.rs b/tests/run-make/inline-always-many-cgu/foo.rs new file mode 100644 index 00000000000..65fe69c16fe --- /dev/null +++ b/tests/run-make/inline-always-many-cgu/foo.rs @@ -0,0 +1,15 @@ +#![crate_type = "lib"] + +pub mod a { + #[inline(always)] + pub fn foo() { + } + + pub fn bar() { + } +} + +#[no_mangle] +pub fn bar() { + a::foo(); +} diff --git a/tests/run-make/interdependent-c-libraries/Makefile b/tests/run-make/interdependent-c-libraries/Makefile new file mode 100644 index 00000000000..dc5b55a9925 --- /dev/null +++ b/tests/run-make/interdependent-c-libraries/Makefile @@ -0,0 +1,14 @@ +include ../tools.mk + +# The rust crate foo will link to the native library foo, while the rust crate +# bar will link to the native library bar. There is also a dependency between +# the native library bar to the natibe library foo. +# +# This test ensures that the ordering of -lfoo and -lbar on the command line is +# correct to complete the linkage. If passed as "-lfoo -lbar", then the 'foo' +# library will be stripped out, and the linkage will fail. + +all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar) + $(RUSTC) foo.rs + $(RUSTC) bar.rs + $(RUSTC) main.rs --print link-args diff --git a/tests/run-make/interdependent-c-libraries/bar.c b/tests/run-make/interdependent-c-libraries/bar.c new file mode 100644 index 00000000000..812c9753528 --- /dev/null +++ b/tests/run-make/interdependent-c-libraries/bar.c @@ -0,0 +1,3 @@ +void foo(); + +void bar() { foo(); } diff --git a/tests/run-make/interdependent-c-libraries/bar.rs b/tests/run-make/interdependent-c-libraries/bar.rs new file mode 100644 index 00000000000..3c2c3f21814 --- /dev/null +++ b/tests/run-make/interdependent-c-libraries/bar.rs @@ -0,0 +1,14 @@ +#![crate_type = "rlib"] + +extern crate foo; + +#[link(name = "bar", kind = "static")] +extern "C" { + fn bar(); +} + +pub fn doit() { + unsafe { + bar(); + } +} diff --git a/tests/run-make/interdependent-c-libraries/foo.c b/tests/run-make/interdependent-c-libraries/foo.c new file mode 100644 index 00000000000..85e6cd8c390 --- /dev/null +++ b/tests/run-make/interdependent-c-libraries/foo.c @@ -0,0 +1 @@ +void foo() {} diff --git a/tests/run-make/interdependent-c-libraries/foo.rs b/tests/run-make/interdependent-c-libraries/foo.rs new file mode 100644 index 00000000000..a69809726c6 --- /dev/null +++ b/tests/run-make/interdependent-c-libraries/foo.rs @@ -0,0 +1,12 @@ +#![crate_type = "rlib"] + +#[link(name = "foo", kind = "static")] +extern "C" { + fn foo(); +} + +pub fn doit() { + unsafe { + foo(); + } +} diff --git a/tests/run-make/interdependent-c-libraries/main.rs b/tests/run-make/interdependent-c-libraries/main.rs new file mode 100644 index 00000000000..2aba427df47 --- /dev/null +++ b/tests/run-make/interdependent-c-libraries/main.rs @@ -0,0 +1,6 @@ +extern crate foo; +extern crate bar; + +fn main() { + bar::doit(); +} diff --git a/tests/run-make/intrinsic-unreachable/Makefile b/tests/run-make/intrinsic-unreachable/Makefile new file mode 100644 index 00000000000..ff9cc57098c --- /dev/null +++ b/tests/run-make/intrinsic-unreachable/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +# needs-asm-support +# ignore-windows-msvc +# +# Because of Windows exception handling, the code is not necessarily any shorter. +# https://github.com/llvm-mirror/llvm/commit/64b2297786f7fd6f5fa24cdd4db0298fbf211466 + +all: + $(RUSTC) -O --emit asm exit-ret.rs + $(RUSTC) -O --emit asm exit-unreachable.rs + test `wc -l < $(TMPDIR)/exit-unreachable.s` -lt `wc -l < $(TMPDIR)/exit-ret.s` diff --git a/tests/run-make/intrinsic-unreachable/exit-ret.rs b/tests/run-make/intrinsic-unreachable/exit-ret.rs new file mode 100644 index 00000000000..e7b9694d9f2 --- /dev/null +++ b/tests/run-make/intrinsic-unreachable/exit-ret.rs @@ -0,0 +1,14 @@ +#![crate_type="lib"] +use std::arch::asm; + +#[deny(unreachable_code)] +pub fn exit(n: usize) -> i32 { + unsafe { + // Pretend this asm is an exit() syscall. + asm!("/*{0}*/", in(reg) n); + } + // This return value is just here to generate some extra code for a return + // value, making it easier for the test script to detect whether the + // compiler deleted it. + 42 +} diff --git a/tests/run-make/intrinsic-unreachable/exit-unreachable.rs b/tests/run-make/intrinsic-unreachable/exit-unreachable.rs new file mode 100644 index 00000000000..ec85db733df --- /dev/null +++ b/tests/run-make/intrinsic-unreachable/exit-unreachable.rs @@ -0,0 +1,18 @@ +#![feature(core_intrinsics)] +#![crate_type="lib"] +use std::arch::asm; + +use std::intrinsics; + +#[allow(unreachable_code)] +pub fn exit(n: usize) -> i32 { + unsafe { + // Pretend this asm is an exit() syscall. + asm!("/*{0}*/", in(reg) n); + intrinsics::unreachable() + } + // This return value is just here to generate some extra code for a return + // value, making it easier for the test script to detect whether the + // compiler deleted it. + 42 +} diff --git a/tests/run-make/invalid-library/Makefile b/tests/run-make/invalid-library/Makefile new file mode 100644 index 00000000000..910d9af7b05 --- /dev/null +++ b/tests/run-make/invalid-library/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + touch $(TMPDIR)/lib.rmeta + $(AR) crus $(TMPDIR)/libfoo-ffffffff-1.0.rlib $(TMPDIR)/lib.rmeta + $(RUSTC) foo.rs 2>&1 | $(CGREP) "found invalid metadata" diff --git a/tests/run-make/invalid-library/foo.rs b/tests/run-make/invalid-library/foo.rs new file mode 100644 index 00000000000..bb7b36c496e --- /dev/null +++ b/tests/run-make/invalid-library/foo.rs @@ -0,0 +1,3 @@ +extern crate foo; + +fn main() {} diff --git a/tests/run-make/invalid-staticlib/Makefile b/tests/run-make/invalid-staticlib/Makefile new file mode 100644 index 00000000000..3f0f74ce3cb --- /dev/null +++ b/tests/run-make/invalid-staticlib/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + touch $(TMPDIR)/libfoo.a + echo | $(RUSTC) - --crate-type=rlib -lstatic=foo 2>&1 | $(CGREP) "failed to add native library" diff --git a/tests/run-make/issue-11908/Makefile b/tests/run-make/issue-11908/Makefile new file mode 100644 index 00000000000..47005537e41 --- /dev/null +++ b/tests/run-make/issue-11908/Makefile @@ -0,0 +1,21 @@ +# This test ensures that if you have the same rlib or dylib at two locations +# in the same path that you don't hit an assertion in the compiler. +# +# Note that this relies on `liburl` to be in the path somewhere else, +# and then our aux-built libraries will collide with liburl (they have +# the same version listed) + +include ../tools.mk + +all: + mkdir $(TMPDIR)/other + $(RUSTC) foo.rs --crate-type=dylib -C prefer-dynamic + mv $(call DYLIB,foo) $(TMPDIR)/other + $(RUSTC) foo.rs --crate-type=dylib -C prefer-dynamic + $(RUSTC) bar.rs -L $(TMPDIR)/other + rm -rf $(TMPDIR) + mkdir -p $(TMPDIR)/other + $(RUSTC) foo.rs --crate-type=rlib + mv $(TMPDIR)/libfoo.rlib $(TMPDIR)/other + $(RUSTC) foo.rs --crate-type=rlib + $(RUSTC) bar.rs -L $(TMPDIR)/other diff --git a/tests/run-make/issue-11908/bar.rs b/tests/run-make/issue-11908/bar.rs new file mode 100644 index 00000000000..bb7b36c496e --- /dev/null +++ b/tests/run-make/issue-11908/bar.rs @@ -0,0 +1,3 @@ +extern crate foo; + +fn main() {} diff --git a/tests/run-make/issue-11908/foo.rs b/tests/run-make/issue-11908/foo.rs new file mode 100644 index 00000000000..82b2dfe9fdb --- /dev/null +++ b/tests/run-make/issue-11908/foo.rs @@ -0,0 +1 @@ +#![crate_name = "foo"] diff --git a/tests/run-make/issue-14500/Makefile b/tests/run-make/issue-14500/Makefile new file mode 100644 index 00000000000..52550e57018 --- /dev/null +++ b/tests/run-make/issue-14500/Makefile @@ -0,0 +1,13 @@ +include ../tools.mk + +# Test to make sure that reachable extern fns are always available in final +# productcs, including when LTO is used. In this test, the `foo` crate has a +# reahable symbol, and is a dependency of the `bar` crate. When the `bar` crate +# is compiled with LTO, it shouldn't strip the symbol from `foo`, and that's the +# only way that `foo.c` will successfully compile. + +all: + $(RUSTC) foo.rs --crate-type=rlib + $(RUSTC) bar.rs --crate-type=staticlib -C lto -L. -o $(TMPDIR)/libbar.a + $(CC) foo.c $(TMPDIR)/libbar.a $(EXTRACFLAGS) $(call OUT_EXE,foo) + $(call RUN,foo) diff --git a/tests/run-make/issue-14500/bar.rs b/tests/run-make/issue-14500/bar.rs new file mode 100644 index 00000000000..49af74e1b74 --- /dev/null +++ b/tests/run-make/issue-14500/bar.rs @@ -0,0 +1 @@ +extern crate foo; diff --git a/tests/run-make/issue-14500/foo.c b/tests/run-make/issue-14500/foo.c new file mode 100644 index 00000000000..2353d400df3 --- /dev/null +++ b/tests/run-make/issue-14500/foo.c @@ -0,0 +1,7 @@ +extern void foo(); +extern char FOO_STATIC; + +int main() { + foo(); + return (int)FOO_STATIC; +} diff --git a/tests/run-make/issue-14500/foo.rs b/tests/run-make/issue-14500/foo.rs new file mode 100644 index 00000000000..7c19c1f2c67 --- /dev/null +++ b/tests/run-make/issue-14500/foo.rs @@ -0,0 +1,5 @@ +#[no_mangle] +pub extern "C" fn foo() {} + +#[no_mangle] +pub static FOO_STATIC: u8 = 0; diff --git a/tests/run-make/issue-14698/Makefile b/tests/run-make/issue-14698/Makefile new file mode 100644 index 00000000000..a1cfb5abab5 --- /dev/null +++ b/tests/run-make/issue-14698/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + TMP=fake TMPDIR=fake $(RUSTC) foo.rs 2>&1 | $(CGREP) "couldn't create a temp dir:" diff --git a/tests/run-make/issue-14698/foo.rs b/tests/run-make/issue-14698/foo.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/issue-14698/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/issue-15460/Makefile b/tests/run-make/issue-15460/Makefile new file mode 100644 index 00000000000..1648d0c0c9b --- /dev/null +++ b/tests/run-make/issue-15460/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,foo) + $(RUSTC) foo.rs -C extra-filename=-383hf8 -C prefer-dynamic + $(RUSTC) bar.rs + $(call RUN,bar) diff --git a/tests/run-make/issue-15460/bar.rs b/tests/run-make/issue-15460/bar.rs new file mode 100644 index 00000000000..e66aeb6bd39 --- /dev/null +++ b/tests/run-make/issue-15460/bar.rs @@ -0,0 +1,4 @@ +extern crate foo; +fn main() { + unsafe { foo::foo() } +} diff --git a/tests/run-make/issue-15460/foo.c b/tests/run-make/issue-15460/foo.c new file mode 100644 index 00000000000..fdf595b574e --- /dev/null +++ b/tests/run-make/issue-15460/foo.c @@ -0,0 +1,6 @@ +// ignore-license + +#ifdef _WIN32 +__declspec(dllexport) +#endif +void foo() {} diff --git a/tests/run-make/issue-15460/foo.rs b/tests/run-make/issue-15460/foo.rs new file mode 100644 index 00000000000..b4eaa0b31c5 --- /dev/null +++ b/tests/run-make/issue-15460/foo.rs @@ -0,0 +1,6 @@ +#![crate_type = "dylib"] + +#[link(name = "foo", kind = "static")] +extern "C" { + pub fn foo(); +} diff --git a/tests/run-make/issue-18943/Makefile b/tests/run-make/issue-18943/Makefile new file mode 100644 index 00000000000..fc40d756d6f --- /dev/null +++ b/tests/run-make/issue-18943/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +# Regression test for ICE #18943 when compiling as lib + +all: + $(RUSTC) foo.rs --crate-type lib + $(call REMOVE_RLIBS,foo) && exit 0 || exit 1 diff --git a/tests/run-make/issue-18943/foo.rs b/tests/run-make/issue-18943/foo.rs new file mode 100644 index 00000000000..d18400dd3a5 --- /dev/null +++ b/tests/run-make/issue-18943/foo.rs @@ -0,0 +1,5 @@ +trait Foo { } + +trait Bar { } + +impl<'a> Foo for Bar + 'a { } diff --git a/tests/run-make/issue-20626/Makefile b/tests/run-make/issue-20626/Makefile new file mode 100644 index 00000000000..f76f31e794a --- /dev/null +++ b/tests/run-make/issue-20626/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +# Test output to be four +# The original error only occurred when printing, not when comparing using assert! + +all: + $(RUSTC) foo.rs -O + [ `$(call RUN,foo)` = "4" ] diff --git a/tests/run-make/issue-20626/foo.rs b/tests/run-make/issue-20626/foo.rs new file mode 100644 index 00000000000..a474e234e72 --- /dev/null +++ b/tests/run-make/issue-20626/foo.rs @@ -0,0 +1,13 @@ +fn identity(a: &u32) -> &u32 { a } + +fn print_foo(f: &fn(&u32) -> &u32, x: &u32) { + print!("{}", (*f)(x)); +} + +fn main() { + let x = &4; + let f: fn(&u32) -> &u32 = identity; + + // Didn't print 4 on optimized builds + print_foo(&f, x); +} diff --git a/tests/run-make/issue-22131/Makefile b/tests/run-make/issue-22131/Makefile new file mode 100644 index 00000000000..770f4b04ec3 --- /dev/null +++ b/tests/run-make/issue-22131/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: foo.rs + $(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs + $(RUSTDOC) --test --cfg 'feature="bar"' \ + -L $(TMPDIR) foo.rs |\ + $(CGREP) 'foo.rs - foo (line 1) ... ok' diff --git a/tests/run-make/issue-22131/foo.rs b/tests/run-make/issue-22131/foo.rs new file mode 100644 index 00000000000..33255d76879 --- /dev/null +++ b/tests/run-make/issue-22131/foo.rs @@ -0,0 +1,5 @@ +/// ```rust +/// assert_eq!(foo::foo(), 1); +/// ``` +#[cfg(feature = "bar")] +pub fn foo() -> i32 { 1 } diff --git a/tests/run-make/issue-24445/Makefile b/tests/run-make/issue-24445/Makefile new file mode 100644 index 00000000000..2a12226a6c0 --- /dev/null +++ b/tests/run-make/issue-24445/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +# only-linux + +all: + $(RUSTC) foo.rs + $(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -o $(TMPDIR)/foo + $(call RUN,foo) + $(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -pie -fPIC -o $(TMPDIR)/foo + $(call RUN,foo) diff --git a/tests/run-make/issue-24445/foo.c b/tests/run-make/issue-24445/foo.c new file mode 100644 index 00000000000..bb4036b06e1 --- /dev/null +++ b/tests/run-make/issue-24445/foo.c @@ -0,0 +1,6 @@ +void foo(); + +int main() { + foo(); + return 0; +} diff --git a/tests/run-make/issue-24445/foo.rs b/tests/run-make/issue-24445/foo.rs new file mode 100644 index 00000000000..b67f3847cd4 --- /dev/null +++ b/tests/run-make/issue-24445/foo.rs @@ -0,0 +1,15 @@ +#![crate_type = "staticlib"] + +struct Destroy; +impl Drop for Destroy { + fn drop(&mut self) { println!("drop"); } +} + +thread_local! { + static X: Destroy = Destroy +} + +#[no_mangle] +pub extern "C" fn foo() { + X.with(|_| ()); +} diff --git a/tests/run-make/issue-25581/Makefile b/tests/run-make/issue-25581/Makefile new file mode 100644 index 00000000000..4f5d026f213 --- /dev/null +++ b/tests/run-make/issue-25581/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) test.rs + $(call RUN,test) || exit 1 diff --git a/tests/run-make/issue-25581/test.c b/tests/run-make/issue-25581/test.c new file mode 100644 index 00000000000..52fbf78510a --- /dev/null +++ b/tests/run-make/issue-25581/test.c @@ -0,0 +1,15 @@ +#include +#include + +struct ByteSlice { + uint8_t *data; + size_t len; +}; + +size_t slice_len(struct ByteSlice bs) { + return bs.len; +} + +uint8_t slice_elem(struct ByteSlice bs, size_t idx) { + return bs.data[idx]; +} diff --git a/tests/run-make/issue-25581/test.rs b/tests/run-make/issue-25581/test.rs new file mode 100644 index 00000000000..ba6749c9722 --- /dev/null +++ b/tests/run-make/issue-25581/test.rs @@ -0,0 +1,18 @@ +#[link(name = "test", kind = "static")] +extern "C" { + fn slice_len(s: &[u8]) -> usize; + fn slice_elem(s: &[u8], idx: usize) -> u8; +} + +fn main() { + let data = [1, 2, 3, 4, 5]; + + unsafe { + assert_eq!(data.len(), slice_len(&data) as usize); + assert_eq!(data[0], slice_elem(&data, 0)); + assert_eq!(data[1], slice_elem(&data, 1)); + assert_eq!(data[2], slice_elem(&data, 2)); + assert_eq!(data[3], slice_elem(&data, 3)); + assert_eq!(data[4], slice_elem(&data, 4)); + } +} diff --git a/tests/run-make/issue-26006/Makefile b/tests/run-make/issue-26006/Makefile new file mode 100644 index 00000000000..0ff07302002 --- /dev/null +++ b/tests/run-make/issue-26006/Makefile @@ -0,0 +1,16 @@ +include ../tools.mk + +# ignore-windows + +OUT := $(TMPDIR)/out + +all: time + +time: libc + mkdir -p $(OUT)/time $(OUT)/time/deps + ln -sf $(OUT)/libc/liblibc.rlib $(OUT)/time/deps/ + $(RUSTC) in/time/lib.rs -Ldependency=$(OUT)/time/deps/ + +libc: + mkdir -p $(OUT)/libc + $(RUSTC) in/libc/lib.rs --crate-name=libc -Cmetadata=foo -o $(OUT)/libc/liblibc.rlib diff --git a/tests/run-make/issue-26006/in/libc/lib.rs b/tests/run-make/issue-26006/in/libc/lib.rs new file mode 100644 index 00000000000..23f2bf51800 --- /dev/null +++ b/tests/run-make/issue-26006/in/libc/lib.rs @@ -0,0 +1,3 @@ +#![crate_type="rlib"] + +pub fn something(){} diff --git a/tests/run-make/issue-26006/in/time/lib.rs b/tests/run-make/issue-26006/in/time/lib.rs new file mode 100644 index 00000000000..87f2f824a36 --- /dev/null +++ b/tests/run-make/issue-26006/in/time/lib.rs @@ -0,0 +1,4 @@ +#![feature(rustc_private)] +extern crate libc; + +fn main(){} diff --git a/tests/run-make/issue-26092/Makefile b/tests/run-make/issue-26092/Makefile new file mode 100644 index 00000000000..96822e7690b --- /dev/null +++ b/tests/run-make/issue-26092/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +# This test ensures that rustc does not panic with `-o ""` option. + +all: + $(RUSTC) -o "" blank.rs 2>&1 | $(CGREP) -i 'panic' && exit 1 || exit 0 diff --git a/tests/run-make/issue-26092/blank.rs b/tests/run-make/issue-26092/blank.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/issue-26092/blank.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/issue-28595/Makefile b/tests/run-make/issue-28595/Makefile new file mode 100644 index 00000000000..30a1d9c560a --- /dev/null +++ b/tests/run-make/issue-28595/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,a) $(call NATIVE_STATICLIB,b) + $(RUSTC) a.rs + $(RUSTC) b.rs + $(call RUN,b) diff --git a/tests/run-make/issue-28595/a.c b/tests/run-make/issue-28595/a.c new file mode 100644 index 00000000000..7bfd83cca21 --- /dev/null +++ b/tests/run-make/issue-28595/a.c @@ -0,0 +1 @@ +void a(void) {} diff --git a/tests/run-make/issue-28595/a.rs b/tests/run-make/issue-28595/a.rs new file mode 100644 index 00000000000..07863cf64d6 --- /dev/null +++ b/tests/run-make/issue-28595/a.rs @@ -0,0 +1,6 @@ +#![crate_type = "rlib"] + +#[link(name = "a", kind = "static")] +extern "C" { + pub fn a(); +} diff --git a/tests/run-make/issue-28595/b.c b/tests/run-make/issue-28595/b.c new file mode 100644 index 00000000000..6aecb5f9e04 --- /dev/null +++ b/tests/run-make/issue-28595/b.c @@ -0,0 +1,5 @@ +extern void a(void); + +void b(void) { + a(); +} diff --git a/tests/run-make/issue-28595/b.rs b/tests/run-make/issue-28595/b.rs new file mode 100644 index 00000000000..1f389859fad --- /dev/null +++ b/tests/run-make/issue-28595/b.rs @@ -0,0 +1,12 @@ +extern crate a; + +#[link(name = "b", kind = "static")] +extern "C" { + pub fn b(); +} + +fn main() { + unsafe { + b(); + } +} diff --git a/tests/run-make/issue-28766/Makefile b/tests/run-make/issue-28766/Makefile new file mode 100644 index 00000000000..96d0bdc2b2a --- /dev/null +++ b/tests/run-make/issue-28766/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) -O foo.rs + $(RUSTC) -O -L $(TMPDIR) main.rs diff --git a/tests/run-make/issue-28766/foo.rs b/tests/run-make/issue-28766/foo.rs new file mode 100644 index 00000000000..1dcabe42dc1 --- /dev/null +++ b/tests/run-make/issue-28766/foo.rs @@ -0,0 +1,8 @@ +#![crate_type="lib"] +pub struct Foo(()); + +impl Foo { + pub fn new() -> Foo { + Foo(()) + } +} diff --git a/tests/run-make/issue-28766/main.rs b/tests/run-make/issue-28766/main.rs new file mode 100644 index 00000000000..de12b1fd9dc --- /dev/null +++ b/tests/run-make/issue-28766/main.rs @@ -0,0 +1,7 @@ +#![crate_type="lib"] +extern crate foo; +use foo::Foo; + +pub fn crash() -> Box { + Box::new(Foo::new()) +} diff --git a/tests/run-make/issue-30063/Makefile b/tests/run-make/issue-30063/Makefile new file mode 100644 index 00000000000..e4ede598f7b --- /dev/null +++ b/tests/run-make/issue-30063/Makefile @@ -0,0 +1,35 @@ +include ../tools.mk + +all: + rm -f $(TMPDIR)/foo-output + $(RUSTC) -C codegen-units=4 -o $(TMPDIR)/foo-output foo.rs + rm $(TMPDIR)/foo-output + + rm -f $(TMPDIR)/asm-output + $(RUSTC) -C codegen-units=4 --emit=asm -o $(TMPDIR)/asm-output foo.rs + rm $(TMPDIR)/asm-output + + rm -f $(TMPDIR)/bc-output + $(RUSTC) -C codegen-units=4 --emit=llvm-bc -o $(TMPDIR)/bc-output foo.rs + rm $(TMPDIR)/bc-output + + rm -f $(TMPDIR)/ir-output + $(RUSTC) -C codegen-units=4 --emit=llvm-ir -o $(TMPDIR)/ir-output foo.rs + rm $(TMPDIR)/ir-output + + rm -f $(TMPDIR)/link-output + $(RUSTC) -C codegen-units=4 --emit=link -o $(TMPDIR)/link-output foo.rs + rm $(TMPDIR)/link-output + + rm -f $(TMPDIR)/obj-output + $(RUSTC) -C codegen-units=4 --emit=obj -o $(TMPDIR)/obj-output foo.rs + rm $(TMPDIR)/obj-output + + rm -f $(TMPDIR)/dep-output + $(RUSTC) -C codegen-units=4 --emit=dep-info -o $(TMPDIR)/dep-output foo.rs + rm $(TMPDIR)/dep-output + +# # (This case doesn't work yet, and may be fundamentally wrong-headed anyway.) +# rm -f $(TMPDIR)/multi-output +# $(RUSTC) -C codegen-units=4 --emit=asm,obj -o $(TMPDIR)/multi-output foo.rs +# rm $(TMPDIR)/multi-output diff --git a/tests/run-make/issue-30063/foo.rs b/tests/run-make/issue-30063/foo.rs new file mode 100644 index 00000000000..45590d86ba6 --- /dev/null +++ b/tests/run-make/issue-30063/foo.rs @@ -0,0 +1 @@ +fn main() { } diff --git a/tests/run-make/issue-33329/Makefile b/tests/run-make/issue-33329/Makefile new file mode 100644 index 00000000000..9c149440d8e --- /dev/null +++ b/tests/run-make/issue-33329/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) --target x86_64_unknown-linux-musl main.rs 2>&1 | $(CGREP) \ + "error: Error loading target specification: Could not find specification for target" diff --git a/tests/run-make/issue-33329/main.rs b/tests/run-make/issue-33329/main.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/issue-33329/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/issue-35164/Makefile b/tests/run-make/issue-35164/Makefile new file mode 100644 index 00000000000..38aa6f1265f --- /dev/null +++ b/tests/run-make/issue-35164/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) main.rs --error-format json 2>&1 | $(CGREP) -e '"byte_start":23\b' '"byte_end":29\b' diff --git a/tests/run-make/issue-35164/main.rs b/tests/run-make/issue-35164/main.rs new file mode 100644 index 00000000000..1333d63224c --- /dev/null +++ b/tests/run-make/issue-35164/main.rs @@ -0,0 +1,5 @@ +mod submodule; + +fn main() { + submodule::foo(); +} diff --git a/tests/run-make/issue-35164/submodule/mod.rs b/tests/run-make/issue-35164/submodule/mod.rs new file mode 100644 index 00000000000..a9045b242fb --- /dev/null +++ b/tests/run-make/issue-35164/submodule/mod.rs @@ -0,0 +1,3 @@ +pub fn foo() { + let _MyFoo = 2; +} diff --git a/tests/run-make/issue-37839/Makefile b/tests/run-make/issue-37839/Makefile new file mode 100644 index 00000000000..de50bd71379 --- /dev/null +++ b/tests/run-make/issue-37839/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + $(RUSTC) a.rs && $(RUSTC) b.rs + $(BARE_RUSTC) c.rs -L dependency=$(TMPDIR) --extern b=$(TMPDIR)/libb.rlib \ + --out-dir=$(TMPDIR) diff --git a/tests/run-make/issue-37839/a.rs b/tests/run-make/issue-37839/a.rs new file mode 100644 index 00000000000..b5dffac3ff6 --- /dev/null +++ b/tests/run-make/issue-37839/a.rs @@ -0,0 +1,2 @@ +#![allow(unused)] +#![crate_type = "proc-macro"] diff --git a/tests/run-make/issue-37839/b.rs b/tests/run-make/issue-37839/b.rs new file mode 100644 index 00000000000..355d2b16527 --- /dev/null +++ b/tests/run-make/issue-37839/b.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +#[macro_use] extern crate a; diff --git a/tests/run-make/issue-37839/c.rs b/tests/run-make/issue-37839/c.rs new file mode 100644 index 00000000000..4c7ce01b6a0 --- /dev/null +++ b/tests/run-make/issue-37839/c.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +extern crate b; diff --git a/tests/run-make/issue-37893/Makefile b/tests/run-make/issue-37893/Makefile new file mode 100644 index 00000000000..33a60830e5d --- /dev/null +++ b/tests/run-make/issue-37893/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTC) a.rs && $(RUSTC) b.rs && $(RUSTC) c.rs diff --git a/tests/run-make/issue-37893/a.rs b/tests/run-make/issue-37893/a.rs new file mode 100644 index 00000000000..b5dffac3ff6 --- /dev/null +++ b/tests/run-make/issue-37893/a.rs @@ -0,0 +1,2 @@ +#![allow(unused)] +#![crate_type = "proc-macro"] diff --git a/tests/run-make/issue-37893/b.rs b/tests/run-make/issue-37893/b.rs new file mode 100644 index 00000000000..355d2b16527 --- /dev/null +++ b/tests/run-make/issue-37893/b.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +#[macro_use] extern crate a; diff --git a/tests/run-make/issue-37893/c.rs b/tests/run-make/issue-37893/c.rs new file mode 100644 index 00000000000..b9c2155728c --- /dev/null +++ b/tests/run-make/issue-37893/c.rs @@ -0,0 +1,3 @@ +#![crate_type = "staticlib"] +extern crate b; +extern crate a; diff --git a/tests/run-make/issue-38237/Makefile b/tests/run-make/issue-38237/Makefile new file mode 100644 index 00000000000..75121d04012 --- /dev/null +++ b/tests/run-make/issue-38237/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs; $(RUSTC) bar.rs + $(RUSTDOC) baz.rs -L $(TMPDIR) -o $(TMPDIR) diff --git a/tests/run-make/issue-38237/bar.rs b/tests/run-make/issue-38237/bar.rs new file mode 100644 index 00000000000..2b839f3a3b3 --- /dev/null +++ b/tests/run-make/issue-38237/bar.rs @@ -0,0 +1,4 @@ +#![crate_type = "lib"] + +#[derive(Debug)] +pub struct S; diff --git a/tests/run-make/issue-38237/baz.rs b/tests/run-make/issue-38237/baz.rs new file mode 100644 index 00000000000..cd2425f9b69 --- /dev/null +++ b/tests/run-make/issue-38237/baz.rs @@ -0,0 +1,8 @@ +extern crate foo; +extern crate bar; + +pub struct Bar; +impl ::std::ops::Deref for Bar { + type Target = bar::S; + fn deref(&self) -> &Self::Target { unimplemented!() } +} diff --git a/tests/run-make/issue-38237/foo.rs b/tests/run-make/issue-38237/foo.rs new file mode 100644 index 00000000000..a106e4fde5c --- /dev/null +++ b/tests/run-make/issue-38237/foo.rs @@ -0,0 +1,9 @@ +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +#[proc_macro_derive(A)] +pub fn derive(ts: proc_macro::TokenStream) -> proc_macro::TokenStream { ts } + +#[derive(Debug)] +struct S; diff --git a/tests/run-make/issue-40535/Makefile b/tests/run-make/issue-40535/Makefile new file mode 100644 index 00000000000..155c8825214 --- /dev/null +++ b/tests/run-make/issue-40535/Makefile @@ -0,0 +1,13 @@ +include ../tools.mk + +# The ICE occurred in the following situation: +# * `foo` declares `extern crate bar, baz`, depends only on `bar` (forgetting `baz` in `Cargo.toml`) +# * `bar` declares and depends on `extern crate baz` +# * All crates built in metadata-only mode (`cargo check`) +all: + # cc https://github.com/rust-lang/rust/issues/40623 + $(RUSTC) baz.rs --emit=metadata + $(RUSTC) bar.rs --emit=metadata --extern baz=$(TMPDIR)/libbaz.rmeta + $(RUSTC) foo.rs --emit=metadata --extern bar=$(TMPDIR)/libbar.rmeta 2>&1 | \ + $(CGREP) -v "unexpectedly panicked" + # ^ Succeeds if it doesn't find the ICE message diff --git a/tests/run-make/issue-40535/bar.rs b/tests/run-make/issue-40535/bar.rs new file mode 100644 index 00000000000..b02b28f59d9 --- /dev/null +++ b/tests/run-make/issue-40535/bar.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] + +extern crate baz; diff --git a/tests/run-make/issue-40535/baz.rs b/tests/run-make/issue-40535/baz.rs new file mode 100644 index 00000000000..83be6e807e0 --- /dev/null +++ b/tests/run-make/issue-40535/baz.rs @@ -0,0 +1 @@ +#![crate_type = "lib"] diff --git a/tests/run-make/issue-40535/foo.rs b/tests/run-make/issue-40535/foo.rs new file mode 100644 index 00000000000..27020266425 --- /dev/null +++ b/tests/run-make/issue-40535/foo.rs @@ -0,0 +1,4 @@ +#![crate_type = "lib"] + +extern crate bar; +extern crate baz; diff --git a/tests/run-make/issue-46239/Makefile b/tests/run-make/issue-46239/Makefile new file mode 100644 index 00000000000..a93ef321298 --- /dev/null +++ b/tests/run-make/issue-46239/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) main.rs -C opt-level=1 + $(call RUN,main) diff --git a/tests/run-make/issue-46239/main.rs b/tests/run-make/issue-46239/main.rs new file mode 100644 index 00000000000..b7df5cf4d81 --- /dev/null +++ b/tests/run-make/issue-46239/main.rs @@ -0,0 +1,8 @@ +fn project(x: &(T,)) -> &T { &x.0 } + +fn dummy() {} + +fn main() { + let f = (dummy as fn(),); + (*project(&f))(); +} diff --git a/tests/run-make/issue-47551/Makefile b/tests/run-make/issue-47551/Makefile new file mode 100644 index 00000000000..5a6ac725701 --- /dev/null +++ b/tests/run-make/issue-47551/Makefile @@ -0,0 +1,9 @@ +# only-linux +# ignore-32bit + +include ../tools.mk + +all: + $(RUSTC) eh_frame-terminator.rs + $(call RUN,eh_frame-terminator) | $(CGREP) '1122334455667788' + objdump --dwarf=frames $(TMPDIR)/eh_frame-terminator | $(CGREP) 'ZERO terminator' diff --git a/tests/run-make/issue-47551/eh_frame-terminator.rs b/tests/run-make/issue-47551/eh_frame-terminator.rs new file mode 100644 index 00000000000..a2c7a31b7c3 --- /dev/null +++ b/tests/run-make/issue-47551/eh_frame-terminator.rs @@ -0,0 +1,22 @@ +// run-pass + +#[derive(Clone, Copy)] +struct Foo { + array: [u64; 10240], +} + +impl Foo { + const fn new() -> Self { + Self { + array: [0x1122_3344_5566_7788; 10240] + } + } +} + +static BAR: [Foo; 10240] = [Foo::new(); 10240]; + +fn main() { + let bt = std::backtrace::Backtrace::force_capture(); + println!("Hello, world! {:?}", bt); + println!("{:x}", BAR[0].array[0]); +} diff --git a/tests/run-make/issue-51671/Makefile b/tests/run-make/issue-51671/Makefile new file mode 100644 index 00000000000..c9364536992 --- /dev/null +++ b/tests/run-make/issue-51671/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# ignore-windows-msvc + +all: + $(RUSTC) --emit=obj app.rs + nm $(TMPDIR)/app.o | $(CGREP) rust_begin_unwind + nm $(TMPDIR)/app.o | $(CGREP) rust_eh_personality + nm $(TMPDIR)/app.o | $(CGREP) __rg_oom diff --git a/tests/run-make/issue-51671/app.rs b/tests/run-make/issue-51671/app.rs new file mode 100644 index 00000000000..e9dc1e9744f --- /dev/null +++ b/tests/run-make/issue-51671/app.rs @@ -0,0 +1,20 @@ +#![crate_type = "bin"] +#![feature(lang_items, alloc_error_handler)] +#![no_main] +#![no_std] + +use core::alloc::Layout; +use core::panic::PanicInfo; + +#[panic_handler] +fn panic(_: &PanicInfo) -> ! { + loop {} +} + +#[lang = "eh_personality"] +fn eh() {} + +#[alloc_error_handler] +fn oom(_: Layout) -> ! { + loop {} +} diff --git a/tests/run-make/issue-53964/Makefile b/tests/run-make/issue-53964/Makefile new file mode 100644 index 00000000000..6bd83021374 --- /dev/null +++ b/tests/run-make/issue-53964/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) panic.rs + $(RUSTC) -C panic=abort --emit=obj app.rs -L $(TMPDIR) diff --git a/tests/run-make/issue-53964/app.rs b/tests/run-make/issue-53964/app.rs new file mode 100644 index 00000000000..8127b9578bf --- /dev/null +++ b/tests/run-make/issue-53964/app.rs @@ -0,0 +1,8 @@ +#![crate_type = "bin"] +#![no_main] +#![no_std] + +#![deny(unused_extern_crates)] + +// `panic` provides a `panic_handler` so it shouldn't trip the `unused_extern_crates` lint +extern crate panic; diff --git a/tests/run-make/issue-53964/panic.rs b/tests/run-make/issue-53964/panic.rs new file mode 100644 index 00000000000..a8781205071 --- /dev/null +++ b/tests/run-make/issue-53964/panic.rs @@ -0,0 +1,10 @@ +#![crate_type = "lib"] +#![feature(panic_handler)] +#![no_std] + +use core::panic::PanicInfo; + +#[panic_handler] +fn panic(_: &PanicInfo) -> ! { + loop {} +} diff --git a/tests/run-make/issue-64153/Makefile b/tests/run-make/issue-64153/Makefile new file mode 100644 index 00000000000..f42ea620fb9 --- /dev/null +++ b/tests/run-make/issue-64153/Makefile @@ -0,0 +1,26 @@ +include ../tools.mk + +# `llvm-objdump`'s output looks different on windows than on other platforms. +# It should be enough to check on Unix platforms, so: +# ignore-windows + +# Staticlibs don't include Rust object files from upstream crates if the same +# code was already pulled into the lib via LTO. However, the bug described in +# https://github.com/rust-lang/rust/issues/64153 lead to this exclusion not +# working properly if the upstream crate was compiled with an explicit filename +# (via `-o`). +# +# This test makes sure that functions defined in the upstream crates do not +# appear twice in the final staticlib when listing all the symbols from it. + +all: + $(RUSTC) --crate-type rlib upstream.rs -o $(TMPDIR)/libupstream.rlib -Ccodegen-units=1 + $(RUSTC) --crate-type staticlib downstream.rs -Clto -Ccodegen-units=1 -o $(TMPDIR)/libdownstream.a + # Dump all the symbols from the staticlib into `syms` + "$(LLVM_BIN_DIR)"/llvm-objdump -t $(TMPDIR)/libdownstream.a > $(TMPDIR)/syms + # Count the global instances of `issue64153_test_function`. There'll be 2 + # if the `upstream` object file got erroneously included twice. + # The line we are testing for with the regex looks something like: + # 0000000000000000 g F .text.issue64153_test_function 00000023 issue64153_test_function + grep -c -e "[[:space:]]g[[:space:]]*F[[:space:]].*issue64153_test_function" $(TMPDIR)/syms > $(TMPDIR)/count + [ "$$(cat $(TMPDIR)/count)" -eq "1" ] diff --git a/tests/run-make/issue-64153/downstream.rs b/tests/run-make/issue-64153/downstream.rs new file mode 100644 index 00000000000..e03704665d4 --- /dev/null +++ b/tests/run-make/issue-64153/downstream.rs @@ -0,0 +1,6 @@ +extern crate upstream; + +#[no_mangle] +pub extern "C" fn foo() { + print!("1 + 1 = {}", upstream::issue64153_test_function(1)); +} diff --git a/tests/run-make/issue-64153/upstream.rs b/tests/run-make/issue-64153/upstream.rs new file mode 100644 index 00000000000..861a00298ea --- /dev/null +++ b/tests/run-make/issue-64153/upstream.rs @@ -0,0 +1,6 @@ +// Make this function extern "C", public, and no-mangle, so that it gets +// exported from the downstream staticlib. +#[no_mangle] +pub extern "C" fn issue64153_test_function(x: u32) -> u32 { + x + 1 +} diff --git a/tests/run-make/issue-68794-textrel-on-minimal-lib/Makefile b/tests/run-make/issue-68794-textrel-on-minimal-lib/Makefile new file mode 100644 index 00000000000..13983f4ffe0 --- /dev/null +++ b/tests/run-make/issue-68794-textrel-on-minimal-lib/Makefile @@ -0,0 +1,17 @@ +# Regression test for issue #68794 +# +# Verify that no text relocations are accidentally introduced by linking a +# minimal rust staticlib. +# +# The test links a rust static library into a shared library, and checks that +# the linker doesn't have to flag the resulting file as containing TEXTRELs. + +include ../tools.mk + +# only-linux + +all: + $(RUSTC) foo.rs + $(CC) bar.c $(call STATICLIB,foo) -fPIC -shared -o $(call DYLIB,bar) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + readelf -d $(call DYLIB,bar) | grep TEXTREL; test $$? -eq 1 diff --git a/tests/run-make/issue-68794-textrel-on-minimal-lib/bar.c b/tests/run-make/issue-68794-textrel-on-minimal-lib/bar.c new file mode 100644 index 00000000000..bb4036b06e1 --- /dev/null +++ b/tests/run-make/issue-68794-textrel-on-minimal-lib/bar.c @@ -0,0 +1,6 @@ +void foo(); + +int main() { + foo(); + return 0; +} diff --git a/tests/run-make/issue-68794-textrel-on-minimal-lib/foo.rs b/tests/run-make/issue-68794-textrel-on-minimal-lib/foo.rs new file mode 100644 index 00000000000..a3e865b638e --- /dev/null +++ b/tests/run-make/issue-68794-textrel-on-minimal-lib/foo.rs @@ -0,0 +1,8 @@ +#![crate_type = "staticlib"] + +#[no_mangle] +pub extern "C" fn foo(x: u32) { + // using the println! makes it so that enough code from the standard + // library is included (see issue #68794) + println!("foo: {}", x); +} diff --git a/tests/run-make/issue-69368/Makefile b/tests/run-make/issue-69368/Makefile new file mode 100644 index 00000000000..41770475db0 --- /dev/null +++ b/tests/run-make/issue-69368/Makefile @@ -0,0 +1,18 @@ +include ../tools.mk + +# Test that previously triggered a linker failure with root cause +# similar to one found in the issue #69368. +# +# The crate that provides oom lang item is missing some other lang +# items. Necessary to prevent the use of start-group / end-group. +# +# The weak lang items are defined in a separate compilation units, +# so that linker could omit them if not used. +# +# The crates that need those weak lang items are dependencies of +# crates that provide them. + +all: + $(RUSTC) a.rs + $(RUSTC) b.rs + $(RUSTC) c.rs diff --git a/tests/run-make/issue-69368/a.rs b/tests/run-make/issue-69368/a.rs new file mode 100644 index 00000000000..a54f429550e --- /dev/null +++ b/tests/run-make/issue-69368/a.rs @@ -0,0 +1,26 @@ +#![crate_type = "rlib"] +#![feature(lang_items)] +#![feature(panic_unwind)] +#![no_std] + +extern crate panic_unwind; + +#[panic_handler] +pub fn panic_handler(_: &core::panic::PanicInfo) -> ! { + loop {} +} + +#[no_mangle] +extern "C" fn __rust_drop_panic() -> ! { + loop {} +} + +#[no_mangle] +extern "C" fn __rust_foreign_exception() -> ! { + loop {} +} + +#[lang = "eh_personality"] +fn eh_personality() { + loop {} +} diff --git a/tests/run-make/issue-69368/b.rs b/tests/run-make/issue-69368/b.rs new file mode 100644 index 00000000000..4d6af026656 --- /dev/null +++ b/tests/run-make/issue-69368/b.rs @@ -0,0 +1,8 @@ +#![crate_type = "rlib"] +#![feature(alloc_error_handler)] +#![no_std] + +#[alloc_error_handler] +pub fn error_handler(_: core::alloc::Layout) -> ! { + panic!(); +} diff --git a/tests/run-make/issue-69368/c.rs b/tests/run-make/issue-69368/c.rs new file mode 100644 index 00000000000..729c4249a05 --- /dev/null +++ b/tests/run-make/issue-69368/c.rs @@ -0,0 +1,34 @@ +#![crate_type = "bin"] +#![feature(start)] +#![no_std] + +extern crate alloc; +extern crate a; +extern crate b; + +use alloc::vec::Vec; +use core::alloc::*; + +struct Allocator; + +unsafe impl GlobalAlloc for Allocator { + unsafe fn alloc(&self, _: Layout) -> *mut u8 { + loop {} + } + + unsafe fn dealloc(&self, _: *mut u8, _: Layout) { + loop {} + } +} + +#[global_allocator] +static ALLOCATOR: Allocator = Allocator; + +#[start] +fn main(argc: isize, _argv: *const *const u8) -> isize { + let mut v = Vec::new(); + for i in 0..argc { + v.push(i); + } + v.iter().sum() +} diff --git a/tests/run-make/issue-7349/Makefile b/tests/run-make/issue-7349/Makefile new file mode 100644 index 00000000000..dc073b77fe1 --- /dev/null +++ b/tests/run-make/issue-7349/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +# Test to make sure that inner functions within a polymorphic outer function +# don't get re-codegened when the outer function is monomorphized. The test +# code monomorphizes the outer functions several times, but the magic constants +# used in the inner functions should each appear only once in the generated IR. + +all: + $(RUSTC) foo.rs --emit=llvm-ir + [ "$$(grep -c 'ret i32 8675309' "$(TMPDIR)/foo.ll")" -eq "1" ] + [ "$$(grep -c 'ret i32 11235813' "$(TMPDIR)/foo.ll")" -eq "1" ] diff --git a/tests/run-make/issue-7349/foo.rs b/tests/run-make/issue-7349/foo.rs new file mode 100644 index 00000000000..246a1259580 --- /dev/null +++ b/tests/run-make/issue-7349/foo.rs @@ -0,0 +1,22 @@ +fn outer() { + #[allow(dead_code)] + fn inner() -> u32 { + 8675309 + } + inner(); +} + +extern "C" fn outer_foreign() { + #[allow(dead_code)] + fn inner() -> u32 { + 11235813 + } + inner(); +} + +fn main() { + outer::(); + outer::(); + outer_foreign::(); + outer_foreign::(); +} diff --git a/tests/run-make/issue-83045/Makefile b/tests/run-make/issue-83045/Makefile new file mode 100644 index 00000000000..fc180ccfe28 --- /dev/null +++ b/tests/run-make/issue-83045/Makefile @@ -0,0 +1,33 @@ +include ../../run-make-fulldeps/tools.mk + +# This test case creates a situation where the crate loader would run +# into an ICE when confronted with an invalid setup where it cannot +# find the dependency of a direct dependency. +# +# The test case makes sure that the compiler produces the expected +# error message but does not ICE immediately after. +# +# See https://github.com/rust-lang/rust/issues/83045 + +# This is a platform-independent issue, no need to waste time testing +# everywhere. +# only-x86_64 +# only-linux + +# NOTE: We use BARE_RUSTC below so that the compiler can't find liba.rlib +# If we used RUSTC the additional '-L TMPDIR' option would allow rustc to +# actually find the crate. +# +# We check that we get the expected error message +# But that we do not get an ICE + +all: + $(RUSTC) --crate-name=a --crate-type=rlib a.rs --verbose + $(RUSTC) --crate-name=b --crate-type=rlib --extern a=$(TMPDIR)/liba.rlib b.rs --verbose + $(BARE_RUSTC) --out-dir $(TMPDIR) \ + --extern b=$(TMPDIR)/libb.rlib \ + --crate-type=rlib \ + --edition=2018 \ + c.rs 2>&1 | tee $(TMPDIR)/output.txt || exit 0 + $(CGREP) E0519 < $(TMPDIR)/output.txt + $(CGREP) -v "internal compiler error" < $(TMPDIR)/output.txt diff --git a/tests/run-make/issue-83045/a.rs b/tests/run-make/issue-83045/a.rs new file mode 100644 index 00000000000..66d9f758e9d --- /dev/null +++ b/tests/run-make/issue-83045/a.rs @@ -0,0 +1 @@ +// empty on purpose diff --git a/tests/run-make/issue-83045/b.rs b/tests/run-make/issue-83045/b.rs new file mode 100644 index 00000000000..f4876cfa457 --- /dev/null +++ b/tests/run-make/issue-83045/b.rs @@ -0,0 +1 @@ +extern crate a; diff --git a/tests/run-make/issue-83045/c.rs b/tests/run-make/issue-83045/c.rs new file mode 100644 index 00000000000..e0c4525499e --- /dev/null +++ b/tests/run-make/issue-83045/c.rs @@ -0,0 +1 @@ +use b as _; diff --git a/tests/run-make/issue-84395-lto-embed-bitcode/Makefile b/tests/run-make/issue-84395-lto-embed-bitcode/Makefile new file mode 100644 index 00000000000..879ce174339 --- /dev/null +++ b/tests/run-make/issue-84395-lto-embed-bitcode/Makefile @@ -0,0 +1,11 @@ +# needs-matching-clang + +# This test makes sure the embed bitcode in elf created with +# lto-embed-bitcode=optimized is valid llvm BC module. + +include ../../run-make-fulldeps/tools.mk + +all: + $(RUSTC) test.rs --target $(TARGET) -Clink-arg=-fuse-ld=lld -Clinker-plugin-lto -Clinker=$(CLANG) -Clink-arg=-Wl,--plugin-opt=-lto-embed-bitcode=optimized -Zemit-thin-lto=no + $(LLVM_BIN_DIR)/objcopy --dump-section .llvmbc=$(TMPDIR)/test.bc $(TMPDIR)/test + $(LLVM_BIN_DIR)/llvm-dis $(TMPDIR)/test.bc diff --git a/tests/run-make/issue-84395-lto-embed-bitcode/test.rs b/tests/run-make/issue-84395-lto-embed-bitcode/test.rs new file mode 100644 index 00000000000..47ad8c63411 --- /dev/null +++ b/tests/run-make/issue-84395-lto-embed-bitcode/test.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello World!"); +} diff --git a/tests/run-make/issue-97463-abi-param-passing/Makefile b/tests/run-make/issue-97463-abi-param-passing/Makefile new file mode 100644 index 00000000000..db1b53e152e --- /dev/null +++ b/tests/run-make/issue-97463-abi-param-passing/Makefile @@ -0,0 +1,14 @@ +-include ../tools.mk + +# ignore-msvc + +# The issue exercised by this test, rust-lang/rust#97463, explicitly needs `-O` +# flags (like `-O3`) to reproduce. Thus, we call $(CC) instead of nicer +# alternatives provided by tools.mk like using `COMPILE_OBJ` or using a +# `NATIVE_STATICLIB` dependency. + +all: + $(CC) -c -O3 -o $(TMPDIR)/bad.o bad.c + $(AR) rcs $(TMPDIR)/libbad.a $(TMPDIR)/bad.o + $(RUSTC) param_passing.rs -L$(TMPDIR) -lbad -C opt-level=3 + $(call RUN,param_passing) diff --git a/tests/run-make/issue-97463-abi-param-passing/bad.c b/tests/run-make/issue-97463-abi-param-passing/bad.c new file mode 100644 index 00000000000..013314ab20d --- /dev/null +++ b/tests/run-make/issue-97463-abi-param-passing/bad.c @@ -0,0 +1,24 @@ +#include +#include +#include + + +struct bloc { + uint16_t a; + uint16_t b; + uint16_t c; +}; + +uint16_t c_read_value(uint32_t a, uint32_t b, uint32_t c) { + struct bloc *data = malloc(sizeof(struct bloc)); + + data->a = a & 0xFFFF; + data->b = b & 0xFFFF; + data->c = c & 0xFFFF; + + printf("C struct: a = %u, b = %u, c = %u\n", + (unsigned) data->a, (unsigned) data->b, (unsigned) data->c); + printf("C function returns %u\n", (unsigned) data->b); + + return data->b; /* leak data */ +} diff --git a/tests/run-make/issue-97463-abi-param-passing/param_passing.rs b/tests/run-make/issue-97463-abi-param-passing/param_passing.rs new file mode 100644 index 00000000000..c11f3cc72bd --- /dev/null +++ b/tests/run-make/issue-97463-abi-param-passing/param_passing.rs @@ -0,0 +1,38 @@ +// NOTE: Exposing the bug encoded in this test is sensitive to +// LLVM optimization choices. See additional note below for an +// example. + +#[link(name = "bad")] +extern "C" { + pub fn c_read_value(a: u32, b: u32, c: u32) -> u16; +} + +fn main() { + const C1: usize = 0x327b23c6; + const C2: usize = C1 & 0xFFFF; + + let r1: usize = 0x0; + let r2: usize = C1; + let r3: usize = 0x0; + let value: u16 = unsafe { c_read_value(r1 as u32, r2 as u32, r3 as u32) }; + + // NOTE: as an example of the sensitivity of this test to optimization choices, + // uncommenting this block of code makes the bug go away on pnkfelix's machine. + // (But observing via `dbg!` doesn't hide the bug. At least sometimes.) + /* + println!("{}", value); + println!("{}", value as usize); + println!("{}", usize::from(value)); + println!("{}", (value as usize) & 0xFFFF); + */ + + let d1 = value; + let d2 = value as usize; + let d3 = usize::from(value); + let d4 = (value as usize) & 0xFFFF; + + let d = (&d1, &d2, &d3, &d4); + let d_ = (d1, d2, d3, d4); + + assert_eq!(((&(C2 as u16), &C2, &C2, &C2), (C2 as u16, C2, C2, C2)), (d, d_)); +} diff --git a/tests/run-make/issue64319/Makefile b/tests/run-make/issue64319/Makefile new file mode 100644 index 00000000000..ee0d177abc9 --- /dev/null +++ b/tests/run-make/issue64319/Makefile @@ -0,0 +1,39 @@ +include ../../run-make-fulldeps/tools.mk + +# Different optimization levels imply different values for `-Zshare-generics`, +# so try out a whole bunch of combinations to make sure everything is compatible +all: + # First up, try some defaults + $(RUSTC) --crate-type rlib foo.rs + $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 + + # Next try mixing up some things explicitly + $(RUSTC) --crate-type rlib foo.rs -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -Z share-generics=no + $(RUSTC) --crate-type rlib foo.rs -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes + $(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -Z share-generics=no + $(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes + + # Now combine a whole bunch of options together + $(RUSTC) --crate-type rlib foo.rs + $(RUSTC) --crate-type dylib bar.rs + $(RUSTC) --crate-type dylib bar.rs -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -C opt-level=1 + $(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -C opt-level=2 + $(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 + $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -C opt-level=s + $(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=yes + $(RUSTC) --crate-type dylib bar.rs -C opt-level=z + $(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=no + $(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=yes diff --git a/tests/run-make/issue64319/bar.rs b/tests/run-make/issue64319/bar.rs new file mode 100644 index 00000000000..3895c0b6cdb --- /dev/null +++ b/tests/run-make/issue64319/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +pub fn bar() { + foo::foo(); +} diff --git a/tests/run-make/issue64319/foo.rs b/tests/run-make/issue64319/foo.rs new file mode 100644 index 00000000000..c54a238e9ad --- /dev/null +++ b/tests/run-make/issue64319/foo.rs @@ -0,0 +1,9 @@ +pub fn foo() { + bar::(); +} + +pub fn bar() { + baz(); +} + +fn baz() {} diff --git a/tests/run-make/libs-through-symlinks/Makefile b/tests/run-make/libs-through-symlinks/Makefile new file mode 100644 index 00000000000..45deaecb840 --- /dev/null +++ b/tests/run-make/libs-through-symlinks/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +# ignore-windows + +NAME := $(shell $(RUSTC) --print file-names foo.rs) + +all: + mkdir -p $(TMPDIR)/outdir + $(RUSTC) foo.rs -o $(TMPDIR)/outdir/$(NAME) + ln -nsf outdir/$(NAME) $(TMPDIR) + RUSTC_LOG=rustc_metadata::loader $(RUSTC) bar.rs diff --git a/tests/run-make/libs-through-symlinks/bar.rs b/tests/run-make/libs-through-symlinks/bar.rs new file mode 100644 index 00000000000..bb7b36c496e --- /dev/null +++ b/tests/run-make/libs-through-symlinks/bar.rs @@ -0,0 +1,3 @@ +extern crate foo; + +fn main() {} diff --git a/tests/run-make/libs-through-symlinks/foo.rs b/tests/run-make/libs-through-symlinks/foo.rs new file mode 100644 index 00000000000..8e3df2c6d4e --- /dev/null +++ b/tests/run-make/libs-through-symlinks/foo.rs @@ -0,0 +1,2 @@ +#![crate_type = "rlib"] +#![crate_name = "foo"] diff --git a/tests/run-make/libtest-json/Makefile b/tests/run-make/libtest-json/Makefile new file mode 100644 index 00000000000..37b6cb9e2d4 --- /dev/null +++ b/tests/run-make/libtest-json/Makefile @@ -0,0 +1,18 @@ +include ../tools.mk + +# Test expected libtest's JSON output + +OUTPUT_FILE_DEFAULT := $(TMPDIR)/libtest-json-output-default.json +OUTPUT_FILE_STDOUT_SUCCESS := $(TMPDIR)/libtest-json-output-stdout-success.json + +all: f.rs validate_json.py output-default.json output-stdout-success.json + $(RUSTC) --test f.rs + RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=json > $(OUTPUT_FILE_DEFAULT) || true + RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=json --show-output > $(OUTPUT_FILE_STDOUT_SUCCESS) || true + + cat $(OUTPUT_FILE_DEFAULT) | "$(PYTHON)" validate_json.py + cat $(OUTPUT_FILE_STDOUT_SUCCESS) | "$(PYTHON)" validate_json.py + + # Normalize the actual output and compare to expected output file + cat $(OUTPUT_FILE_DEFAULT) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-default.json - + cat $(OUTPUT_FILE_STDOUT_SUCCESS) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-stdout-success.json - diff --git a/tests/run-make/libtest-json/f.rs b/tests/run-make/libtest-json/f.rs new file mode 100644 index 00000000000..edfe25086ae --- /dev/null +++ b/tests/run-make/libtest-json/f.rs @@ -0,0 +1,22 @@ +#[test] +fn a() { + println!("print from successful test"); + // Should pass +} + +#[test] +fn b() { + assert!(false); +} + +#[test] +#[should_panic] +fn c() { + assert!(false); +} + +#[test] +#[ignore = "msg"] +fn d() { + assert!(false); +} diff --git a/tests/run-make/libtest-json/output-default.json b/tests/run-make/libtest-json/output-default.json new file mode 100644 index 00000000000..ad22b66eda6 --- /dev/null +++ b/tests/run-make/libtest-json/output-default.json @@ -0,0 +1,10 @@ +{ "type": "suite", "event": "started", "test_count": 4 } +{ "type": "test", "event": "started", "name": "a" } +{ "type": "test", "name": "a", "event": "ok" } +{ "type": "test", "event": "started", "name": "b" } +{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } +{ "type": "test", "event": "started", "name": "c" } +{ "type": "test", "name": "c", "event": "ok" } +{ "type": "test", "event": "started", "name": "d" } +{ "type": "test", "name": "d", "event": "ignored", "message": "msg" } +{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } diff --git a/tests/run-make/libtest-json/output-stdout-success.json b/tests/run-make/libtest-json/output-stdout-success.json new file mode 100644 index 00000000000..ec98172eb1c --- /dev/null +++ b/tests/run-make/libtest-json/output-stdout-success.json @@ -0,0 +1,10 @@ +{ "type": "suite", "event": "started", "test_count": 4 } +{ "type": "test", "event": "started", "name": "a" } +{ "type": "test", "name": "a", "event": "ok", "stdout": "print from successful test\n" } +{ "type": "test", "event": "started", "name": "b" } +{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at 'assertion failed: false', f.rs:9:5\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } +{ "type": "test", "event": "started", "name": "c" } +{ "type": "test", "name": "c", "event": "ok", "stdout": "thread 'c' panicked at 'assertion failed: false', f.rs:15:5\n" } +{ "type": "test", "event": "started", "name": "d" } +{ "type": "test", "name": "d", "event": "ignored", "message": "msg" } +{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } diff --git a/tests/run-make/libtest-json/validate_json.py b/tests/run-make/libtest-json/validate_json.py new file mode 100755 index 00000000000..657f732f2bf --- /dev/null +++ b/tests/run-make/libtest-json/validate_json.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +import sys +import json + +# Try to decode line in order to ensure it is a valid JSON document +for line in sys.stdin: + json.loads(line) diff --git a/tests/run-make/link-arg/Makefile b/tests/run-make/link-arg/Makefile new file mode 100644 index 00000000000..103527c3e14 --- /dev/null +++ b/tests/run-make/link-arg/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk +RUSTC_FLAGS = -C link-arg="-lfoo" -C link-arg="-lbar" --print link-args + +all: + $(RUSTC) $(RUSTC_FLAGS) empty.rs | $(CGREP) lfoo lbar diff --git a/tests/run-make/link-arg/empty.rs b/tests/run-make/link-arg/empty.rs new file mode 100644 index 00000000000..45590d86ba6 --- /dev/null +++ b/tests/run-make/link-arg/empty.rs @@ -0,0 +1 @@ +fn main() { } diff --git a/tests/run-make/link-args-order/Makefile b/tests/run-make/link-args-order/Makefile new file mode 100644 index 00000000000..c562cc1b396 --- /dev/null +++ b/tests/run-make/link-args-order/Makefile @@ -0,0 +1,10 @@ +# ignore-msvc + +include ../tools.mk + +RUSTC_FLAGS = -C linker-flavor=ld -C link-arg=a -C link-args="b c" -C link-args="d e" -C link-arg=f +RUSTC_FLAGS_PRE = -C linker-flavor=ld -Z pre-link-arg=a -Z pre-link-args="b c" -Z pre-link-args="d e" -Z pre-link-arg=f + +all: + $(RUSTC) $(RUSTC_FLAGS) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f"' + $(RUSTC) $(RUSTC_FLAGS_PRE) empty.rs 2>&1 | $(CGREP) '"a" "b" "c" "d" "e" "f"' diff --git a/tests/run-make/link-args-order/empty.rs b/tests/run-make/link-args-order/empty.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/link-args-order/empty.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/link-cfg/Makefile b/tests/run-make/link-cfg/Makefile new file mode 100644 index 00000000000..0b25ccded06 --- /dev/null +++ b/tests/run-make/link-cfg/Makefile @@ -0,0 +1,22 @@ +include ../tools.mk + +all: $(call DYLIB,return1) $(call DYLIB,return2) $(call NATIVE_STATICLIB,return3) + ls $(TMPDIR) + $(BARE_RUSTC) --print cfg --target x86_64-unknown-linux-musl | $(CGREP) crt-static + + $(RUSTC) no-deps.rs --cfg foo + $(call RUN,no-deps) + $(RUSTC) no-deps.rs --cfg bar + $(call RUN,no-deps) + + $(RUSTC) dep.rs + $(RUSTC) with-deps.rs --cfg foo + $(call RUN,with-deps) + $(RUSTC) with-deps.rs --cfg bar + $(call RUN,with-deps) + + $(RUSTC) dep-with-staticlib.rs + $(RUSTC) with-staticlib-deps.rs --cfg foo + $(call RUN,with-staticlib-deps) + $(RUSTC) with-staticlib-deps.rs --cfg bar + $(call RUN,with-staticlib-deps) diff --git a/tests/run-make/link-cfg/dep-with-staticlib.rs b/tests/run-make/link-cfg/dep-with-staticlib.rs new file mode 100644 index 00000000000..5ad66475d00 --- /dev/null +++ b/tests/run-make/link-cfg/dep-with-staticlib.rs @@ -0,0 +1,8 @@ +#![feature(link_cfg)] +#![crate_type = "rlib"] + +#[link(name = "return1", cfg(foo))] +#[link(name = "return3", kind = "static", cfg(bar))] +extern "C" { + pub fn my_function() -> i32; +} diff --git a/tests/run-make/link-cfg/dep.rs b/tests/run-make/link-cfg/dep.rs new file mode 100644 index 00000000000..40de77f05b3 --- /dev/null +++ b/tests/run-make/link-cfg/dep.rs @@ -0,0 +1,8 @@ +#![feature(link_cfg)] +#![crate_type = "rlib"] + +#[link(name = "return1", cfg(foo))] +#[link(name = "return2", cfg(bar))] +extern "C" { + pub fn my_function() -> i32; +} diff --git a/tests/run-make/link-cfg/no-deps.rs b/tests/run-make/link-cfg/no-deps.rs new file mode 100644 index 00000000000..ba5a8711a26 --- /dev/null +++ b/tests/run-make/link-cfg/no-deps.rs @@ -0,0 +1,20 @@ +#![feature(link_cfg)] + +#[link(name = "return1", cfg(foo))] +#[link(name = "return2", cfg(bar))] +extern "C" { + fn my_function() -> i32; +} + +fn main() { + unsafe { + let v = my_function(); + if cfg!(foo) { + assert_eq!(v, 1); + } else if cfg!(bar) { + assert_eq!(v, 2); + } else { + panic!("unknown"); + } + } +} diff --git a/tests/run-make/link-cfg/return1.c b/tests/run-make/link-cfg/return1.c new file mode 100644 index 00000000000..41c2809ade3 --- /dev/null +++ b/tests/run-make/link-cfg/return1.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int my_function() { + return 1; +} diff --git a/tests/run-make/link-cfg/return2.c b/tests/run-make/link-cfg/return2.c new file mode 100644 index 00000000000..622aeaa294c --- /dev/null +++ b/tests/run-make/link-cfg/return2.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int my_function() { + return 2; +} diff --git a/tests/run-make/link-cfg/return3.c b/tests/run-make/link-cfg/return3.c new file mode 100644 index 00000000000..f29dc60d5e8 --- /dev/null +++ b/tests/run-make/link-cfg/return3.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int my_function() { + return 3; +} diff --git a/tests/run-make/link-cfg/with-deps.rs b/tests/run-make/link-cfg/with-deps.rs new file mode 100644 index 00000000000..48b7828152e --- /dev/null +++ b/tests/run-make/link-cfg/with-deps.rs @@ -0,0 +1,14 @@ +extern crate dep; + +fn main() { + unsafe { + let v = dep::my_function(); + if cfg!(foo) { + assert_eq!(v, 1); + } else if cfg!(bar) { + assert_eq!(v, 2); + } else { + panic!("unknown"); + } + } +} diff --git a/tests/run-make/link-cfg/with-staticlib-deps.rs b/tests/run-make/link-cfg/with-staticlib-deps.rs new file mode 100644 index 00000000000..23e5926a73c --- /dev/null +++ b/tests/run-make/link-cfg/with-staticlib-deps.rs @@ -0,0 +1,14 @@ +extern crate dep_with_staticlib; + +fn main() { + unsafe { + let v = dep_with_staticlib::my_function(); + if cfg!(foo) { + assert_eq!(v, 1); + } else if cfg!(bar) { + assert_eq!(v, 3); + } else { + panic!("unknown"); + } + } +} diff --git a/tests/run-make/link-dedup/Makefile b/tests/run-make/link-dedup/Makefile new file mode 100644 index 00000000000..eff18ab48ab --- /dev/null +++ b/tests/run-make/link-dedup/Makefile @@ -0,0 +1,12 @@ +# ignore-msvc + +include ../tools.mk + +all: + $(RUSTC) depa.rs + $(RUSTC) depb.rs + $(RUSTC) depc.rs + $(RUSTC) empty.rs --cfg bar 2>&1 | $(CGREP) '"-ltesta" "-ltestb" "-ltesta"' + $(RUSTC) empty.rs 2>&1 | $(CGREP) '"-ltesta"' + $(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltestb"' + $(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltesta" "-ltesta" "-ltesta"' diff --git a/tests/run-make/link-dedup/depa.rs b/tests/run-make/link-dedup/depa.rs new file mode 100644 index 00000000000..19178c5bd49 --- /dev/null +++ b/tests/run-make/link-dedup/depa.rs @@ -0,0 +1,10 @@ +#![crate_type = "rlib"] + +#[link(name = "testa")] +extern "C" {} + +#[link(name = "testa")] +extern "C" {} + +#[link(name = "testa")] +extern "C" {} diff --git a/tests/run-make/link-dedup/depb.rs b/tests/run-make/link-dedup/depb.rs new file mode 100644 index 00000000000..b1be21fe005 --- /dev/null +++ b/tests/run-make/link-dedup/depb.rs @@ -0,0 +1,8 @@ +#![feature(link_cfg)] +#![crate_type = "rlib"] + +#[link(name = "testb", cfg(foo))] +extern "C" {} + +#[link(name = "testb", cfg(bar))] +extern "C" {} diff --git a/tests/run-make/link-dedup/depc.rs b/tests/run-make/link-dedup/depc.rs new file mode 100644 index 00000000000..8dcb3dee5a2 --- /dev/null +++ b/tests/run-make/link-dedup/depc.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] + +#[link(name = "testa")] +extern "C" {} diff --git a/tests/run-make/link-dedup/empty.rs b/tests/run-make/link-dedup/empty.rs new file mode 100644 index 00000000000..e00ae18f4af --- /dev/null +++ b/tests/run-make/link-dedup/empty.rs @@ -0,0 +1,5 @@ +extern crate depa; +extern crate depb; +extern crate depc; + +fn main() {} diff --git a/tests/run-make/link-path-order/Makefile b/tests/run-make/link-path-order/Makefile new file mode 100644 index 00000000000..ed7c299e61a --- /dev/null +++ b/tests/run-make/link-path-order/Makefile @@ -0,0 +1,18 @@ +include ../tools.mk + +# Verifies that the -L arguments given to the linker is in the same order +# as the -L arguments on the rustc command line. + +CORRECT_DIR=$(TMPDIR)/correct +WRONG_DIR=$(TMPDIR)/wrong + +F := $(call NATIVE_STATICLIB_FILE,foo) + +all: $(call NATIVE_STATICLIB,correct) $(call NATIVE_STATICLIB,wrong) + mkdir -p $(CORRECT_DIR) $(WRONG_DIR) + mv $(call NATIVE_STATICLIB,correct) $(CORRECT_DIR)/$(F) + mv $(call NATIVE_STATICLIB,wrong) $(WRONG_DIR)/$(F) + $(RUSTC) main.rs -o $(TMPDIR)/should_succeed -L $(CORRECT_DIR) -L $(WRONG_DIR) + $(call RUN,should_succeed) + $(RUSTC) main.rs -o $(TMPDIR)/should_fail -L $(WRONG_DIR) -L $(CORRECT_DIR) + $(call FAIL,should_fail) diff --git a/tests/run-make/link-path-order/correct.c b/tests/run-make/link-path-order/correct.c new file mode 100644 index 00000000000..3064af952f8 --- /dev/null +++ b/tests/run-make/link-path-order/correct.c @@ -0,0 +1 @@ +int should_return_one() { return 1; } diff --git a/tests/run-make/link-path-order/main.rs b/tests/run-make/link-path-order/main.rs new file mode 100644 index 00000000000..8024e343d19 --- /dev/null +++ b/tests/run-make/link-path-order/main.rs @@ -0,0 +1,16 @@ +#![feature(rustc_private)] + +extern crate libc; + +#[link(name = "foo", kind = "static")] +extern "C" { + fn should_return_one() -> libc::c_int; +} + +fn main() { + let result = unsafe { should_return_one() }; + + if result != 1 { + std::process::exit(255); + } +} diff --git a/tests/run-make/link-path-order/wrong.c b/tests/run-make/link-path-order/wrong.c new file mode 100644 index 00000000000..64275b3ad6b --- /dev/null +++ b/tests/run-make/link-path-order/wrong.c @@ -0,0 +1 @@ +int should_return_one() { return 0; } diff --git a/tests/run-make/linkage-attr-on-static/Makefile b/tests/run-make/linkage-attr-on-static/Makefile new file mode 100644 index 00000000000..7cc54e40a3a --- /dev/null +++ b/tests/run-make/linkage-attr-on-static/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,foo) + $(RUSTC) bar.rs + $(call RUN,bar) || exit 1 diff --git a/tests/run-make/linkage-attr-on-static/bar.rs b/tests/run-make/linkage-attr-on-static/bar.rs new file mode 100644 index 00000000000..68607cbb657 --- /dev/null +++ b/tests/run-make/linkage-attr-on-static/bar.rs @@ -0,0 +1,16 @@ +#![feature(linkage)] + +#[no_mangle] +#[linkage = "external"] +static BAZ: i32 = 21; + +#[link(name = "foo", kind = "static")] +extern "C" { + fn what() -> i32; +} + +fn main() { + unsafe { + assert_eq!(what(), BAZ); + } +} diff --git a/tests/run-make/linkage-attr-on-static/foo.c b/tests/run-make/linkage-attr-on-static/foo.c new file mode 100644 index 00000000000..78a6934f57f --- /dev/null +++ b/tests/run-make/linkage-attr-on-static/foo.c @@ -0,0 +1,7 @@ +#include + +extern int32_t BAZ; + +int32_t what() { + return BAZ; +} diff --git a/tests/run-make/long-linker-command-lines-cmd-exe/Makefile b/tests/run-make/long-linker-command-lines-cmd-exe/Makefile new file mode 100644 index 00000000000..a38f4fe5dc5 --- /dev/null +++ b/tests/run-make/long-linker-command-lines-cmd-exe/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs -g + cp foo.bat $(TMPDIR)/ + OUT_DIR="$(TMPDIR)" RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo) diff --git a/tests/run-make/long-linker-command-lines-cmd-exe/foo.bat b/tests/run-make/long-linker-command-lines-cmd-exe/foo.bat new file mode 100644 index 00000000000..a9350f12bbb --- /dev/null +++ b/tests/run-make/long-linker-command-lines-cmd-exe/foo.bat @@ -0,0 +1 @@ +%MY_LINKER% %* diff --git a/tests/run-make/long-linker-command-lines-cmd-exe/foo.rs b/tests/run-make/long-linker-command-lines-cmd-exe/foo.rs new file mode 100644 index 00000000000..74d7b9b07f6 --- /dev/null +++ b/tests/run-make/long-linker-command-lines-cmd-exe/foo.rs @@ -0,0 +1,101 @@ +// Like the `long-linker-command-lines` test this test attempts to blow +// a command line limit for running the linker. Unlike that test, however, +// this test is testing `cmd.exe` specifically rather than the OS. +// +// Unfortunately `cmd.exe` has a 8192 limit which is relatively small +// in the grand scheme of things and anyone sripting rustc's linker +// is probably using a `*.bat` script and is likely to hit this limit. +// +// This test uses a `foo.bat` script as the linker which just simply +// delegates back to this program. The compiler should use a lower +// limit for arguments before passing everything via `@`, which +// means that everything should still succeed here. + +use std::env; +use std::fs::{self, File}; +use std::io::{BufWriter, Write, Read}; +use std::path::PathBuf; +use std::process::Command; + +fn main() { + if !cfg!(windows) { + return + } + + let tmpdir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); + let ok = tmpdir.join("ok"); + let not_ok = tmpdir.join("not_ok"); + if env::var("YOU_ARE_A_LINKER").is_ok() { + match env::args_os().find(|a| a.to_string_lossy().contains("@")) { + Some(file) => { + let file = file.to_str().unwrap(); + fs::copy(&file[1..], &ok).unwrap(); + } + None => { File::create(¬_ok).unwrap(); } + } + return + } + + let rustc = env::var_os("RUSTC").unwrap_or("rustc".into()); + let me = env::current_exe().unwrap(); + let bat = me.parent() + .unwrap() + .join("foo.bat"); + let bat_linker = format!("linker={}", bat.display()); + for i in (1..).map(|i| i * 10) { + println!("attempt: {}", i); + + let file = tmpdir.join("bar.rs"); + let mut f = BufWriter::new(File::create(&file).unwrap()); + let mut lib_name = String::new(); + for _ in 0..i { + lib_name.push_str("foo"); + } + for j in 0..i { + writeln!(f, "#[link(name = \"{}{}\")]", lib_name, j).unwrap(); + } + writeln!(f, "extern {{}}\nfn main() {{}}").unwrap(); + f.into_inner().unwrap(); + + drop(fs::remove_file(&ok)); + drop(fs::remove_file(¬_ok)); + let status = Command::new(&rustc) + .arg(&file) + .arg("-C").arg(&bat_linker) + .arg("--out-dir").arg(&tmpdir) + .env("YOU_ARE_A_LINKER", "1") + .env("MY_LINKER", &me) + .status() + .unwrap(); + + if !status.success() { + panic!("rustc didn't succeed: {}", status); + } + + if !ok.exists() { + assert!(not_ok.exists()); + continue + } + + let mut contents = Vec::new(); + File::open(&ok).unwrap().read_to_end(&mut contents).unwrap(); + + for j in 0..i { + let exp = format!("{}{}", lib_name, j); + let exp = if cfg!(target_env = "msvc") { + let mut out = Vec::with_capacity(exp.len() * 2); + for c in exp.encode_utf16() { + // encode in little endian + out.push(c as u8); + out.push((c >> 8) as u8); + } + out + } else { + exp.into_bytes() + }; + assert!(contents.windows(exp.len()).any(|w| w == &exp[..])); + } + + break + } +} diff --git a/tests/run-make/long-linker-command-lines/Makefile b/tests/run-make/long-linker-command-lines/Makefile new file mode 100644 index 00000000000..00199ca970d --- /dev/null +++ b/tests/run-make/long-linker-command-lines/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs -g -O + RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo) diff --git a/tests/run-make/long-linker-command-lines/foo.rs b/tests/run-make/long-linker-command-lines/foo.rs new file mode 100644 index 00000000000..db238c0cf1a --- /dev/null +++ b/tests/run-make/long-linker-command-lines/foo.rs @@ -0,0 +1,106 @@ +// This is a test which attempts to blow out the system limit with how many +// arguments can be passed to a process. This'll successively call rustc with +// larger and larger argument lists in an attempt to find one that's way too +// big for the system at hand. This file itself is then used as a "linker" to +// detect when the process creation succeeds. +// +// Eventually we should see an argument that looks like `@` as we switch from +// passing literal arguments to passing everything in the file. + +use std::collections::HashSet; +use std::env; +use std::fs::{self, File}; +use std::io::{BufWriter, Write}; +use std::path::{Path, PathBuf}; +use std::process::Command; + +fn write_test_case(file: &Path, n: usize) -> HashSet { + let mut libs = HashSet::new(); + let mut f = BufWriter::new(File::create(&file).unwrap()); + let mut prefix = String::new(); + for _ in 0..n { + prefix.push_str("foo"); + } + for i in 0..n { + writeln!(f, "#[link(name = \"S{}{}S\")]", prefix, i).unwrap(); + libs.insert(format!("{}{}", prefix, i)); + } + writeln!(f, "extern \"C\" {{}}\nfn main() {{}}").unwrap(); + f.into_inner().unwrap(); + + libs +} + +fn read_linker_args(path: &Path) -> String { + let contents = fs::read(path).unwrap(); + if cfg!(target_env = "msvc") { + let mut i = contents.chunks(2).map(|c| { + c[0] as u16 | ((c[1] as u16) << 8) + }); + assert_eq!(i.next(), Some(0xfeff), "Expected UTF-16 BOM"); + String::from_utf16(&i.collect::>()).unwrap() + } else { + String::from_utf8(contents).unwrap() + } +} + +fn main() { + let tmpdir = PathBuf::from(env::var_os("TMPDIR").unwrap()); + let ok = tmpdir.join("ok"); + if env::var("YOU_ARE_A_LINKER").is_ok() { + if let Some(file) = env::args_os().find(|a| a.to_string_lossy().contains("@")) { + let file = file.to_str().expect("non-utf8 file argument"); + fs::copy(&file[1..], &ok).unwrap(); + } + return + } + + let rustc = env::var_os("RUSTC").unwrap_or("rustc".into()); + let me_as_linker = format!("linker={}", env::current_exe().unwrap().display()); + for i in (1..).map(|i| i * 100) { + println!("attempt: {}", i); + let file = tmpdir.join("bar.rs"); + let mut expected_libs = write_test_case(&file, i); + + drop(fs::remove_file(&ok)); + let output = Command::new(&rustc) + .arg(&file) + .arg("-C").arg(&me_as_linker) + .arg("--out-dir").arg(&tmpdir) + .env("YOU_ARE_A_LINKER", "1") + .output() + .unwrap(); + + if !output.status.success() { + let stderr = String::from_utf8_lossy(&output.stderr); + panic!("status: {}\nstdout:\n{}\nstderr:\n{}", + output.status, + String::from_utf8_lossy(&output.stdout), + stderr.lines().map(|l| { + if l.len() > 200 { + format!("{}...\n", &l[..200]) + } else { + format!("{}\n", l) + } + }).collect::()); + } + + if !ok.exists() { + continue + } + + let linker_args = read_linker_args(&ok); + for arg in linker_args.split('S') { + expected_libs.remove(arg); + } + + assert!( + expected_libs.is_empty(), + "expected but missing libraries: {:#?}\nlinker arguments: \n{}", + expected_libs, + linker_args, + ); + + break + } +} diff --git a/tests/run-make/longjmp-across-rust/Makefile b/tests/run-make/longjmp-across-rust/Makefile new file mode 100644 index 00000000000..848638d82dd --- /dev/null +++ b/tests/run-make/longjmp-across-rust/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,foo) + $(RUSTC) main.rs + $(call RUN,main) diff --git a/tests/run-make/longjmp-across-rust/foo.c b/tests/run-make/longjmp-across-rust/foo.c new file mode 100644 index 00000000000..bd71cc4d777 --- /dev/null +++ b/tests/run-make/longjmp-across-rust/foo.c @@ -0,0 +1,18 @@ +#include +#include + +static jmp_buf ENV; + +extern void test_middle(); + +void test_start(void(*f)()) { + if (setjmp(ENV) != 0) + return; + f(); + assert(0); +} + +void test_end() { + longjmp(ENV, 1); + assert(0); +} diff --git a/tests/run-make/longjmp-across-rust/main.rs b/tests/run-make/longjmp-across-rust/main.rs new file mode 100644 index 00000000000..cc1d5b126dd --- /dev/null +++ b/tests/run-make/longjmp-across-rust/main.rs @@ -0,0 +1,29 @@ +#[link(name = "foo", kind = "static")] +extern "C" { + fn test_start(f: extern "C" fn()); + fn test_end(); +} + +fn main() { + unsafe { + test_start(test_middle); + } +} + +struct A; + +impl Drop for A { + fn drop(&mut self) {} +} + +extern "C" fn test_middle() { + let _a = A; + foo(); +} + +fn foo() { + let _a = A; + unsafe { + test_end(); + } +} diff --git a/tests/run-make/ls-metadata/Makefile b/tests/run-make/ls-metadata/Makefile new file mode 100644 index 00000000000..e0f916a248e --- /dev/null +++ b/tests/run-make/ls-metadata/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs + $(RUSTC) -Z ls $(TMPDIR)/foo + touch $(TMPDIR)/bar + $(RUSTC) -Z ls $(TMPDIR)/bar diff --git a/tests/run-make/ls-metadata/foo.rs b/tests/run-make/ls-metadata/foo.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/ls-metadata/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/lto-dylib-dep/Makefile b/tests/run-make/lto-dylib-dep/Makefile new file mode 100644 index 00000000000..41487b23c74 --- /dev/null +++ b/tests/run-make/lto-dylib-dep/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +# Test that we don't run into an assertion when using a Rust dylib dependency +# while compiling with full LTO. +# See https://github.com/rust-lang/rust/issues/59137 + +all: + $(RUSTC) a_dylib.rs --crate-type=dylib -C prefer-dynamic + $(RUSTC) main.rs -C lto + $(call RUN,main) diff --git a/tests/run-make/lto-dylib-dep/a_dylib.rs b/tests/run-make/lto-dylib-dep/a_dylib.rs new file mode 100644 index 00000000000..e63457e6eb9 --- /dev/null +++ b/tests/run-make/lto-dylib-dep/a_dylib.rs @@ -0,0 +1,3 @@ +pub fn foo() { + println!("bar"); +} diff --git a/tests/run-make/lto-dylib-dep/main.rs b/tests/run-make/lto-dylib-dep/main.rs new file mode 100644 index 00000000000..4fb3c4730b2 --- /dev/null +++ b/tests/run-make/lto-dylib-dep/main.rs @@ -0,0 +1,5 @@ +extern crate a_dylib; + +fn main() { + a_dylib::foo(); +} diff --git a/tests/run-make/lto-empty/Makefile b/tests/run-make/lto-empty/Makefile new file mode 100644 index 00000000000..b4345ba1883 --- /dev/null +++ b/tests/run-make/lto-empty/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +all: cdylib-fat cdylib-thin + +cdylib-fat: + $(RUSTC) lib.rs -C lto=fat -C opt-level=3 -C incremental=$(TMPDIR)/inc-fat + $(RUSTC) lib.rs -C lto=fat -C opt-level=3 -C incremental=$(TMPDIR)/inc-fat + +cdylib-thin: + $(RUSTC) lib.rs -C lto=thin -C opt-level=3 -C incremental=$(TMPDIR)/inc-thin + $(RUSTC) lib.rs -C lto=thin -C opt-level=3 -C incremental=$(TMPDIR)/inc-thin + diff --git a/tests/run-make/lto-empty/lib.rs b/tests/run-make/lto-empty/lib.rs new file mode 100644 index 00000000000..e3663c79078 --- /dev/null +++ b/tests/run-make/lto-empty/lib.rs @@ -0,0 +1 @@ +#![crate_type = "cdylib"] diff --git a/tests/run-make/lto-no-link-whole-rlib/Makefile b/tests/run-make/lto-no-link-whole-rlib/Makefile new file mode 100644 index 00000000000..e576ee37cf7 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar) + $(RUSTC) lib1.rs + $(RUSTC) lib2.rs + $(RUSTC) main.rs -Clto + $(call RUN,main) + diff --git a/tests/run-make/lto-no-link-whole-rlib/bar.c b/tests/run-make/lto-no-link-whole-rlib/bar.c new file mode 100644 index 00000000000..b2501193029 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/bar.c @@ -0,0 +1,3 @@ +int foo() { + return 2; +} diff --git a/tests/run-make/lto-no-link-whole-rlib/foo.c b/tests/run-make/lto-no-link-whole-rlib/foo.c new file mode 100644 index 00000000000..75010458ece --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/foo.c @@ -0,0 +1,3 @@ +int foo() { + return 1; +} diff --git a/tests/run-make/lto-no-link-whole-rlib/lib1.rs b/tests/run-make/lto-no-link-whole-rlib/lib1.rs new file mode 100644 index 00000000000..f70bb338223 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/lib1.rs @@ -0,0 +1,10 @@ +#![crate_type = "rlib"] + +#[link(name = "foo", kind = "static")] +extern "C" { + fn foo() -> i32; +} + +pub fn foo1() -> i32 { + unsafe { foo() } +} diff --git a/tests/run-make/lto-no-link-whole-rlib/lib2.rs b/tests/run-make/lto-no-link-whole-rlib/lib2.rs new file mode 100644 index 00000000000..2dec2a2718e --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/lib2.rs @@ -0,0 +1,12 @@ +#![crate_type = "rlib"] + +extern crate lib1; + +#[link(name = "bar", kind = "static")] +extern "C" { + fn foo() -> i32; +} + +pub fn foo2() -> i32 { + unsafe { foo() } +} diff --git a/tests/run-make/lto-no-link-whole-rlib/main.rs b/tests/run-make/lto-no-link-whole-rlib/main.rs new file mode 100644 index 00000000000..0c658808e6e --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/main.rs @@ -0,0 +1,7 @@ +extern crate lib1; +extern crate lib2; + +fn main() { + assert_eq!(lib1::foo1(), 2); + assert_eq!(lib2::foo2(), 2); +} diff --git a/tests/run-make/lto-readonly-lib/Makefile b/tests/run-make/lto-readonly-lib/Makefile new file mode 100644 index 00000000000..a20ecea88ea --- /dev/null +++ b/tests/run-make/lto-readonly-lib/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +all: + $(RUSTC) lib.rs + + # the compiler needs to copy and modify the rlib file when performing + # LTO, so we should ensure that it can cope with the original rlib + # being read-only. + chmod 444 $(TMPDIR)/*.rlib + + $(RUSTC) main.rs -C lto + $(call RUN,main) diff --git a/tests/run-make/lto-readonly-lib/lib.rs b/tests/run-make/lto-readonly-lib/lib.rs new file mode 100644 index 00000000000..c1bfaa6cab5 --- /dev/null +++ b/tests/run-make/lto-readonly-lib/lib.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/lto-readonly-lib/main.rs b/tests/run-make/lto-readonly-lib/main.rs new file mode 100644 index 00000000000..69da798b3eb --- /dev/null +++ b/tests/run-make/lto-readonly-lib/main.rs @@ -0,0 +1,3 @@ +extern crate lib; + +fn main() {} diff --git a/tests/run-make/lto-smoke-c/Makefile b/tests/run-make/lto-smoke-c/Makefile new file mode 100644 index 00000000000..7c6ee3be849 --- /dev/null +++ b/tests/run-make/lto-smoke-c/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +# Apparently older versions of GCC segfault if -g is passed... +CC := $(CC:-g=) + +all: + $(RUSTC) foo.rs -C lto + $(CC) bar.c $(call STATICLIB,foo) \ + $(call OUT_EXE,bar) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + $(call RUN,bar) diff --git a/tests/run-make/lto-smoke-c/bar.c b/tests/run-make/lto-smoke-c/bar.c new file mode 100644 index 00000000000..bb4036b06e1 --- /dev/null +++ b/tests/run-make/lto-smoke-c/bar.c @@ -0,0 +1,6 @@ +void foo(); + +int main() { + foo(); + return 0; +} diff --git a/tests/run-make/lto-smoke-c/foo.rs b/tests/run-make/lto-smoke-c/foo.rs new file mode 100644 index 00000000000..2e59432cdb1 --- /dev/null +++ b/tests/run-make/lto-smoke-c/foo.rs @@ -0,0 +1,4 @@ +#![crate_type = "staticlib"] + +#[no_mangle] +pub extern "C" fn foo() {} diff --git a/tests/run-make/lto-smoke/Makefile b/tests/run-make/lto-smoke/Makefile new file mode 100644 index 00000000000..8bce708b44b --- /dev/null +++ b/tests/run-make/lto-smoke/Makefile @@ -0,0 +1,30 @@ +include ../tools.mk + +all: noparam bool_true bool_false thin fat + +noparam: + $(RUSTC) lib.rs + $(RUSTC) main.rs -C lto + $(call RUN,main) + +bool_true: + $(RUSTC) lib.rs + $(RUSTC) main.rs -C lto=yes + $(call RUN,main) + + +bool_false: + $(RUSTC) lib.rs + $(RUSTC) main.rs -C lto=off + $(call RUN,main) + +thin: + $(RUSTC) lib.rs + $(RUSTC) main.rs -C lto=thin + $(call RUN,main) + +fat: + $(RUSTC) lib.rs + $(RUSTC) main.rs -C lto=fat + $(call RUN,main) + diff --git a/tests/run-make/lto-smoke/lib.rs b/tests/run-make/lto-smoke/lib.rs new file mode 100644 index 00000000000..c1bfaa6cab5 --- /dev/null +++ b/tests/run-make/lto-smoke/lib.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/lto-smoke/main.rs b/tests/run-make/lto-smoke/main.rs new file mode 100644 index 00000000000..69da798b3eb --- /dev/null +++ b/tests/run-make/lto-smoke/main.rs @@ -0,0 +1,3 @@ +extern crate lib; + +fn main() {} diff --git a/tests/run-make/manual-crate-name/Makefile b/tests/run-make/manual-crate-name/Makefile new file mode 100644 index 00000000000..c00e20c7c57 --- /dev/null +++ b/tests/run-make/manual-crate-name/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) --crate-name foo bar.rs + rm $(TMPDIR)/libfoo.rlib diff --git a/tests/run-make/manual-crate-name/bar.rs b/tests/run-make/manual-crate-name/bar.rs new file mode 100644 index 00000000000..c1bfaa6cab5 --- /dev/null +++ b/tests/run-make/manual-crate-name/bar.rs @@ -0,0 +1 @@ +#![crate_type = "rlib"] diff --git a/tests/run-make/manual-link/Makefile b/tests/run-make/manual-link/Makefile new file mode 100644 index 00000000000..401f6eb440a --- /dev/null +++ b/tests/run-make/manual-link/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: $(TMPDIR)/libbar.a + $(RUSTC) foo.rs -lstatic=bar + $(RUSTC) main.rs + $(call RUN,main) diff --git a/tests/run-make/manual-link/bar.c b/tests/run-make/manual-link/bar.c new file mode 100644 index 00000000000..e4259998678 --- /dev/null +++ b/tests/run-make/manual-link/bar.c @@ -0,0 +1 @@ +void bar() {} diff --git a/tests/run-make/manual-link/foo.c b/tests/run-make/manual-link/foo.c new file mode 100644 index 00000000000..e4259998678 --- /dev/null +++ b/tests/run-make/manual-link/foo.c @@ -0,0 +1 @@ +void bar() {} diff --git a/tests/run-make/manual-link/foo.rs b/tests/run-make/manual-link/foo.rs new file mode 100644 index 00000000000..c1f28236ffd --- /dev/null +++ b/tests/run-make/manual-link/foo.rs @@ -0,0 +1,11 @@ +#![crate_type = "rlib"] + +extern "C" { + fn bar(); +} + +pub fn foo() { + unsafe { + bar(); + } +} diff --git a/tests/run-make/manual-link/main.rs b/tests/run-make/manual-link/main.rs new file mode 100644 index 00000000000..fe35f1f8e2e --- /dev/null +++ b/tests/run-make/manual-link/main.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::foo(); +} diff --git a/tests/run-make/many-crates-but-no-match/Makefile b/tests/run-make/many-crates-but-no-match/Makefile new file mode 100644 index 00000000000..ca0ab8e9e5f --- /dev/null +++ b/tests/run-make/many-crates-but-no-match/Makefile @@ -0,0 +1,35 @@ +include ../tools.mk + +# Modelled after ui/changing-crates.rs test, but this one puts +# more than one (mismatching) candidate crate into the search path, +# which did not appear directly expressible in UI testing infrastructure. +# +# Note that we move the built libraries into target direcrtories rather than +# use the `--out-dir` option because the `../tools.mk` file already bakes a +# use of `--out-dir` into the definition of $(RUSTC). + +A1=$(TMPDIR)/a1 +A2=$(TMPDIR)/a2 +A3=$(TMPDIR)/a3 + +# A hack to match distinct lines of output from a single run. +LOG=$(TMPDIR)/log.txt + +all: + mkdir -p $(A1) $(A2) $(A3) + $(RUSTC) --crate-type=rlib crateA1.rs + mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A1) + $(RUSTC) --crate-type=rlib -L $(A1) crateB.rs + $(RUSTC) --crate-type=rlib crateA2.rs + mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A2) + $(RUSTC) --crate-type=rlib crateA3.rs + mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A3) + # Ensure crateC fails to compile since A1 is "missing" and A2/A3 hashes do not match + $(RUSTC) -L $(A2) -L $(A3) crateC.rs >$(LOG) 2>&1 || true + $(CGREP) \ + 'found possibly newer version of crate `crateA` which `crateB` depends on' \ + 'note: perhaps that crate needs to be recompiled?' \ + 'crate `crateA`:' \ + 'crate `crateB`:' \ + < $(LOG) + # the 'crate `crateA`' will match two entries. diff --git a/tests/run-make/many-crates-but-no-match/crateA1.rs b/tests/run-make/many-crates-but-no-match/crateA1.rs new file mode 100644 index 00000000000..3fed5a38e2c --- /dev/null +++ b/tests/run-make/many-crates-but-no-match/crateA1.rs @@ -0,0 +1,4 @@ +#![crate_name="crateA"] + +// Base crate +pub fn func() {} diff --git a/tests/run-make/many-crates-but-no-match/crateA2.rs b/tests/run-make/many-crates-but-no-match/crateA2.rs new file mode 100644 index 00000000000..8db07a015ff --- /dev/null +++ b/tests/run-make/many-crates-but-no-match/crateA2.rs @@ -0,0 +1,4 @@ +#![crate_name="crateA"] + +// Base crate +pub fn func() { println!("hello"); } diff --git a/tests/run-make/many-crates-but-no-match/crateA3.rs b/tests/run-make/many-crates-but-no-match/crateA3.rs new file mode 100644 index 00000000000..a1e8e40a38c --- /dev/null +++ b/tests/run-make/many-crates-but-no-match/crateA3.rs @@ -0,0 +1,4 @@ +#![crate_name="crateA"] + +// Base crate +pub fn foo() { println!("world!"); } diff --git a/tests/run-make/many-crates-but-no-match/crateB.rs b/tests/run-make/many-crates-but-no-match/crateB.rs new file mode 100644 index 00000000000..4ccd65d653e --- /dev/null +++ b/tests/run-make/many-crates-but-no-match/crateB.rs @@ -0,0 +1 @@ +extern crate crateA; diff --git a/tests/run-make/many-crates-but-no-match/crateC.rs b/tests/run-make/many-crates-but-no-match/crateC.rs new file mode 100644 index 00000000000..a8b817ec681 --- /dev/null +++ b/tests/run-make/many-crates-but-no-match/crateC.rs @@ -0,0 +1,3 @@ +extern crate crateB; + +fn main() {} diff --git a/tests/run-make/metadata-flag-frobs-symbols/Makefile b/tests/run-make/metadata-flag-frobs-symbols/Makefile new file mode 100644 index 00000000000..dc6b10f4e9d --- /dev/null +++ b/tests/run-make/metadata-flag-frobs-symbols/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs -C metadata=a -C extra-filename=-a + $(RUSTC) foo.rs -C metadata=b -C extra-filename=-b + $(RUSTC) bar.rs \ + --extern foo1=$(TMPDIR)/libfoo-a.rlib \ + --extern foo2=$(TMPDIR)/libfoo-b.rlib \ + --print link-args + $(call RUN,bar) diff --git a/tests/run-make/metadata-flag-frobs-symbols/bar.rs b/tests/run-make/metadata-flag-frobs-symbols/bar.rs new file mode 100644 index 00000000000..1e6957a3694 --- /dev/null +++ b/tests/run-make/metadata-flag-frobs-symbols/bar.rs @@ -0,0 +1,8 @@ +extern crate foo1; +extern crate foo2; + +fn main() { + let a = foo1::foo(); + let b = foo2::foo(); + assert!(a as *const _ != b as *const _); +} diff --git a/tests/run-make/metadata-flag-frobs-symbols/foo.rs b/tests/run-make/metadata-flag-frobs-symbols/foo.rs new file mode 100644 index 00000000000..696aed2fa1d --- /dev/null +++ b/tests/run-make/metadata-flag-frobs-symbols/foo.rs @@ -0,0 +1,6 @@ +#![crate_name = "foo"] +#![crate_type = "rlib"] + +static FOO: usize = 3; + +pub fn foo() -> &'static usize { &FOO } diff --git a/tests/run-make/min-global-align/Makefile b/tests/run-make/min-global-align/Makefile new file mode 100644 index 00000000000..82f38749e00 --- /dev/null +++ b/tests/run-make/min-global-align/Makefile @@ -0,0 +1,22 @@ +include ../tools.mk + +# only-linux + +# This tests ensure that global variables respect the target minimum alignment. +# The three bools `STATIC_BOOL`, `STATIC_MUT_BOOL`, and `CONST_BOOL` all have +# type-alignment of 1, but some targets require greater global alignment. + +SRC = min_global_align.rs +LL = $(TMPDIR)/min_global_align.ll + +all: +# Most targets are happy with default alignment -- take i686 for example. +ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) + $(RUSTC) --target=i686-unknown-linux-gnu --emit=llvm-ir $(SRC) + [ "$$(grep -c 'align 1' "$(LL)")" -eq "3" ] +endif +# SystemZ requires even alignment for PC-relative addressing. +ifeq ($(filter systemz,$(LLVM_COMPONENTS)),systemz) + $(RUSTC) --target=s390x-unknown-linux-gnu --emit=llvm-ir $(SRC) + [ "$$(grep -c 'align 2' "$(LL)")" -eq "3" ] +endif diff --git a/tests/run-make/min-global-align/min_global_align.rs b/tests/run-make/min-global-align/min_global_align.rs new file mode 100644 index 00000000000..135792e9372 --- /dev/null +++ b/tests/run-make/min-global-align/min_global_align.rs @@ -0,0 +1,32 @@ +#![feature(no_core, lang_items)] +#![crate_type = "rlib"] +#![no_core] + +pub static STATIC_BOOL: bool = true; + +pub static mut STATIC_MUT_BOOL: bool = true; + +const CONST_BOOL: bool = true; +pub static CONST_BOOL_REF: &'static bool = &CONST_BOOL; + +#[lang = "sized"] +trait Sized {} + +#[lang = "copy"] +trait Copy {} +impl Copy for bool {} +impl Copy for &bool {} + +#[lang = "freeze"] +trait Freeze {} + +// No `UnsafeCell`, so everything is `Freeze`. +impl Freeze for T {} + +#[lang = "sync"] +trait Sync {} +impl Sync for bool {} +impl Sync for &'static bool {} + +#[lang = "drop_in_place"] +pub unsafe fn drop_in_place(_: *mut T) {} diff --git a/tests/run-make/mingw-export-call-convention/Makefile b/tests/run-make/mingw-export-call-convention/Makefile new file mode 100644 index 00000000000..4a60059cc54 --- /dev/null +++ b/tests/run-make/mingw-export-call-convention/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# only-windows-gnu + +all: + $(RUSTC) foo.rs + # FIXME: we should make sure __stdcall calling convention is used here + # but that only works with LLD right now + nm -g "$(call IMPLIB,foo)" | $(CGREP) bar diff --git a/tests/run-make/mingw-export-call-convention/foo.rs b/tests/run-make/mingw-export-call-convention/foo.rs new file mode 100644 index 00000000000..1fec00311ef --- /dev/null +++ b/tests/run-make/mingw-export-call-convention/foo.rs @@ -0,0 +1,4 @@ +#![crate_type = "cdylib"] + +#[no_mangle] +pub extern "system" fn bar() {} diff --git a/tests/run-make/mismatching-target-triples/Makefile b/tests/run-make/mismatching-target-triples/Makefile new file mode 100644 index 00000000000..409388e0414 --- /dev/null +++ b/tests/run-make/mismatching-target-triples/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +# Issue #10814 +# +# these are no_std to avoid having to have the standard library or any +# linkers/assemblers for the relevant platform + +all: + $(RUSTC) foo.rs --target=i686-unknown-linux-gnu + $(RUSTC) bar.rs --target=x86_64-unknown-linux-gnu 2>&1 \ + | $(CGREP) 'couldn'"'"'t find crate `foo` with expected target triple x86_64-unknown-linux-gnu' diff --git a/tests/run-make/mismatching-target-triples/bar.rs b/tests/run-make/mismatching-target-triples/bar.rs new file mode 100644 index 00000000000..b2c2fc1c410 --- /dev/null +++ b/tests/run-make/mismatching-target-triples/bar.rs @@ -0,0 +1,3 @@ +#![feature(no_core)] +#![no_core] +extern crate foo; diff --git a/tests/run-make/mismatching-target-triples/foo.rs b/tests/run-make/mismatching-target-triples/foo.rs new file mode 100644 index 00000000000..6fa05491448 --- /dev/null +++ b/tests/run-make/mismatching-target-triples/foo.rs @@ -0,0 +1,3 @@ +#![feature(no_core)] +#![no_core] +#![crate_type = "lib"] diff --git a/tests/run-make/missing-crate-dependency/Makefile b/tests/run-make/missing-crate-dependency/Makefile new file mode 100644 index 00000000000..7c271ab8a90 --- /dev/null +++ b/tests/run-make/missing-crate-dependency/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +all: + $(RUSTC) --crate-type=rlib crateA.rs + $(RUSTC) --crate-type=rlib crateB.rs + $(call REMOVE_RLIBS,crateA) + # Ensure crateC fails to compile since dependency crateA is missing + $(RUSTC) crateC.rs 2>&1 | \ + $(CGREP) 'can'"'"'t find crate for `crateA` which `crateB` depends on' diff --git a/tests/run-make/missing-crate-dependency/crateA.rs b/tests/run-make/missing-crate-dependency/crateA.rs new file mode 100644 index 00000000000..31433cb60b8 --- /dev/null +++ b/tests/run-make/missing-crate-dependency/crateA.rs @@ -0,0 +1,2 @@ +// Base crate +pub fn func() {} diff --git a/tests/run-make/missing-crate-dependency/crateB.rs b/tests/run-make/missing-crate-dependency/crateB.rs new file mode 100644 index 00000000000..4ccd65d653e --- /dev/null +++ b/tests/run-make/missing-crate-dependency/crateB.rs @@ -0,0 +1 @@ +extern crate crateA; diff --git a/tests/run-make/missing-crate-dependency/crateC.rs b/tests/run-make/missing-crate-dependency/crateC.rs new file mode 100644 index 00000000000..a8b817ec681 --- /dev/null +++ b/tests/run-make/missing-crate-dependency/crateC.rs @@ -0,0 +1,3 @@ +extern crate crateB; + +fn main() {} diff --git a/tests/run-make/mixing-deps/Makefile b/tests/run-make/mixing-deps/Makefile new file mode 100644 index 00000000000..956e704ee16 --- /dev/null +++ b/tests/run-make/mixing-deps/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) both.rs -C prefer-dynamic + $(RUSTC) dylib.rs -C prefer-dynamic + $(RUSTC) prog.rs + $(call RUN,prog) diff --git a/tests/run-make/mixing-deps/both.rs b/tests/run-make/mixing-deps/both.rs new file mode 100644 index 00000000000..6a58187633f --- /dev/null +++ b/tests/run-make/mixing-deps/both.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] +#![crate_type = "dylib"] + +pub static foo: isize = 4; diff --git a/tests/run-make/mixing-deps/dylib.rs b/tests/run-make/mixing-deps/dylib.rs new file mode 100644 index 00000000000..88976d5b663 --- /dev/null +++ b/tests/run-make/mixing-deps/dylib.rs @@ -0,0 +1,6 @@ +#![crate_type = "dylib"] +extern crate both; + +use std::mem; + +pub fn addr() -> usize { unsafe { mem::transmute(&both::foo) } } diff --git a/tests/run-make/mixing-deps/prog.rs b/tests/run-make/mixing-deps/prog.rs new file mode 100644 index 00000000000..188981dc1a3 --- /dev/null +++ b/tests/run-make/mixing-deps/prog.rs @@ -0,0 +1,9 @@ +extern crate dylib; +extern crate both; + +use std::mem; + +fn main() { + assert_eq!(unsafe { mem::transmute::<&isize, usize>(&both::foo) }, + dylib::addr()); +} diff --git a/tests/run-make/mixing-formats/Makefile b/tests/run-make/mixing-formats/Makefile new file mode 100644 index 00000000000..b27e54257f9 --- /dev/null +++ b/tests/run-make/mixing-formats/Makefile @@ -0,0 +1,74 @@ +include ../tools.mk + +# Testing various mixings of rlibs and dylibs. Makes sure that it's possible to +# link an rlib to a dylib. The dependency tree among the file looks like: +# +# foo +# / \ +# bar1 bar2 +# / \ / +# baz baz2 +# +# This is generally testing the permutations of the foo/bar1/bar2 layer against +# the baz/baz2 layer + +all: + # Building just baz + $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib,rlib baz.rs -C prefer-dynamic + $(RUSTC) --crate-type=bin baz.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic + $(RUSTC) --crate-type=rlib bar1.rs + $(RUSTC) --crate-type=dylib,rlib baz.rs -C prefer-dynamic + $(RUSTC) --crate-type=bin baz.rs + rm $(TMPDIR)/* + # Building baz2 + $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib baz2.rs && exit 1 || exit 0 + $(RUSTC) --crate-type=bin baz2.rs && exit 1 || exit 0 + rm $(TMPDIR)/* + $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=rlib bar1.rs + $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib,rlib baz2.rs + $(RUSTC) --crate-type=bin baz2.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic + $(RUSTC) --crate-type=rlib bar2.rs + $(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic + $(RUSTC) --crate-type=bin baz2.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=rlib foo.rs + $(RUSTC) --crate-type=rlib bar1.rs + $(RUSTC) --crate-type=rlib bar2.rs + $(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic + $(RUSTC) --crate-type=bin baz2.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic + $(RUSTC) --crate-type=rlib bar1.rs + $(RUSTC) --crate-type=rlib bar2.rs + $(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic + $(RUSTC) --crate-type=bin baz2.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic + $(RUSTC) --crate-type=rlib bar2.rs + $(RUSTC) --crate-type=dylib,rlib baz2.rs + $(RUSTC) --crate-type=bin baz2.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic + $(RUSTC) --crate-type=rlib bar1.rs + $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib,rlib baz2.rs + $(RUSTC) --crate-type=bin baz2.rs + rm $(TMPDIR)/* + $(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic + $(RUSTC) --crate-type=dylib,rlib baz2.rs + $(RUSTC) --crate-type=bin baz2.rs diff --git a/tests/run-make/mixing-formats/bar1.rs b/tests/run-make/mixing-formats/bar1.rs new file mode 100644 index 00000000000..49af74e1b74 --- /dev/null +++ b/tests/run-make/mixing-formats/bar1.rs @@ -0,0 +1 @@ +extern crate foo; diff --git a/tests/run-make/mixing-formats/bar2.rs b/tests/run-make/mixing-formats/bar2.rs new file mode 100644 index 00000000000..49af74e1b74 --- /dev/null +++ b/tests/run-make/mixing-formats/bar2.rs @@ -0,0 +1 @@ +extern crate foo; diff --git a/tests/run-make/mixing-formats/baz.rs b/tests/run-make/mixing-formats/baz.rs new file mode 100644 index 00000000000..99a73159ea4 --- /dev/null +++ b/tests/run-make/mixing-formats/baz.rs @@ -0,0 +1,3 @@ +extern crate bar1; + +fn main() {} diff --git a/tests/run-make/mixing-formats/baz2.rs b/tests/run-make/mixing-formats/baz2.rs new file mode 100644 index 00000000000..d0fab1e4cdf --- /dev/null +++ b/tests/run-make/mixing-formats/baz2.rs @@ -0,0 +1,4 @@ +extern crate bar1; +extern crate bar2; + +fn main() {} diff --git a/tests/run-make/mixing-formats/foo.rs b/tests/run-make/mixing-formats/foo.rs new file mode 100644 index 00000000000..d11c69f812a --- /dev/null +++ b/tests/run-make/mixing-formats/foo.rs @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/run-make/mixing-libs/Makefile b/tests/run-make/mixing-libs/Makefile new file mode 100644 index 00000000000..39cc0708ca1 --- /dev/null +++ b/tests/run-make/mixing-libs/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +all: + $(RUSTC) rlib.rs + $(RUSTC) dylib.rs + $(RUSTC) rlib.rs --crate-type=dylib + $(RUSTC) dylib.rs + $(call REMOVE_DYLIBS,rlib) + $(RUSTC) prog.rs && exit 1 || exit 0 diff --git a/tests/run-make/mixing-libs/dylib.rs b/tests/run-make/mixing-libs/dylib.rs new file mode 100644 index 00000000000..6856887501c --- /dev/null +++ b/tests/run-make/mixing-libs/dylib.rs @@ -0,0 +1,4 @@ +#![crate_type = "dylib"] +extern crate rlib; + +pub fn dylib() { rlib::rlib() } diff --git a/tests/run-make/mixing-libs/prog.rs b/tests/run-make/mixing-libs/prog.rs new file mode 100644 index 00000000000..14ce5c951a7 --- /dev/null +++ b/tests/run-make/mixing-libs/prog.rs @@ -0,0 +1,7 @@ +extern crate dylib; +extern crate rlib; + +fn main() { + dylib::dylib(); + rlib::rlib(); +} diff --git a/tests/run-make/mixing-libs/rlib.rs b/tests/run-make/mixing-libs/rlib.rs new file mode 100644 index 00000000000..96dcd16bb93 --- /dev/null +++ b/tests/run-make/mixing-libs/rlib.rs @@ -0,0 +1,2 @@ +#![crate_type = "rlib"] +pub fn rlib() {} diff --git a/tests/run-make/msvc-opt-minsize/Makefile b/tests/run-make/msvc-opt-minsize/Makefile new file mode 100644 index 00000000000..a5f019f244e --- /dev/null +++ b/tests/run-make/msvc-opt-minsize/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs -Copt-level=z 2>&1 + $(call RUN,foo) diff --git a/tests/run-make/msvc-opt-minsize/foo.rs b/tests/run-make/msvc-opt-minsize/foo.rs new file mode 100644 index 00000000000..3f5496c08ee --- /dev/null +++ b/tests/run-make/msvc-opt-minsize/foo.rs @@ -0,0 +1,19 @@ +#![feature(test)] +extern crate test; + +fn foo(x: i32, y: i32) -> i64 { + (x + y) as i64 +} + +#[inline(never)] +fn bar() { + let _f = Box::new(0); + // This call used to trigger an LLVM bug in opt-level z where the base + // pointer gets corrupted, see issue #45034 + let y: fn(i32, i32) -> i64 = test::black_box(foo); + test::black_box(y(1, 2)); +} + +fn main() { + bar(); +} diff --git a/tests/run-make/multiple-emits/Makefile b/tests/run-make/multiple-emits/Makefile new file mode 100644 index 00000000000..d1f29764485 --- /dev/null +++ b/tests/run-make/multiple-emits/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs --emit=asm,llvm-ir -o $(TMPDIR)/out 2>&1 + rm $(TMPDIR)/out.ll $(TMPDIR)/out.s + $(RUSTC) foo.rs --emit=asm,llvm-ir -o $(TMPDIR)/out2.ext 2>&1 + rm $(TMPDIR)/out2.ll $(TMPDIR)/out2.s diff --git a/tests/run-make/multiple-emits/foo.rs b/tests/run-make/multiple-emits/foo.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/multiple-emits/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/no-builtins-lto/Makefile b/tests/run-make/no-builtins-lto/Makefile new file mode 100644 index 00000000000..c8f05d9918b --- /dev/null +++ b/tests/run-make/no-builtins-lto/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +all: + # Compile a `#![no_builtins]` rlib crate + $(RUSTC) no_builtins.rs + # Build an executable that depends on that crate using LTO. The no_builtins crate doesn't + # participate in LTO, so its rlib must be explicitly linked into the final binary. Verify this by + # grepping the linker arguments. + $(RUSTC) main.rs -C lto --print link-args | $(CGREP) 'libno_builtins.rlib' diff --git a/tests/run-make/no-builtins-lto/main.rs b/tests/run-make/no-builtins-lto/main.rs new file mode 100644 index 00000000000..890c999c8cc --- /dev/null +++ b/tests/run-make/no-builtins-lto/main.rs @@ -0,0 +1,3 @@ +extern crate no_builtins; + +fn main() {} diff --git a/tests/run-make/no-builtins-lto/no_builtins.rs b/tests/run-make/no-builtins-lto/no_builtins.rs new file mode 100644 index 00000000000..5d001031a57 --- /dev/null +++ b/tests/run-make/no-builtins-lto/no_builtins.rs @@ -0,0 +1,2 @@ +#![crate_type = "lib"] +#![no_builtins] diff --git a/tests/run-make/no-duplicate-libs/Makefile b/tests/run-make/no-duplicate-libs/Makefile new file mode 100644 index 00000000000..b05aff7826e --- /dev/null +++ b/tests/run-make/no-duplicate-libs/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +ifdef IS_MSVC +# FIXME(#27979) +all: +else +all: $(call STATICLIB,foo) $(call STATICLIB,bar) + $(RUSTC) main.rs + $(call RUN,main) +endif diff --git a/tests/run-make/no-duplicate-libs/bar.c b/tests/run-make/no-duplicate-libs/bar.c new file mode 100644 index 00000000000..e369526572d --- /dev/null +++ b/tests/run-make/no-duplicate-libs/bar.c @@ -0,0 +1,5 @@ +extern void foo(); + +void bar() { + foo(); +} diff --git a/tests/run-make/no-duplicate-libs/foo.c b/tests/run-make/no-duplicate-libs/foo.c new file mode 100644 index 00000000000..85e6cd8c390 --- /dev/null +++ b/tests/run-make/no-duplicate-libs/foo.c @@ -0,0 +1 @@ +void foo() {} diff --git a/tests/run-make/no-duplicate-libs/main.rs b/tests/run-make/no-duplicate-libs/main.rs new file mode 100644 index 00000000000..b25ef35ada6 --- /dev/null +++ b/tests/run-make/no-duplicate-libs/main.rs @@ -0,0 +1,10 @@ +#[link(name = "foo")] // linker should drop this library, no symbols used +#[link(name = "bar")] // symbol comes from this library +#[link(name = "foo")] // now linker picks up `foo` b/c `bar` library needs it +extern "C" { + fn bar(); +} + +fn main() { + unsafe { bar() } +} diff --git a/tests/run-make/no-intermediate-extras/Makefile b/tests/run-make/no-intermediate-extras/Makefile new file mode 100644 index 00000000000..4116aac1b8f --- /dev/null +++ b/tests/run-make/no-intermediate-extras/Makefile @@ -0,0 +1,7 @@ +# Regression test for issue #10973 + +include ../tools.mk + +all: + $(RUSTC) --crate-type=rlib --test foo.rs + rm $(TMPDIR)/foo.bc && exit 1 || exit 0 diff --git a/tests/run-make/no-intermediate-extras/foo.rs b/tests/run-make/no-intermediate-extras/foo.rs new file mode 100644 index 00000000000..d11c69f812a --- /dev/null +++ b/tests/run-make/no-intermediate-extras/foo.rs @@ -0,0 +1 @@ +// intentionally empty diff --git a/tests/run-make/obey-crate-type-flag/Makefile b/tests/run-make/obey-crate-type-flag/Makefile new file mode 100644 index 00000000000..effcfc94cc5 --- /dev/null +++ b/tests/run-make/obey-crate-type-flag/Makefile @@ -0,0 +1,13 @@ +include ../tools.mk + +# check that rustc builds all crate_type attributes +# delete rlib +# delete whatever dylib is made for this system +# check that rustc only builds --crate-type flags, ignoring attributes +# fail if an rlib was built +all: + $(RUSTC) test.rs + $(call REMOVE_RLIBS,test) + $(call REMOVE_DYLIBS,test) + $(RUSTC) --crate-type dylib test.rs + $(call REMOVE_RLIBS,test) && exit 1 || exit 0 diff --git a/tests/run-make/obey-crate-type-flag/test.rs b/tests/run-make/obey-crate-type-flag/test.rs new file mode 100644 index 00000000000..8a768f9de90 --- /dev/null +++ b/tests/run-make/obey-crate-type-flag/test.rs @@ -0,0 +1,2 @@ +#![crate_type = "rlib"] +#![crate_type = "dylib"] diff --git a/tests/run-make/output-filename-conflicts-with-directory/Makefile b/tests/run-make/output-filename-conflicts-with-directory/Makefile new file mode 100644 index 00000000000..45221356cd9 --- /dev/null +++ b/tests/run-make/output-filename-conflicts-with-directory/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + cp foo.rs $(TMPDIR)/foo.rs + mkdir $(TMPDIR)/foo + $(RUSTC) $(TMPDIR)/foo.rs -o $(TMPDIR)/foo 2>&1 \ + | $(CGREP) -e "the generated executable for the input file \".*foo\.rs\" conflicts with the existing directory \".*foo\"" diff --git a/tests/run-make/output-filename-conflicts-with-directory/foo.rs b/tests/run-make/output-filename-conflicts-with-directory/foo.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/output-filename-conflicts-with-directory/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/output-filename-overwrites-input/Makefile b/tests/run-make/output-filename-overwrites-input/Makefile new file mode 100644 index 00000000000..33069c06f5a --- /dev/null +++ b/tests/run-make/output-filename-overwrites-input/Makefile @@ -0,0 +1,13 @@ +include ../tools.mk + +all: + cp foo.rs $(TMPDIR)/foo + $(RUSTC) $(TMPDIR)/foo -o $(TMPDIR)/foo 2>&1 \ + | $(CGREP) -e "the input file \".*foo\" would be overwritten by the generated executable" + cp bar.rs $(TMPDIR)/bar.rlib + $(RUSTC) $(TMPDIR)/bar.rlib -o $(TMPDIR)/bar.rlib 2>&1 \ + | $(CGREP) -e "the input file \".*bar.rlib\" would be overwritten by the generated executable" + $(RUSTC) foo.rs 2>&1 && $(RUSTC) -Z ls $(TMPDIR)/foo 2>&1 + cp foo.rs $(TMPDIR)/foo.rs + $(RUSTC) $(TMPDIR)/foo.rs -o $(TMPDIR)/foo.rs 2>&1 \ + | $(CGREP) -e "the input file \".*foo.rs\" would be overwritten by the generated executable" diff --git a/tests/run-make/output-filename-overwrites-input/bar.rs b/tests/run-make/output-filename-overwrites-input/bar.rs new file mode 100644 index 00000000000..83be6e807e0 --- /dev/null +++ b/tests/run-make/output-filename-overwrites-input/bar.rs @@ -0,0 +1 @@ +#![crate_type = "lib"] diff --git a/tests/run-make/output-filename-overwrites-input/foo.rs b/tests/run-make/output-filename-overwrites-input/foo.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/output-filename-overwrites-input/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/output-type-permutations/Makefile b/tests/run-make/output-type-permutations/Makefile new file mode 100644 index 00000000000..791606c643b --- /dev/null +++ b/tests/run-make/output-type-permutations/Makefile @@ -0,0 +1,146 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs --crate-type=rlib,dylib,staticlib + $(call REMOVE_RLIBS,bar) + $(call REMOVE_DYLIBS,bar) + rm $(call STATICLIB,bar) + rm -f $(TMPDIR)/{lib,}bar.{dll.exp,dll.lib,pdb,dll.a} + # Check that $(TMPDIR) is empty. + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --crate-type=bin + rm $(TMPDIR)/$(call BIN,bar) + rm -f $(TMPDIR)/bar.pdb + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit=asm,llvm-ir,llvm-bc,obj,link + rm $(TMPDIR)/bar.ll + rm $(TMPDIR)/bar.bc + rm $(TMPDIR)/bar.s + rm $(TMPDIR)/bar.o + rm $(TMPDIR)/$(call BIN,bar) + rm -f $(TMPDIR)/bar.pdb + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit asm -o $(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit asm=$(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit=asm=$(TMPDIR)/foo + rm $(TMPDIR)/foo + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit llvm-bc -o $(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit llvm-bc=$(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit=llvm-bc=$(TMPDIR)/foo + rm $(TMPDIR)/foo + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit llvm-ir -o $(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit llvm-ir=$(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit=llvm-ir=$(TMPDIR)/foo + rm $(TMPDIR)/foo + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit obj -o $(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit obj=$(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --emit=obj=$(TMPDIR)/foo + rm $(TMPDIR)/foo + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit link -o $(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --emit link=$(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --emit=link=$(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + rm -f $(TMPDIR)/foo.pdb + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --crate-type=rlib -o $(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --crate-type=rlib --emit link=$(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --crate-type=rlib --emit=link=$(TMPDIR)/foo + rm $(TMPDIR)/foo + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --crate-type=dylib -o $(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --crate-type=dylib --emit link=$(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --crate-type=dylib --emit=link=$(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + rm -f $(TMPDIR)/{lib,}foo.{dll.exp,dll.lib,pdb,dll.a,exe.a} + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] || (ls -1 $(TMPDIR) && exit 1) + + $(RUSTC) foo.rs --crate-type=staticlib -o $(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --crate-type=staticlib --emit link=$(TMPDIR)/foo + rm $(TMPDIR)/foo + $(RUSTC) foo.rs --crate-type=staticlib --emit=link=$(TMPDIR)/foo + rm $(TMPDIR)/foo + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --crate-type=bin -o $(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --crate-type=bin --emit link=$(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + $(RUSTC) foo.rs --crate-type=bin --emit=link=$(TMPDIR)/$(call BIN,foo) + rm $(TMPDIR)/$(call BIN,foo) + rm -f $(TMPDIR)/foo.pdb + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit llvm-ir=$(TMPDIR)/ir \ + --emit link \ + --crate-type=rlib + rm $(TMPDIR)/ir + rm $(TMPDIR)/libbar.rlib + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit asm=$(TMPDIR)/asm \ + --emit llvm-ir=$(TMPDIR)/ir \ + --emit llvm-bc=$(TMPDIR)/bc \ + --emit obj=$(TMPDIR)/obj \ + --emit link=$(TMPDIR)/link \ + --crate-type=staticlib + rm $(TMPDIR)/asm + rm $(TMPDIR)/ir + rm $(TMPDIR)/bc + rm $(TMPDIR)/obj + rm $(TMPDIR)/link + $(RUSTC) foo.rs --emit=asm=$(TMPDIR)/asm \ + --emit llvm-ir=$(TMPDIR)/ir \ + --emit=llvm-bc=$(TMPDIR)/bc \ + --emit obj=$(TMPDIR)/obj \ + --emit=link=$(TMPDIR)/link \ + --crate-type=staticlib + rm $(TMPDIR)/asm + rm $(TMPDIR)/ir + rm $(TMPDIR)/bc + rm $(TMPDIR)/obj + rm $(TMPDIR)/link + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] + + $(RUSTC) foo.rs --emit=asm,llvm-ir,llvm-bc,obj,link --crate-type=staticlib + rm $(TMPDIR)/bar.ll + rm $(TMPDIR)/bar.s + rm $(TMPDIR)/bar.o + rm $(call STATICLIB,bar) + mv $(TMPDIR)/bar.bc $(TMPDIR)/foo.bc + # Don't check that the $(TMPDIR) is empty - we left `foo.bc` for later + # comparison. + + $(RUSTC) foo.rs --emit=llvm-bc,link --crate-type=rlib + cmp $(TMPDIR)/foo.bc $(TMPDIR)/bar.bc + rm $(TMPDIR)/bar.bc + rm $(TMPDIR)/foo.bc + $(call REMOVE_RLIBS,bar) + [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] diff --git a/tests/run-make/output-type-permutations/foo.rs b/tests/run-make/output-type-permutations/foo.rs new file mode 100644 index 00000000000..f0a2cc6ad75 --- /dev/null +++ b/tests/run-make/output-type-permutations/foo.rs @@ -0,0 +1,3 @@ +#![crate_name = "bar"] + +fn main() {} diff --git a/tests/run-make/output-with-hyphens/Makefile b/tests/run-make/output-with-hyphens/Makefile new file mode 100644 index 00000000000..365fb6e591a --- /dev/null +++ b/tests/run-make/output-with-hyphens/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) foo-bar.rs --crate-type bin + [ -f $(TMPDIR)/$(call BIN,foo-bar) ] + $(RUSTC) foo-bar.rs --crate-type lib + [ -f $(TMPDIR)/libfoo_bar.rlib ] diff --git a/tests/run-make/output-with-hyphens/foo-bar.rs b/tests/run-make/output-with-hyphens/foo-bar.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/output-with-hyphens/foo-bar.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/override-aliased-flags/Makefile b/tests/run-make/override-aliased-flags/Makefile new file mode 100644 index 00000000000..186b8c7c85e --- /dev/null +++ b/tests/run-make/override-aliased-flags/Makefile @@ -0,0 +1,22 @@ +include ../tools.mk + +# FIXME: it would be good to check that it's actually the rightmost flags +# that are used when multiple flags are specified, but I can't think of a +# reliable way to check this. + +all: + # Test that `-O` and `-C opt-level` can be specified multiple times. + # The rightmost flag will be used over any previous flags. + $(RUSTC) -O -O main.rs + $(RUSTC) -O -C opt-level=0 main.rs + $(RUSTC) -C opt-level=0 -O main.rs + $(RUSTC) -C opt-level=0 -C opt-level=2 main.rs + $(RUSTC) -C opt-level=2 -C opt-level=0 main.rs + + # Test that `-g` and `-C debuginfo` can be specified multiple times. + # The rightmost flag will be used over any previous flags. + $(RUSTC) -g -g main.rs + $(RUSTC) -g -C debuginfo=0 main.rs + $(RUSTC) -C debuginfo=0 -g main.rs + $(RUSTC) -C debuginfo=0 -C debuginfo=2 main.rs + $(RUSTC) -C debuginfo=2 -C debuginfo=0 main.rs diff --git a/tests/run-make/override-aliased-flags/main.rs b/tests/run-make/override-aliased-flags/main.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/override-aliased-flags/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/panic-impl-transitive/Makefile b/tests/run-make/panic-impl-transitive/Makefile new file mode 100644 index 00000000000..c3192efcb5a --- /dev/null +++ b/tests/run-make/panic-impl-transitive/Makefile @@ -0,0 +1,7 @@ +include ../../run-make-fulldeps/tools.mk + +# NOTE we use --emit=llvm-ir to avoid running the linker (linking will fail because there's no main +# in this crate) +all: + $(RUSTC) panic-impl-provider.rs + $(RUSTC) panic-impl-consumer.rs -C panic=abort --emit=llvm-ir -L $(TMPDIR) diff --git a/tests/run-make/panic-impl-transitive/panic-impl-consumer.rs b/tests/run-make/panic-impl-transitive/panic-impl-consumer.rs new file mode 100644 index 00000000000..82a98b12d04 --- /dev/null +++ b/tests/run-make/panic-impl-transitive/panic-impl-consumer.rs @@ -0,0 +1,5 @@ +#![no_std] +#![no_main] + +// this crate provides the `panic_impl` lang item so we don't need to define it here +extern crate panic_impl_provider; diff --git a/tests/run-make/panic-impl-transitive/panic-impl-provider.rs b/tests/run-make/panic-impl-transitive/panic-impl-provider.rs new file mode 100644 index 00000000000..f1b9873c83a --- /dev/null +++ b/tests/run-make/panic-impl-transitive/panic-impl-provider.rs @@ -0,0 +1,9 @@ +#![crate_type = "rlib"] +#![no_std] + +use core::panic::PanicInfo; + +#[panic_handler] +fn panic(info: &PanicInfo) -> ! { + loop {} +} diff --git a/tests/run-make/pass-non-c-like-enum-to-c/Makefile b/tests/run-make/pass-non-c-like-enum-to-c/Makefile new file mode 100644 index 00000000000..42d3c977f75 --- /dev/null +++ b/tests/run-make/pass-non-c-like-enum-to-c/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) nonclike.rs -L$(TMPDIR) -ltest + $(call RUN,nonclike) diff --git a/tests/run-make/pass-non-c-like-enum-to-c/nonclike.rs b/tests/run-make/pass-non-c-like-enum-to-c/nonclike.rs new file mode 100644 index 00000000000..517286a868d --- /dev/null +++ b/tests/run-make/pass-non-c-like-enum-to-c/nonclike.rs @@ -0,0 +1,21 @@ +#[repr(C, u8)] +pub enum TT { + AA(u64, u64), + BB, +} + +#[repr(C,u8)] +pub enum T { + A(u64), + B, +} + +extern "C" { + pub fn t_add(a: T, b: T) -> u64; + pub fn tt_add(a: TT, b: TT) -> u64; +} + +fn main() { + assert_eq!(33, unsafe { tt_add(TT::AA(1,2), TT::AA(10,20)) }); + assert_eq!(11, unsafe { t_add(T::A(1), T::A(10)) }); +} diff --git a/tests/run-make/pass-non-c-like-enum-to-c/test.c b/tests/run-make/pass-non-c-like-enum-to-c/test.c new file mode 100644 index 00000000000..99511b2530f --- /dev/null +++ b/tests/run-make/pass-non-c-like-enum-to-c/test.c @@ -0,0 +1,85 @@ +#include + +/* This is the code generated by cbindgen 0.12.1 for the `enum TT` + * type in nonclike.rs . */ +enum TT_Tag { + AA, + BB, +}; +typedef uint8_t TT_Tag; + +typedef struct { + uint64_t _0; + uint64_t _1; +} AA_Body; + +typedef struct { + TT_Tag tag; + union { + AA_Body aa; + }; +} TT; + +/* This is the code generated by cbindgen 0.12.1 for the `enum T` type + * in nonclike.rs . */ +enum T_Tag { + A, + B, +}; +typedef uint8_t T_Tag; + +typedef struct { + uint64_t _0; +} A_Body; + +typedef struct { + T_Tag tag; + union { + A_Body a; + }; +} T; + +uint64_t tt_add(TT a, TT b) { + if (a.tag == AA && b.tag == AA) { + return a.aa._0 + a.aa._1 + b.aa._0 + b.aa._1; + } else if (a.tag == AA) { + return a.aa._0 + a.aa._1; + } else if (b.tag == BB) { + return b.aa._0 + b.aa._1; + } else { + return 0; + } +} + +uint64_t t_add(T a, T b) { + if (a.tag == A && b.tag == A) { + return a.a._0 + b.a._0; + } else if (a.tag == AA) { + return a.a._0; + } else if (b.tag == BB) { + return b.a._0; + } else { + return 0; + } +} + +TT tt_new(uint64_t a, uint64_t b) { + TT tt = { + .tag = AA, + .aa = { + ._0 = a, + ._1 = b, + }, + }; + return tt; +} + +T t_new(uint64_t a) { + T t = { + .tag = A, + .a = { + ._0 = a, + }, + }; + return t; +} diff --git a/tests/run-make/pgo-branch-weights/Makefile b/tests/run-make/pgo-branch-weights/Makefile new file mode 100644 index 00000000000..c60206a1f34 --- /dev/null +++ b/tests/run-make/pgo-branch-weights/Makefile @@ -0,0 +1,34 @@ +# needs-profiler-support +# ignore-windows-gnu + +# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works +# properly. Since we only have GCC on the CI ignore the test for now. + +include ../tools.mk + +# For some very small programs GNU ld seems to not properly handle +# instrumentation sections correctly. Neither Gold nor LLD have that problem. +ifeq ($(UNAME),Linux) +ifneq (,$(findstring x86,$(TARGET))) +COMMON_FLAGS=-Clink-args=-fuse-ld=gold +endif +endif + + +all: + # We don't compile `opaque` with either optimizations or instrumentation. + $(RUSTC) $(COMMON_FLAGS) opaque.rs || exit 1 + # Compile the test program with instrumentation + mkdir -p "$(TMPDIR)/prof_data_dir" || exit 1 + $(RUSTC) $(COMMON_FLAGS) interesting.rs \ + -Cprofile-generate="$(TMPDIR)/prof_data_dir" -O -Ccodegen-units=1 || exit 1 + $(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)/prof_data_dir" -O || exit 1 + # The argument below generates to the expected branch weights + $(call RUN,main aaaaaaaaaaaa2bbbbbbbbbbbb2bbbbbbbbbbbbbbbbcc) || exit 1 + "$(LLVM_BIN_DIR)/llvm-profdata" merge \ + -o "$(TMPDIR)/prof_data_dir/merged.profdata" \ + "$(TMPDIR)/prof_data_dir" || exit 1 + $(RUSTC) $(COMMON_FLAGS) interesting.rs \ + -Cprofile-use="$(TMPDIR)/prof_data_dir/merged.profdata" -O \ + -Ccodegen-units=1 --emit=llvm-ir || exit 1 + cat "$(TMPDIR)/interesting.ll" | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/tests/run-make/pgo-branch-weights/filecheck-patterns.txt b/tests/run-make/pgo-branch-weights/filecheck-patterns.txt new file mode 100644 index 00000000000..70d5a645c14 --- /dev/null +++ b/tests/run-make/pgo-branch-weights/filecheck-patterns.txt @@ -0,0 +1,24 @@ + +# First, establish that certain !prof labels are attached to the expected +# functions and branching instructions. + +CHECK: define void @function_called_twice(i32 {{.*}} !prof [[function_called_twice_id:![0-9]+]] { +CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}, !prof [[branch_weights0:![0-9]+]] + +CHECK: define void @function_called_42_times(i32{{.*}} %c) {{.*}} !prof [[function_called_42_times_id:![0-9]+]] { +CHECK: switch i32 %c, label {{.*}} [ +CHECK-NEXT: i32 97, label {{.*}} +CHECK-NEXT: i32 98, label {{.*}} +CHECK-NEXT: ], !prof [[branch_weights1:![0-9]+]] + +CHECK: define void @function_called_never(i32 {{.*}} !prof [[function_called_never_id:![0-9]+]] { + + + +# Now check that those !prof tags hold the expected counts + +CHECK: [[function_called_twice_id]] = !{!"function_entry_count", i64 2} +CHECK: [[branch_weights0]] = !{!"branch_weights", i32 2, i32 0} +CHECK: [[function_called_42_times_id]] = !{!"function_entry_count", i64 42} +CHECK: [[branch_weights1]] = !{!"branch_weights", i32 2, i32 12, i32 28} +CHECK: [[function_called_never_id]] = !{!"function_entry_count", i64 0} diff --git a/tests/run-make/pgo-branch-weights/interesting.rs b/tests/run-make/pgo-branch-weights/interesting.rs new file mode 100644 index 00000000000..a26d6fd69d1 --- /dev/null +++ b/tests/run-make/pgo-branch-weights/interesting.rs @@ -0,0 +1,40 @@ +#![crate_name="interesting"] +#![crate_type="rlib"] + +extern crate opaque; + +#[no_mangle] +#[inline(never)] +pub fn function_called_twice(c: char) { + if c == '2' { + // This branch is taken twice + opaque::f1(); + } else { + // This branch is never taken + opaque::f2(); + } +} + +#[no_mangle] +#[inline(never)] +pub fn function_called_42_times(c: char) { + if c == 'a' { + // This branch is taken 12 times + opaque::f1(); + } else { + + if c == 'b' { + // This branch is taken 28 times + opaque::f2(); + } else { + // This branch is taken 2 times + opaque::f3(); + } + } +} + +#[no_mangle] +#[inline(never)] +pub fn function_called_never(_: char) { + opaque::f1(); +} diff --git a/tests/run-make/pgo-branch-weights/main.rs b/tests/run-make/pgo-branch-weights/main.rs new file mode 100644 index 00000000000..619cf9c698c --- /dev/null +++ b/tests/run-make/pgo-branch-weights/main.rs @@ -0,0 +1,17 @@ +extern crate interesting; + +fn main() { + let arg = std::env::args().skip(1).next().unwrap(); + + for c in arg.chars() { + if c == '2' { + interesting::function_called_twice(c); + } else { + interesting::function_called_42_times(c); + } + + if c == '0' { + interesting::function_called_never(c); + } + } +} diff --git a/tests/run-make/pgo-branch-weights/opaque.rs b/tests/run-make/pgo-branch-weights/opaque.rs new file mode 100644 index 00000000000..72f93c9feab --- /dev/null +++ b/tests/run-make/pgo-branch-weights/opaque.rs @@ -0,0 +1,6 @@ +#![crate_name="opaque"] +#![crate_type="rlib"] + +pub fn f1() {} +pub fn f2() {} +pub fn f3() {} diff --git a/tests/run-make/pgo-gen-lto/Makefile b/tests/run-make/pgo-gen-lto/Makefile new file mode 100644 index 00000000000..3f2f6a838b5 --- /dev/null +++ b/tests/run-make/pgo-gen-lto/Makefile @@ -0,0 +1,14 @@ +# needs-profiler-support +# ignore-windows-gnu + +# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works +# properly. Since we only have GCC on the CI ignore the test for now. + +include ../tools.mk + +COMPILE_FLAGS=-Copt-level=3 -Clto=fat -Cprofile-generate="$(TMPDIR)" + +all: + $(RUSTC) $(COMPILE_FLAGS) test.rs + $(call RUN,test) || exit 1 + [ -e "$(TMPDIR)"/default_*.profraw ] || (echo "No .profraw file"; exit 1) diff --git a/tests/run-make/pgo-gen-lto/test.rs b/tests/run-make/pgo-gen-lto/test.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/pgo-gen-lto/test.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/pgo-gen-no-imp-symbols/Makefile b/tests/run-make/pgo-gen-no-imp-symbols/Makefile new file mode 100644 index 00000000000..7f72b11b611 --- /dev/null +++ b/tests/run-make/pgo-gen-no-imp-symbols/Makefile @@ -0,0 +1,13 @@ +# needs-profiler-support + +include ../tools.mk + +COMPILE_FLAGS=-O -Ccodegen-units=1 -Cprofile-generate="$(TMPDIR)" + +all: + $(RUSTC) $(COMPILE_FLAGS) --emit=llvm-ir test.rs + # We expect symbols starting with "__llvm_profile_". + $(CGREP) "__llvm_profile_" < $(TMPDIR)/test.ll + # We do NOT expect the "__imp_" version of these symbols. + $(CGREP) -v "__imp___llvm_profile_" < $(TMPDIR)/test.ll # 64 bit + $(CGREP) -v "__imp____llvm_profile_" < $(TMPDIR)/test.ll # 32 bit diff --git a/tests/run-make/pgo-gen-no-imp-symbols/test.rs b/tests/run-make/pgo-gen-no-imp-symbols/test.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/pgo-gen-no-imp-symbols/test.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/pgo-gen/Makefile b/tests/run-make/pgo-gen/Makefile new file mode 100644 index 00000000000..4623a74957b --- /dev/null +++ b/tests/run-make/pgo-gen/Makefile @@ -0,0 +1,14 @@ +# needs-profiler-support +# ignore-windows-gnu + +# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works +# properly. Since we only have GCC on the CI ignore the test for now. + +include ../tools.mk + +COMPILE_FLAGS=-g -Cprofile-generate="$(TMPDIR)" + +all: + $(RUSTC) $(COMPILE_FLAGS) test.rs + $(call RUN,test) || exit 1 + [ -e "$(TMPDIR)"/default_*.profraw ] || (echo "No .profraw file"; exit 1) diff --git a/tests/run-make/pgo-gen/test.rs b/tests/run-make/pgo-gen/test.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/pgo-gen/test.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/pgo-indirect-call-promotion/Makefile b/tests/run-make/pgo-indirect-call-promotion/Makefile new file mode 100644 index 00000000000..45302215cc6 --- /dev/null +++ b/tests/run-make/pgo-indirect-call-promotion/Makefile @@ -0,0 +1,26 @@ +# needs-profiler-support +# ignore-windows-gnu + +# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works +# properly. Since we only have GCC on the CI ignore the test for now. + +include ../tools.mk + +all: + # We don't compile `opaque` with either optimizations or instrumentation. + # We don't compile `opaque` with either optimizations or instrumentation. + $(RUSTC) $(COMMON_FLAGS) opaque.rs + # Compile the test program with instrumentation + mkdir -p "$(TMPDIR)"/prof_data_dir + $(RUSTC) $(COMMON_FLAGS) interesting.rs \ + -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O -Ccodegen-units=1 + $(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O + # The argument below generates to the expected branch weights + $(call RUN,main) || exit 1 + "$(LLVM_BIN_DIR)"/llvm-profdata merge \ + -o "$(TMPDIR)"/prof_data_dir/merged.profdata \ + "$(TMPDIR)"/prof_data_dir + $(RUSTC) $(COMMON_FLAGS) interesting.rs \ + -Cprofile-use="$(TMPDIR)"/prof_data_dir/merged.profdata -O \ + -Ccodegen-units=1 --emit=llvm-ir + cat "$(TMPDIR)"/interesting.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/tests/run-make/pgo-indirect-call-promotion/filecheck-patterns.txt b/tests/run-make/pgo-indirect-call-promotion/filecheck-patterns.txt new file mode 100644 index 00000000000..e19c78350e9 --- /dev/null +++ b/tests/run-make/pgo-indirect-call-promotion/filecheck-patterns.txt @@ -0,0 +1,16 @@ +CHECK: define void @call_a_bunch_of_functions({{.*}} { + +# Make sure that indirect call promotion inserted a check against the most +# frequently called function. +CHECK: %{{.*}} = icmp eq {{void \(\)\*|ptr}} %{{.*}}, @function_called_always + +# Check that the call to `function_called_always` was inlined, so that we +# directly call `opaque_f1` from the upstream crate. +CHECK: call void @opaque_f1() + + +# Same checks as above, repeated for the trait object case + +CHECK: define void @call_a_bunch_of_trait_methods({{.*}} +CHECK: %{{.*}} = icmp eq {{void \(\{\}\*\)\*|ptr}} %{{.*}}, {{.*}}@foo +CHECK: tail call void @opaque_f2() diff --git a/tests/run-make/pgo-indirect-call-promotion/interesting.rs b/tests/run-make/pgo-indirect-call-promotion/interesting.rs new file mode 100644 index 00000000000..4fd096d626d --- /dev/null +++ b/tests/run-make/pgo-indirect-call-promotion/interesting.rs @@ -0,0 +1,56 @@ +#![crate_name="interesting"] +#![crate_type="rlib"] + +extern crate opaque; + +#[no_mangle] +pub fn function_called_always() { + opaque::opaque_f1(); +} + +#[no_mangle] +pub fn function_called_never() { + opaque::opaque_f2(); +} + +#[no_mangle] +pub fn call_a_bunch_of_functions(fns: &[fn()]) { + + // Indirect call promotion transforms the below into something like + // + // for f in fns { + // if f == function_called_always { + // function_called_always() + // } else { + // f(); + // } + // } + // + // where `function_called_always` actually gets inlined too. + + for f in fns { + f(); + } +} + + +pub trait Foo { + fn foo(&self); +} + +impl Foo for u32 { + + #[no_mangle] + fn foo(&self) { + opaque::opaque_f2(); + } +} + +#[no_mangle] +pub fn call_a_bunch_of_trait_methods(trait_objects: &[&dyn Foo]) { + + // Same as above, just with vtables in between + for x in trait_objects { + x.foo(); + } +} diff --git a/tests/run-make/pgo-indirect-call-promotion/main.rs b/tests/run-make/pgo-indirect-call-promotion/main.rs new file mode 100644 index 00000000000..27181f30710 --- /dev/null +++ b/tests/run-make/pgo-indirect-call-promotion/main.rs @@ -0,0 +1,14 @@ +extern crate interesting; + +fn main() { + // function pointer case + let fns: Vec<_> = std::iter::repeat(interesting::function_called_always as fn()) + .take(1000) + .collect(); + interesting::call_a_bunch_of_functions(&fns[..]); + + // Trait object case + let trait_objects = vec![0u32; 1000]; + let trait_objects: Vec<_> = trait_objects.iter().map(|x| x as &dyn interesting::Foo).collect(); + interesting::call_a_bunch_of_trait_methods(&trait_objects[..]); +} diff --git a/tests/run-make/pgo-indirect-call-promotion/opaque.rs b/tests/run-make/pgo-indirect-call-promotion/opaque.rs new file mode 100644 index 00000000000..9628d711c50 --- /dev/null +++ b/tests/run-make/pgo-indirect-call-promotion/opaque.rs @@ -0,0 +1,7 @@ +#![crate_name="opaque"] +#![crate_type="rlib"] + +#[no_mangle] +pub fn opaque_f1() {} +#[no_mangle] +pub fn opaque_f2() {} diff --git a/tests/run-make/pgo-use/Makefile b/tests/run-make/pgo-use/Makefile new file mode 100644 index 00000000000..3bac9b77aa3 --- /dev/null +++ b/tests/run-make/pgo-use/Makefile @@ -0,0 +1,46 @@ +# needs-profiler-support +# ignore-windows-gnu + +# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works +# properly. Since we only have GCC on the CI ignore the test for now. + +include ../tools.mk + +# This test makes sure that PGO profiling data leads to cold functions being +# marked as `cold` and hot functions with `inlinehint`. +# The test program contains an `if` were actual execution only ever takes the +# `else` branch. Accordingly, we expect the function that is never called to +# be marked as cold. +# +# Disable the pre-inlining pass (i.e. a pass that does some inlining before +# it adds the profiling instrumentation). Disabling this pass leads to +# rather predictable IR which we need for this test to be stable. + +COMMON_FLAGS=-Copt-level=2 -Ccodegen-units=1 -Cllvm-args=-disable-preinline + +ifeq ($(UNAME),Darwin) +# macOS does not have the `tac` command, but `tail -r` does the same thing +TAC := tail -r +else +# some other platforms don't support the `-r` flag for `tail`, so use `tac` +TAC := tac +endif + +all: + # Compile the test program with instrumentation + $(RUSTC) $(COMMON_FLAGS) -Cprofile-generate="$(TMPDIR)" main.rs + # Run it in order to generate some profiling data + $(call RUN,main some-argument) || exit 1 + # Postprocess the profiling data so it can be used by the compiler + "$(LLVM_BIN_DIR)"/llvm-profdata merge \ + -o "$(TMPDIR)"/merged.profdata \ + "$(TMPDIR)"/default_*.profraw + # Compile the test program again, making use of the profiling data + $(RUSTC) $(COMMON_FLAGS) -Cprofile-use="$(TMPDIR)"/merged.profdata --emit=llvm-ir main.rs + # Check that the generate IR contains some things that we expect + # + # We feed the file into LLVM FileCheck tool *in reverse* so that we see the + # line with the function name before the line with the function attributes. + # FileCheck only supports checking that something matches on the next line, + # but not if something matches on the previous line. + $(TAC) "$(TMPDIR)"/main.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt diff --git a/tests/run-make/pgo-use/filecheck-patterns.txt b/tests/run-make/pgo-use/filecheck-patterns.txt new file mode 100644 index 00000000000..6da34f88f2a --- /dev/null +++ b/tests/run-make/pgo-use/filecheck-patterns.txt @@ -0,0 +1,11 @@ +# Add a check that the IR contains some expected metadata +CHECK: !{!"ProfileFormat", !"InstrProf"} +CHECK: !"ProfileSummary" + +# Make sure that the hot function is marked with `inlinehint` +CHECK: define {{.*}} @hot_function +CHECK-NEXT: Function Attrs:{{.*}}inlinehint + +# Make sure that the cold function is marked with `cold` +CHECK: define {{.*}} @cold_function +CHECK-NEXT: Function Attrs:{{.*}}cold diff --git a/tests/run-make/pgo-use/main.rs b/tests/run-make/pgo-use/main.rs new file mode 100644 index 00000000000..eb9192c87e6 --- /dev/null +++ b/tests/run-make/pgo-use/main.rs @@ -0,0 +1,23 @@ +#[no_mangle] +pub fn cold_function(c: u8) { + println!("cold {}", c); +} + +#[no_mangle] +pub fn hot_function(c: u8) { + std::env::set_var(format!("var{}", c), format!("hot {}", c)); +} + +fn main() { + let arg = std::env::args().skip(1).next().unwrap(); + + for i in 0 .. 1000_000 { + let some_value = arg.as_bytes()[i % arg.len()]; + if some_value == b'!' { + // This branch is never taken at runtime + cold_function(some_value); + } else { + hot_function(some_value); + } + } +} diff --git a/tests/run-make/pointer-auth-link-with-c/Makefile b/tests/run-make/pointer-auth-link-with-c/Makefile new file mode 100644 index 00000000000..7acea03802c --- /dev/null +++ b/tests/run-make/pointer-auth-link-with-c/Makefile @@ -0,0 +1,14 @@ +include ../tools.mk + +# only-aarch64 + +all: + $(COMPILE_OBJ) $(TMPDIR)/test.o test.c + $(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o + $(RUSTC) -Z branch-protection=bti,pac-ret,leaf test.rs + $(call RUN,test) + + $(COMPILE_OBJ) $(TMPDIR)/test.o test.c -mbranch-protection=bti+pac-ret+leaf + $(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o + $(RUSTC) -Z branch-protection=bti,pac-ret,leaf test.rs + $(call RUN,test) diff --git a/tests/run-make/pointer-auth-link-with-c/test.c b/tests/run-make/pointer-auth-link-with-c/test.c new file mode 100644 index 00000000000..9fe07f82f9e --- /dev/null +++ b/tests/run-make/pointer-auth-link-with-c/test.c @@ -0,0 +1 @@ +int foo() { return 0; } diff --git a/tests/run-make/pointer-auth-link-with-c/test.rs b/tests/run-make/pointer-auth-link-with-c/test.rs new file mode 100644 index 00000000000..615ad0aeb3d --- /dev/null +++ b/tests/run-make/pointer-auth-link-with-c/test.rs @@ -0,0 +1,8 @@ +#[link(name = "test")] +extern "C" { + fn foo() -> i32; +} + +fn main() { + unsafe {foo();} +} diff --git a/tests/run-make/prefer-dylib/Makefile b/tests/run-make/prefer-dylib/Makefile new file mode 100644 index 00000000000..3817ca195eb --- /dev/null +++ b/tests/run-make/prefer-dylib/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +all: + $(RUSTC) bar.rs --crate-type=dylib --crate-type=rlib -C prefer-dynamic + $(RUSTC) foo.rs -C prefer-dynamic + $(call RUN,foo) + rm $(TMPDIR)/*bar* + $(call FAIL,foo) diff --git a/tests/run-make/prefer-dylib/bar.rs b/tests/run-make/prefer-dylib/bar.rs new file mode 100644 index 00000000000..c5c0bc606cd --- /dev/null +++ b/tests/run-make/prefer-dylib/bar.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/prefer-dylib/foo.rs b/tests/run-make/prefer-dylib/foo.rs new file mode 100644 index 00000000000..8d68535e3b6 --- /dev/null +++ b/tests/run-make/prefer-dylib/foo.rs @@ -0,0 +1,5 @@ +extern crate bar; + +fn main() { + bar::bar(); +} diff --git a/tests/run-make/prefer-rlib/Makefile b/tests/run-make/prefer-rlib/Makefile new file mode 100644 index 00000000000..adc345d760d --- /dev/null +++ b/tests/run-make/prefer-rlib/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +all: + $(RUSTC) bar.rs --crate-type=dylib --crate-type=rlib + ls $(TMPDIR)/$(call RLIB_GLOB,bar) + $(RUSTC) foo.rs + rm $(TMPDIR)/*bar* + $(call RUN,foo) diff --git a/tests/run-make/prefer-rlib/bar.rs b/tests/run-make/prefer-rlib/bar.rs new file mode 100644 index 00000000000..c5c0bc606cd --- /dev/null +++ b/tests/run-make/prefer-rlib/bar.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/prefer-rlib/foo.rs b/tests/run-make/prefer-rlib/foo.rs new file mode 100644 index 00000000000..8d68535e3b6 --- /dev/null +++ b/tests/run-make/prefer-rlib/foo.rs @@ -0,0 +1,5 @@ +extern crate bar; + +fn main() { + bar::bar(); +} diff --git a/tests/run-make/pretty-print-to-file/Makefile b/tests/run-make/pretty-print-to-file/Makefile new file mode 100644 index 00000000000..ca11b8c47f0 --- /dev/null +++ b/tests/run-make/pretty-print-to-file/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) -o $(TMPDIR)/input.out -Zunpretty=normal input.rs + diff -u $(TMPDIR)/input.out input.pp diff --git a/tests/run-make/pretty-print-to-file/input.pp b/tests/run-make/pretty-print-to-file/input.pp new file mode 100644 index 00000000000..e3f03242a6e --- /dev/null +++ b/tests/run-make/pretty-print-to-file/input.pp @@ -0,0 +1,3 @@ + +#[crate_type = "lib"] +pub fn foo() -> i32 { 45 } diff --git a/tests/run-make/pretty-print-to-file/input.rs b/tests/run-make/pretty-print-to-file/input.rs new file mode 100644 index 00000000000..aa828155b20 --- /dev/null +++ b/tests/run-make/pretty-print-to-file/input.rs @@ -0,0 +1,5 @@ +#[crate_type="lib"] + +pub fn +foo() -> i32 +{ 45 } diff --git a/tests/run-make/print-calling-conventions/Makefile b/tests/run-make/print-calling-conventions/Makefile new file mode 100644 index 00000000000..d3fd06392b0 --- /dev/null +++ b/tests/run-make/print-calling-conventions/Makefile @@ -0,0 +1,4 @@ +-include ../tools.mk + +all: + $(RUSTC) --print calling-conventions diff --git a/tests/run-make/print-cfg/Makefile b/tests/run-make/print-cfg/Makefile new file mode 100644 index 00000000000..126f5768c90 --- /dev/null +++ b/tests/run-make/print-cfg/Makefile @@ -0,0 +1,20 @@ +# needs-llvm-components: x86 arm + +include ../tools.mk + +all: default + $(RUSTC) --target x86_64-pc-windows-gnu --print cfg | $(CGREP) windows + $(RUSTC) --target x86_64-pc-windows-gnu --print cfg | $(CGREP) x86_64 + $(RUSTC) --target i686-pc-windows-msvc --print cfg | $(CGREP) msvc + $(RUSTC) --target i686-apple-darwin --print cfg | $(CGREP) macos + $(RUSTC) --target i686-unknown-linux-gnu --print cfg | $(CGREP) gnu + $(RUSTC) --target arm-unknown-linux-gnueabihf --print cfg | $(CGREP) target_abi= + $(RUSTC) --target arm-unknown-linux-gnueabihf --print cfg | $(CGREP) eabihf + +ifdef IS_WINDOWS +default: + $(RUSTC) --print cfg | $(CGREP) windows +else +default: + $(RUSTC) --print cfg | $(CGREP) unix +endif diff --git a/tests/run-make/print-target-list/Makefile b/tests/run-make/print-target-list/Makefile new file mode 100644 index 00000000000..f23c40d4281 --- /dev/null +++ b/tests/run-make/print-target-list/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +# Checks that all the targets returned by `rustc --print target-list` are valid +# target specifications +all: + for target in $(shell $(BARE_RUSTC) --print target-list); do \ + $(BARE_RUSTC) --target $$target --print sysroot; \ + done diff --git a/tests/run-make/profile/Makefile b/tests/run-make/profile/Makefile new file mode 100644 index 00000000000..fffc051adbf --- /dev/null +++ b/tests/run-make/profile/Makefile @@ -0,0 +1,12 @@ +# needs-profiler-support + +include ../tools.mk + +all: + $(RUSTC) -g -Z profile test.rs + $(call RUN,test) || exit 1 + [ -e "$(TMPDIR)/test.gcno" ] || (echo "No .gcno file"; exit 1) + [ -e "$(TMPDIR)/test.gcda" ] || (echo "No .gcda file"; exit 1) + $(RUSTC) -g -Z profile -Z profile-emit=$(TMPDIR)/abc/abc.gcda test.rs + $(call RUN,test) || exit 1 + [ -e "$(TMPDIR)/abc/abc.gcda" ] || (echo "gcda file not emitted to defined path"; exit 1) diff --git a/tests/run-make/profile/test.rs b/tests/run-make/profile/test.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/profile/test.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/prune-link-args/Makefile b/tests/run-make/prune-link-args/Makefile new file mode 100644 index 00000000000..a359dc5aef1 --- /dev/null +++ b/tests/run-make/prune-link-args/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# ignore-windows + +# Notice the space in the end, this emulates the output of pkg-config +RUSTC_FLAGS = -C link-args="-lc " + +all: + $(RUSTC) $(RUSTC_FLAGS) empty.rs diff --git a/tests/run-make/prune-link-args/empty.rs b/tests/run-make/prune-link-args/empty.rs new file mode 100644 index 00000000000..45590d86ba6 --- /dev/null +++ b/tests/run-make/prune-link-args/empty.rs @@ -0,0 +1 @@ +fn main() { } diff --git a/tests/run-make/redundant-libs/Makefile b/tests/run-make/redundant-libs/Makefile new file mode 100644 index 00000000000..b2dff05d163 --- /dev/null +++ b/tests/run-make/redundant-libs/Makefile @@ -0,0 +1,23 @@ +include ../tools.mk + +# ignore-windows-msvc + +# rustc will remove one of the two redundant references to foo below. Depending +# on which one gets removed, we'll get a linker error on SOME platforms (like +# Linux). On these platforms, when a library is referenced, the linker will +# only pull in the symbols needed _at that point in time_. If a later library +# depends on additional symbols from the library, they will not have been pulled +# in, and you'll get undefined symbols errors. +# +# So in this example, we need to ensure that rustc keeps the _later_ reference +# to foo, and not the former one. +RUSTC_FLAGS = \ + -l static=bar \ + -l foo \ + -l static=baz \ + -l foo \ + --print link-args + +all: $(call DYLIB,foo) $(call STATICLIB,bar) $(call STATICLIB,baz) + $(RUSTC) $(RUSTC_FLAGS) main.rs + $(call RUN,main) diff --git a/tests/run-make/redundant-libs/bar.c b/tests/run-make/redundant-libs/bar.c new file mode 100644 index 00000000000..e4259998678 --- /dev/null +++ b/tests/run-make/redundant-libs/bar.c @@ -0,0 +1 @@ +void bar() {} diff --git a/tests/run-make/redundant-libs/baz.c b/tests/run-make/redundant-libs/baz.c new file mode 100644 index 00000000000..a4e2c2b717f --- /dev/null +++ b/tests/run-make/redundant-libs/baz.c @@ -0,0 +1,7 @@ +extern void foo1(); +extern void foo2(); + +void baz() { + foo1(); + foo2(); +} diff --git a/tests/run-make/redundant-libs/foo.c b/tests/run-make/redundant-libs/foo.c new file mode 100644 index 00000000000..339ee86c99e --- /dev/null +++ b/tests/run-make/redundant-libs/foo.c @@ -0,0 +1,2 @@ +void foo1() {} +void foo2() {} diff --git a/tests/run-make/redundant-libs/main.rs b/tests/run-make/redundant-libs/main.rs new file mode 100644 index 00000000000..90d185ff51d --- /dev/null +++ b/tests/run-make/redundant-libs/main.rs @@ -0,0 +1,11 @@ +extern "C" { + fn bar(); + fn baz(); +} + +fn main() { + unsafe { + bar(); + baz(); + } +} diff --git a/tests/run-make/relocation-model/Makefile b/tests/run-make/relocation-model/Makefile new file mode 100644 index 00000000000..a31dbfd9167 --- /dev/null +++ b/tests/run-make/relocation-model/Makefile @@ -0,0 +1,19 @@ +include ../tools.mk + +all: others + $(RUSTC) -C relocation-model=dynamic-no-pic foo.rs + $(call RUN,foo) + + $(RUSTC) -C relocation-model=default foo.rs + $(call RUN,foo) + + $(RUSTC) -C relocation-model=dynamic-no-pic --crate-type=dylib foo.rs --emit=link,obj + +ifdef IS_MSVC +# FIXME(#28026) +others: +else +others: + $(RUSTC) -C relocation-model=static foo.rs + $(call RUN,foo) +endif diff --git a/tests/run-make/relocation-model/foo.rs b/tests/run-make/relocation-model/foo.rs new file mode 100644 index 00000000000..da0f5d925d1 --- /dev/null +++ b/tests/run-make/relocation-model/foo.rs @@ -0,0 +1 @@ +pub fn main() {} diff --git a/tests/run-make/relro-levels/Makefile b/tests/run-make/relro-levels/Makefile new file mode 100644 index 00000000000..6176fc1a589 --- /dev/null +++ b/tests/run-make/relro-levels/Makefile @@ -0,0 +1,21 @@ +include ../tools.mk + +# only-linux +# +# This tests the different -Zrelro-level values, and makes sure that they work properly. + +all: + # Ensure that binaries built with the full relro level links them with both + # RELRO and BIND_NOW for doing eager symbol resolving. + $(RUSTC) -Zrelro-level=full hello.rs + readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO + readelf -d $(TMPDIR)/hello | grep -q BIND_NOW + + $(RUSTC) -Zrelro-level=partial hello.rs + readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO + + # Ensure that we're *not* built with RELRO when setting it to off. We do + # not want to check for BIND_NOW however, as the linker might have that + # enabled by default. + $(RUSTC) -Zrelro-level=off hello.rs + ! readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO diff --git a/tests/run-make/relro-levels/hello.rs b/tests/run-make/relro-levels/hello.rs new file mode 100644 index 00000000000..e7a11a969c0 --- /dev/null +++ b/tests/run-make/relro-levels/hello.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/tests/run-make/remap-path-prefix/Makefile b/tests/run-make/remap-path-prefix/Makefile new file mode 100644 index 00000000000..2a7378fdf9e --- /dev/null +++ b/tests/run-make/remap-path-prefix/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# ignore-windows + +# Checks if remapping works if the remap-from string contains path to the working directory plus more +all: + $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux --crate-type=lib --emit=metadata auxiliary/lib.rs + grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1 + ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1 diff --git a/tests/run-make/remap-path-prefix/auxiliary/lib.rs b/tests/run-make/remap-path-prefix/auxiliary/lib.rs new file mode 100644 index 00000000000..019c786a902 --- /dev/null +++ b/tests/run-make/remap-path-prefix/auxiliary/lib.rs @@ -0,0 +1,3 @@ +pub fn lib() { + panic!("calm"); +} diff --git a/tests/run-make/reproducible-build-2/Makefile b/tests/run-make/reproducible-build-2/Makefile new file mode 100644 index 00000000000..1df5e102ce3 --- /dev/null +++ b/tests/run-make/reproducible-build-2/Makefile @@ -0,0 +1,26 @@ +include ../tools.mk + +# ignore-musl +# ignore-windows +# Objects are reproducible but their path is not. + +all: \ + fat_lto \ + sysroot + +fat_lto: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs -C lto=fat + cp $(TMPDIR)/reproducible-build $(TMPDIR)/reproducible-build-a + $(RUSTC) reproducible-build.rs -C lto=fat + cmp "$(TMPDIR)/reproducible-build-a" "$(TMPDIR)/reproducible-build" || exit 1 + +sysroot: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs --crate-type rlib --sysroot $(shell $(RUSTC) --print sysroot) --remap-path-prefix=$(shell $(RUSTC) --print sysroot)=/sysroot + cp -R $(shell $(RUSTC) --print sysroot) $(TMPDIR)/sysroot + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib + $(RUSTC) reproducible-build.rs --crate-type rlib --sysroot $(TMPDIR)/sysroot --remap-path-prefix=$(TMPDIR)/sysroot=/sysroot + cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 diff --git a/tests/run-make/reproducible-build-2/linker.rs b/tests/run-make/reproducible-build-2/linker.rs new file mode 100644 index 00000000000..998d1f32859 --- /dev/null +++ b/tests/run-make/reproducible-build-2/linker.rs @@ -0,0 +1,44 @@ +use std::env; +use std::path::Path; +use std::fs::File; +use std::io::{Read, Write}; + +fn main() { + let mut dst = env::current_exe().unwrap(); + dst.pop(); + dst.push("linker-arguments1"); + if dst.exists() { + dst.pop(); + dst.push("linker-arguments2"); + assert!(!dst.exists()); + } + + let mut out = String::new(); + for arg in env::args().skip(1) { + let path = Path::new(&arg); + if !path.is_file() { + out.push_str(&arg); + out.push_str("\n"); + continue + } + + let mut contents = Vec::new(); + File::open(path).unwrap().read_to_end(&mut contents).unwrap(); + + out.push_str(&format!("{}: {}\n", arg, hash(&contents))); + } + + File::create(dst).unwrap().write_all(out.as_bytes()).unwrap(); +} + +// fnv hash for now +fn hash(contents: &[u8]) -> u64 { + let mut hash = 0xcbf29ce484222325; + + for byte in contents { + hash = hash ^ (*byte as u64); + hash = hash.wrapping_mul(0x100000001b3); + } + + hash +} diff --git a/tests/run-make/reproducible-build-2/reproducible-build-aux.rs b/tests/run-make/reproducible-build-2/reproducible-build-aux.rs new file mode 100644 index 00000000000..8105b3d2bda --- /dev/null +++ b/tests/run-make/reproducible-build-2/reproducible-build-aux.rs @@ -0,0 +1,28 @@ +#![crate_type="lib"] + +pub static STATIC: i32 = 1234; + +pub struct Struct { + _t1: std::marker::PhantomData, + _t2: std::marker::PhantomData, +} + +pub fn regular_fn(_: i32) {} + +pub fn generic_fn() {} + +impl Drop for Struct { + fn drop(&mut self) {} +} + +pub enum Enum { + Variant1, + Variant2(u32), + Variant3 { x: u32 } +} + +pub struct TupleStruct(pub i8, pub i16, pub i32, pub i64); + +pub trait Trait { + fn foo(&self); +} diff --git a/tests/run-make/reproducible-build-2/reproducible-build.rs b/tests/run-make/reproducible-build-2/reproducible-build.rs new file mode 100644 index 00000000000..a6c04774c86 --- /dev/null +++ b/tests/run-make/reproducible-build-2/reproducible-build.rs @@ -0,0 +1,116 @@ +// This test case makes sure that two identical invocations of the compiler +// (i.e., same code base, same compile-flags, same compiler-versions, etc.) +// produce the same output. In the past, symbol names of monomorphized functions +// were not deterministic (which we want to avoid). +// +// The test tries to exercise as many different paths into symbol name +// generation as possible: +// +// - regular functions +// - generic functions +// - methods +// - statics +// - closures +// - enum variant constructors +// - tuple struct constructors +// - drop glue +// - FnOnce adapters +// - Trait object shims +// - Fn Pointer shims + +#![allow(dead_code, warnings)] + +extern crate reproducible_build_aux; + +static STATIC: i32 = 1234; + +pub struct Struct { + x: T1, + y: T2, +} + +fn regular_fn(_: i32) {} + +fn generic_fn() {} + +impl Drop for Struct { + fn drop(&mut self) {} +} + +pub enum Enum { + Variant1, + Variant2(u32), + Variant3 { x: u32 } +} + +struct TupleStruct(i8, i16, i32, i64); + +impl TupleStruct { + pub fn bar(&self) {} +} + +trait Trait { + fn foo(&self); +} + +impl Trait for u64 { + fn foo(&self) {} +} + +impl reproducible_build_aux::Trait for TupleStruct { + fn foo(&self) {} +} + +fn main() { + regular_fn(STATIC); + generic_fn::(); + generic_fn::>(); + generic_fn::, reproducible_build_aux::Struct>(); + + let dropped = Struct { + x: "", + y: 'a', + }; + + let _ = Enum::Variant1; + let _ = Enum::Variant2(0); + let _ = Enum::Variant3 { x: 0 }; + let _ = TupleStruct(1, 2, 3, 4); + + let closure = |x| { + x + 1i32 + }; + + fn inner i32>(f: F) -> i32 { + f(STATIC) + } + + println!("{}", inner(closure)); + + let object_shim: &Trait = &0u64; + object_shim.foo(); + + fn with_fn_once_adapter(f: F) { + f(0); + } + + with_fn_once_adapter(|_:i32| { }); + + reproducible_build_aux::regular_fn(STATIC); + reproducible_build_aux::generic_fn::(); + reproducible_build_aux::generic_fn::>(); + reproducible_build_aux::generic_fn::, + reproducible_build_aux::Struct>(); + + let _ = reproducible_build_aux::Enum::Variant1; + let _ = reproducible_build_aux::Enum::Variant2(0); + let _ = reproducible_build_aux::Enum::Variant3 { x: 0 }; + let _ = reproducible_build_aux::TupleStruct(1, 2, 3, 4); + + let object_shim: &reproducible_build_aux::Trait = &TupleStruct(0, 1, 2, 3); + object_shim.foo(); + + let pointer_shim: &Fn(i32) = ®ular_fn; + + TupleStruct(1, 2, 3, 4).bar(); +} diff --git a/tests/run-make/reproducible-build/Makefile b/tests/run-make/reproducible-build/Makefile new file mode 100644 index 00000000000..642a480815b --- /dev/null +++ b/tests/run-make/reproducible-build/Makefile @@ -0,0 +1,139 @@ +include ../tools.mk + +# ignore-musl +# Objects are reproducible but their path is not. + +all: \ + smoke \ + debug \ + opt \ + link_paths \ + remap_paths \ + different_source_dirs_rlib \ + remap_cwd_rlib \ + remap_cwd_to_empty \ + extern_flags + +# TODO: Builds of `bin` crate types are not deterministic with debuginfo=2 on +# Windows. +# See: https://github.com/rust-lang/rust/pull/87320#issuecomment-920105533 +# Issue: https://github.com/rust-lang/rust/issues/88982 +# +# different_source_dirs_bin \ +# remap_cwd_bin \ + +smoke: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) linker.rs -O + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) + diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" + +debug: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) linker.rs -O + $(RUSTC) reproducible-build-aux.rs -g + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g + diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" + +opt: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) linker.rs -O + $(RUSTC) reproducible-build-aux.rs -O + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O + $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O + diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" + +link_paths: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs --crate-type rlib -L /b + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib + $(RUSTC) reproducible-build.rs --crate-type rlib -L /a + cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 + +remap_paths: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=/a=/c + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib + $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=/b=/c + cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 + +different_source_dirs_bin: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + mkdir $(TMPDIR)/test + cp reproducible-build.rs $(TMPDIR)/test + $(RUSTC) reproducible-build.rs --crate-type bin --remap-path-prefix=$$PWD=/b + cp $(TMPDIR)/reproducible-build $(TMPDIR)/foo + (cd $(TMPDIR)/test && $(RUSTC) reproducible-build.rs \ + --remap-path-prefix=$(TMPDIR)/test=/b \ + --crate-type bin) + cmp "$(TMPDIR)/reproducible-build" "$(TMPDIR)/foo" || exit 1 + +different_source_dirs_rlib: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + mkdir $(TMPDIR)/test + cp reproducible-build.rs $(TMPDIR)/test + $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=$$PWD=/b + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib + (cd $(TMPDIR)/test && $(RUSTC) reproducible-build.rs \ + --remap-path-prefix=$(TMPDIR)/test=/b \ + --crate-type rlib) + cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 + +remap_cwd_bin: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + mkdir $(TMPDIR)/test + cp reproducible-build.rs $(TMPDIR)/test + $(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \ + -Z remap-cwd-prefix=. + cp $(TMPDIR)/reproducible-build $(TMPDIR)/first + (cd $(TMPDIR)/test && \ + $(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \ + -Z remap-cwd-prefix=.) + cmp "$(TMPDIR)/first" "$(TMPDIR)/reproducible-build" || exit 1 + +remap_cwd_rlib: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + mkdir $(TMPDIR)/test + cp reproducible-build.rs $(TMPDIR)/test + $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ + -Z remap-cwd-prefix=. + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib + (cd $(TMPDIR)/test && \ + $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ + -Z remap-cwd-prefix=.) + cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1 + +remap_cwd_to_empty: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + mkdir $(TMPDIR)/test + cp reproducible-build.rs $(TMPDIR)/test + $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ + -Z remap-cwd-prefix= + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib + (cd $(TMPDIR)/test && \ + $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ + -Z remap-cwd-prefix=) + cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1 + +extern_flags: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) reproducible-build-aux.rs + $(RUSTC) reproducible-build.rs \ + --extern reproducible_build_aux=$(TMPDIR)/libreproducible_build_aux.rlib \ + --crate-type rlib + cp $(TMPDIR)/libreproducible_build_aux.rlib $(TMPDIR)/libbar.rlib + cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib + $(RUSTC) reproducible-build.rs \ + --extern reproducible_build_aux=$(TMPDIR)/libbar.rlib \ + --crate-type rlib + cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 diff --git a/tests/run-make/reproducible-build/linker.rs b/tests/run-make/reproducible-build/linker.rs new file mode 100644 index 00000000000..3dda6f190e4 --- /dev/null +++ b/tests/run-make/reproducible-build/linker.rs @@ -0,0 +1,50 @@ +use std::env; +use std::path::Path; +use std::fs::File; +use std::io::{Read, Write}; + +fn main() { + let mut dst = env::current_exe().unwrap(); + dst.pop(); + dst.push("linker-arguments1"); + if dst.exists() { + dst.pop(); + dst.push("linker-arguments2"); + assert!(!dst.exists()); + } + + let mut out = String::new(); + for arg in env::args().skip(1) { + let path = Path::new(&arg); + if !path.is_file() { + out.push_str(&arg); + out.push_str("\n"); + continue + } + + let mut contents = Vec::new(); + File::open(path).unwrap().read_to_end(&mut contents).unwrap(); + + // This file is produced during linking in a temporary directory. + let arg = if arg.ends_with("/symbols.o") || arg.ends_with("\\symbols.o") { + "symbols.o" + } else { + &*arg + }; + out.push_str(&format!("{}: {}\n", arg, hash(&contents))); + } + + File::create(dst).unwrap().write_all(out.as_bytes()).unwrap(); +} + +// fnv hash for now +fn hash(contents: &[u8]) -> u64 { + let mut hash = 0xcbf29ce484222325; + + for byte in contents { + hash = hash ^ (*byte as u64); + hash = hash.wrapping_mul(0x100000001b3); + } + + hash +} diff --git a/tests/run-make/reproducible-build/reproducible-build-aux.rs b/tests/run-make/reproducible-build/reproducible-build-aux.rs new file mode 100644 index 00000000000..8105b3d2bda --- /dev/null +++ b/tests/run-make/reproducible-build/reproducible-build-aux.rs @@ -0,0 +1,28 @@ +#![crate_type="lib"] + +pub static STATIC: i32 = 1234; + +pub struct Struct { + _t1: std::marker::PhantomData, + _t2: std::marker::PhantomData, +} + +pub fn regular_fn(_: i32) {} + +pub fn generic_fn() {} + +impl Drop for Struct { + fn drop(&mut self) {} +} + +pub enum Enum { + Variant1, + Variant2(u32), + Variant3 { x: u32 } +} + +pub struct TupleStruct(pub i8, pub i16, pub i32, pub i64); + +pub trait Trait { + fn foo(&self); +} diff --git a/tests/run-make/reproducible-build/reproducible-build.rs b/tests/run-make/reproducible-build/reproducible-build.rs new file mode 100644 index 00000000000..a6c04774c86 --- /dev/null +++ b/tests/run-make/reproducible-build/reproducible-build.rs @@ -0,0 +1,116 @@ +// This test case makes sure that two identical invocations of the compiler +// (i.e., same code base, same compile-flags, same compiler-versions, etc.) +// produce the same output. In the past, symbol names of monomorphized functions +// were not deterministic (which we want to avoid). +// +// The test tries to exercise as many different paths into symbol name +// generation as possible: +// +// - regular functions +// - generic functions +// - methods +// - statics +// - closures +// - enum variant constructors +// - tuple struct constructors +// - drop glue +// - FnOnce adapters +// - Trait object shims +// - Fn Pointer shims + +#![allow(dead_code, warnings)] + +extern crate reproducible_build_aux; + +static STATIC: i32 = 1234; + +pub struct Struct { + x: T1, + y: T2, +} + +fn regular_fn(_: i32) {} + +fn generic_fn() {} + +impl Drop for Struct { + fn drop(&mut self) {} +} + +pub enum Enum { + Variant1, + Variant2(u32), + Variant3 { x: u32 } +} + +struct TupleStruct(i8, i16, i32, i64); + +impl TupleStruct { + pub fn bar(&self) {} +} + +trait Trait { + fn foo(&self); +} + +impl Trait for u64 { + fn foo(&self) {} +} + +impl reproducible_build_aux::Trait for TupleStruct { + fn foo(&self) {} +} + +fn main() { + regular_fn(STATIC); + generic_fn::(); + generic_fn::>(); + generic_fn::, reproducible_build_aux::Struct>(); + + let dropped = Struct { + x: "", + y: 'a', + }; + + let _ = Enum::Variant1; + let _ = Enum::Variant2(0); + let _ = Enum::Variant3 { x: 0 }; + let _ = TupleStruct(1, 2, 3, 4); + + let closure = |x| { + x + 1i32 + }; + + fn inner i32>(f: F) -> i32 { + f(STATIC) + } + + println!("{}", inner(closure)); + + let object_shim: &Trait = &0u64; + object_shim.foo(); + + fn with_fn_once_adapter(f: F) { + f(0); + } + + with_fn_once_adapter(|_:i32| { }); + + reproducible_build_aux::regular_fn(STATIC); + reproducible_build_aux::generic_fn::(); + reproducible_build_aux::generic_fn::>(); + reproducible_build_aux::generic_fn::, + reproducible_build_aux::Struct>(); + + let _ = reproducible_build_aux::Enum::Variant1; + let _ = reproducible_build_aux::Enum::Variant2(0); + let _ = reproducible_build_aux::Enum::Variant3 { x: 0 }; + let _ = reproducible_build_aux::TupleStruct(1, 2, 3, 4); + + let object_shim: &reproducible_build_aux::Trait = &TupleStruct(0, 1, 2, 3); + object_shim.foo(); + + let pointer_shim: &Fn(i32) = ®ular_fn; + + TupleStruct(1, 2, 3, 4).bar(); +} diff --git a/tests/run-make/resolve-rename/Makefile b/tests/run-make/resolve-rename/Makefile new file mode 100644 index 00000000000..00f83a5d6b2 --- /dev/null +++ b/tests/run-make/resolve-rename/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) -C extra-filename=-hash foo.rs + $(RUSTC) bar.rs + mv $(TMPDIR)/libfoo-hash.rlib $(TMPDIR)/libfoo-another-hash.rlib + $(RUSTC) baz.rs diff --git a/tests/run-make/resolve-rename/bar.rs b/tests/run-make/resolve-rename/bar.rs new file mode 100644 index 00000000000..4a09ce355e6 --- /dev/null +++ b/tests/run-make/resolve-rename/bar.rs @@ -0,0 +1,5 @@ +#![crate_type = "rlib"] + +extern crate foo; + +pub fn bar() { foo::foo() } diff --git a/tests/run-make/resolve-rename/baz.rs b/tests/run-make/resolve-rename/baz.rs new file mode 100644 index 00000000000..9176073ef97 --- /dev/null +++ b/tests/run-make/resolve-rename/baz.rs @@ -0,0 +1,5 @@ +#![crate_type = "rlib"] + +extern crate bar; + +pub fn baz() { bar::bar() } diff --git a/tests/run-make/resolve-rename/foo.rs b/tests/run-make/resolve-rename/foo.rs new file mode 100644 index 00000000000..bd6820098ee --- /dev/null +++ b/tests/run-make/resolve-rename/foo.rs @@ -0,0 +1,3 @@ +#![crate_type = "rlib"] + +pub fn foo() {} diff --git a/tests/run-make/return-non-c-like-enum-from-c/Makefile b/tests/run-make/return-non-c-like-enum-from-c/Makefile new file mode 100644 index 00000000000..42d3c977f75 --- /dev/null +++ b/tests/run-make/return-non-c-like-enum-from-c/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,test) + $(RUSTC) nonclike.rs -L$(TMPDIR) -ltest + $(call RUN,nonclike) diff --git a/tests/run-make/return-non-c-like-enum-from-c/nonclike.rs b/tests/run-make/return-non-c-like-enum-from-c/nonclike.rs new file mode 100644 index 00000000000..ea22a2a56e0 --- /dev/null +++ b/tests/run-make/return-non-c-like-enum-from-c/nonclike.rs @@ -0,0 +1,31 @@ +#[repr(C, u8)] +pub enum TT { + AA(u64, u64), + BB, +} + +#[repr(C,u8)] +pub enum T { + A(u64), + B, +} + +extern "C" { + pub fn t_new(a: u64) -> T; + pub fn tt_new(a: u64, b: u64) -> TT; +} + +fn main() { + if let TT::AA(a, b) = unsafe { tt_new(10, 11) } { + assert_eq!(10, a); + assert_eq!(11, b); + } else { + panic!("expected TT::AA"); + } + + if let T::A(a) = unsafe { t_new(10) } { + assert_eq!(10, a); + } else { + panic!("expected T::A"); + } +} diff --git a/tests/run-make/return-non-c-like-enum-from-c/test.c b/tests/run-make/return-non-c-like-enum-from-c/test.c new file mode 100644 index 00000000000..3ad135bab4a --- /dev/null +++ b/tests/run-make/return-non-c-like-enum-from-c/test.c @@ -0,0 +1,61 @@ +#include + +/* This is the code generated by cbindgen 0.12.1 for the `enum TT` + * type in nonclike.rs . */ +enum TT_Tag { + AA, + BB, +}; +typedef uint8_t TT_Tag; + +typedef struct { + uint64_t _0; + uint64_t _1; +} AA_Body; + +typedef struct { + TT_Tag tag; + union { + AA_Body aa; + }; +} TT; + +/* This is the code generated by cbindgen 0.12.1 for the `enum T` type + * in nonclike.rs . */ +enum T_Tag { + A, + B, +}; +typedef uint8_t T_Tag; + +typedef struct { + uint64_t _0; +} A_Body; + +typedef struct { + T_Tag tag; + union { + A_Body a; + }; +} T; + +TT tt_new(uint64_t a, uint64_t b) { + TT tt = { + .tag = AA, + .aa = { + ._0 = a, + ._1 = b, + }, + }; + return tt; +} + +T t_new(uint64_t a) { + T t = { + .tag = A, + .a = { + ._0 = a, + }, + }; + return t; +} diff --git a/tests/run-make/return-non-c-like-enum/Makefile b/tests/run-make/return-non-c-like-enum/Makefile new file mode 100644 index 00000000000..513311c8289 --- /dev/null +++ b/tests/run-make/return-non-c-like-enum/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) --crate-type=staticlib nonclike.rs + $(CC) test.c $(call STATICLIB,nonclike) $(call OUT_EXE,test) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + $(call RUN,test) diff --git a/tests/run-make/return-non-c-like-enum/nonclike.rs b/tests/run-make/return-non-c-like-enum/nonclike.rs new file mode 100644 index 00000000000..de529cf641a --- /dev/null +++ b/tests/run-make/return-non-c-like-enum/nonclike.rs @@ -0,0 +1,21 @@ +#[repr(C, u8)] +pub enum TT { + AA(u64, u64), + BB, +} + +#[no_mangle] +pub extern "C" fn tt_new(a: u64, b: u64) -> TT { + TT::AA(a, b) +} + +#[repr(C,u8)] +pub enum T { + A(u64), + B, +} + +#[no_mangle] +pub extern "C" fn t_new(a: u64) -> T { + T::A(a) +} diff --git a/tests/run-make/return-non-c-like-enum/test.c b/tests/run-make/return-non-c-like-enum/test.c new file mode 100644 index 00000000000..afadd3c10c5 --- /dev/null +++ b/tests/run-make/return-non-c-like-enum/test.c @@ -0,0 +1,63 @@ +#include +#include + +/* This is the code generated by cbindgen 0.12.1 for the `enum TT` + * type in nonclike.rs . */ +enum TT_Tag { + AA, + BB, +}; +typedef uint8_t TT_Tag; + +typedef struct { + uint64_t _0; + uint64_t _1; +} AA_Body; + +typedef struct { + TT_Tag tag; + union { + AA_Body aa; + }; +} TT; + +/* This is the code generated by cbindgen 0.12.1 for the `enum T` type + * in nonclike.rs . */ +enum T_Tag { + A, + B, +}; +typedef uint8_t T_Tag; + +typedef struct { + uint64_t _0; +} A_Body; + +typedef struct { + T_Tag tag; + union { + A_Body a; + }; +} T; + +/* These symbols are defined by the Rust staticlib built from + * nonclike.rs. */ +extern TT tt_new(uint64_t a, uint64_t b); +extern T t_new(uint64_t v); + +int main(int argc, char *argv[]) { + (void)argc; (void)argv; + + /* This example works. */ + TT tt = tt_new(10, 20); + assert(AA == tt.tag); + assert(10 == tt.aa._0); + assert(20 == tt.aa._1); + + /* This one used to segfault (see issue #68190). */ + T t = t_new(10); + assert(A == t.tag); + assert(10 == t.a._0); + + return 0; +} diff --git a/tests/run-make/rlib-chain/Makefile b/tests/run-make/rlib-chain/Makefile new file mode 100644 index 00000000000..236943a2a3b --- /dev/null +++ b/tests/run-make/rlib-chain/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +all: + $(RUSTC) m1.rs + $(RUSTC) m2.rs + $(RUSTC) m3.rs + $(RUSTC) m4.rs + $(call RUN,m4) + rm $(TMPDIR)/*lib + $(call RUN,m4) diff --git a/tests/run-make/rlib-chain/m1.rs b/tests/run-make/rlib-chain/m1.rs new file mode 100644 index 00000000000..665b206ccf1 --- /dev/null +++ b/tests/run-make/rlib-chain/m1.rs @@ -0,0 +1,2 @@ +#![crate_type = "rlib"] +pub fn m1() {} diff --git a/tests/run-make/rlib-chain/m2.rs b/tests/run-make/rlib-chain/m2.rs new file mode 100644 index 00000000000..eba12fe1218 --- /dev/null +++ b/tests/run-make/rlib-chain/m2.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] +extern crate m1; + +pub fn m2() { m1::m1() } diff --git a/tests/run-make/rlib-chain/m3.rs b/tests/run-make/rlib-chain/m3.rs new file mode 100644 index 00000000000..ade191db49c --- /dev/null +++ b/tests/run-make/rlib-chain/m3.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] +extern crate m2; + +pub fn m3() { m2::m2() } diff --git a/tests/run-make/rlib-chain/m4.rs b/tests/run-make/rlib-chain/m4.rs new file mode 100644 index 00000000000..fa8ec6079de --- /dev/null +++ b/tests/run-make/rlib-chain/m4.rs @@ -0,0 +1,3 @@ +extern crate m3; + +fn main() { m3::m3() } diff --git a/tests/run-make/rlib-format-packed-bundled-libs/Makefile b/tests/run-make/rlib-format-packed-bundled-libs/Makefile index 7fb6ce8d1e4..046c82f9469 100644 --- a/tests/run-make/rlib-format-packed-bundled-libs/Makefile +++ b/tests/run-make/rlib-format-packed-bundled-libs/Makefile @@ -1,4 +1,4 @@ --include ../../run-make-fulldeps/tools.mk +include ../../run-make-fulldeps/tools.mk # ignore-cross-compile diff --git a/tests/run-make/rustdoc-determinism/Makefile b/tests/run-make/rustdoc-determinism/Makefile new file mode 100644 index 00000000000..a3ef1690671 --- /dev/null +++ b/tests/run-make/rustdoc-determinism/Makefile @@ -0,0 +1,16 @@ +include ../tools.mk + +# Assert that the search index is generated deterministically, regardless of the +# order that crates are documented in. + +# ignore-windows +# Uses `diff`. + +all: + $(RUSTDOC) foo.rs -o $(TMPDIR)/foo_first + $(RUSTDOC) bar.rs -o $(TMPDIR)/foo_first + + $(RUSTDOC) bar.rs -o $(TMPDIR)/bar_first + $(RUSTDOC) foo.rs -o $(TMPDIR)/bar_first + + diff $(TMPDIR)/foo_first/search-index.js $(TMPDIR)/bar_first/search-index.js diff --git a/tests/run-make/rustdoc-determinism/bar.rs b/tests/run-make/rustdoc-determinism/bar.rs new file mode 100644 index 00000000000..ca05a6a9076 --- /dev/null +++ b/tests/run-make/rustdoc-determinism/bar.rs @@ -0,0 +1 @@ +pub struct Bar; diff --git a/tests/run-make/rustdoc-determinism/foo.rs b/tests/run-make/rustdoc-determinism/foo.rs new file mode 100644 index 00000000000..4a835673a59 --- /dev/null +++ b/tests/run-make/rustdoc-determinism/foo.rs @@ -0,0 +1 @@ +pub struct Foo; diff --git a/tests/run-make/rustdoc-error-lines/Makefile b/tests/run-make/rustdoc-error-lines/Makefile new file mode 100644 index 00000000000..2dc30f56b83 --- /dev/null +++ b/tests/run-make/rustdoc-error-lines/Makefile @@ -0,0 +1,13 @@ +include ../tools.mk + +# Test that hir-tree output doesn't crash and includes +# the string constant we would expect to see. + +all: + $(RUSTDOC) --test input.rs > $(TMPDIR)/output || true + $(CGREP) 'input.rs - foo (line 5)' < $(TMPDIR)/output + $(CGREP) 'input.rs:7:15' < $(TMPDIR)/output + $(CGREP) 'input.rs - bar (line 15)' < $(TMPDIR)/output + $(CGREP) 'input.rs:17:15' < $(TMPDIR)/output + $(CGREP) 'input.rs - bar (line 24)' < $(TMPDIR)/output + $(CGREP) 'input.rs:26:15' < $(TMPDIR)/output diff --git a/tests/run-make/rustdoc-error-lines/input.rs b/tests/run-make/rustdoc-error-lines/input.rs new file mode 100644 index 00000000000..b4db182e85f --- /dev/null +++ b/tests/run-make/rustdoc-error-lines/input.rs @@ -0,0 +1,28 @@ +// Test for #45868 + +// random #![feature] to ensure that crate attrs +// do not offset things +/// ```rust +/// #![feature(bool_to_option)] +/// let x: char = 1; +/// ``` +pub fn foo() { + +} + +/// Add some text around the test... +/// +/// ```rust +/// #![feature(bool_to_option)] +/// let x: char = 1; +/// ``` +/// +/// ...to make sure that the line number is still correct. +/// +/// Let's also add a second test in the same doc comment. +/// +/// ```rust +/// #![feature(bool_to_option)] +/// let x: char = 1; +/// ``` +pub fn bar() {} diff --git a/tests/run-make/rustdoc-io-error/Makefile b/tests/run-make/rustdoc-io-error/Makefile new file mode 100644 index 00000000000..27f5ecf94ab --- /dev/null +++ b/tests/run-make/rustdoc-io-error/Makefile @@ -0,0 +1,20 @@ +include ../tools.mk + +# This test verifies that rustdoc doesn't ICE when it encounters an IO error +# while generating files. Ideally this would be a rustdoc-ui test, so we could +# verify the error message as well. + +# ignore-windows +# The test uses `chmod`. + +OUTPUT_DIR := "$(TMPDIR)/rustdoc-io-error" + +# This test operates by creating a temporary directory and modifying its +# permissions so that it is not writable. We have to take special care to set +# the permissions back to normal so that it's able to be deleted later. +all: + mkdir -p $(OUTPUT_DIR) + chmod u-w $(OUTPUT_DIR) + -$(shell $(RUSTDOC) -o $(OUTPUT_DIR) foo.rs) + chmod u+w $(OUTPUT_DIR) + exit $($(.SHELLSTATUS) -eq 1) diff --git a/tests/run-make/rustdoc-io-error/foo.rs b/tests/run-make/rustdoc-io-error/foo.rs new file mode 100644 index 00000000000..4a835673a59 --- /dev/null +++ b/tests/run-make/rustdoc-io-error/foo.rs @@ -0,0 +1 @@ +pub struct Foo; diff --git a/tests/run-make/rustdoc-map-file/Makefile b/tests/run-make/rustdoc-map-file/Makefile new file mode 100644 index 00000000000..5cbf7747af6 --- /dev/null +++ b/tests/run-make/rustdoc-map-file/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTDOC) -Z unstable-options --generate-redirect-map foo.rs -o "$(TMPDIR)/out" + "$(PYTHON)" validate_json.py "$(TMPDIR)/out" diff --git a/tests/run-make/rustdoc-map-file/expected.json b/tests/run-make/rustdoc-map-file/expected.json new file mode 100644 index 00000000000..6b1ccbeac30 --- /dev/null +++ b/tests/run-make/rustdoc-map-file/expected.json @@ -0,0 +1,5 @@ +{ + "foo/macro.foo!.html": "foo/macro.foo.html", + "foo/private/struct.Quz.html": "foo/struct.Quz.html", + "foo/hidden/struct.Bar.html": "foo/struct.Bar.html" +} diff --git a/tests/run-make/rustdoc-map-file/foo.rs b/tests/run-make/rustdoc-map-file/foo.rs new file mode 100644 index 00000000000..e12b9d2292c --- /dev/null +++ b/tests/run-make/rustdoc-map-file/foo.rs @@ -0,0 +1,16 @@ +pub use private::Quz; +pub use hidden::Bar; + +mod private { + pub struct Quz; +} + +#[doc(hidden)] +pub mod hidden { + pub struct Bar; +} + +#[macro_export] +macro_rules! foo { + () => {} +} diff --git a/tests/run-make/rustdoc-map-file/validate_json.py b/tests/run-make/rustdoc-map-file/validate_json.py new file mode 100755 index 00000000000..5c14c90b70d --- /dev/null +++ b/tests/run-make/rustdoc-map-file/validate_json.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +import os +import sys +import json + + +def find_redirect_map_file(folder, errors): + for root, dirs, files in os.walk(folder): + for name in files: + if not name.endswith("redirect-map.json"): + continue + with open(os.path.join(root, name)) as f: + data = json.load(f) + with open("expected.json") as f: + expected = json.load(f) + for key in expected: + if expected[key] != data.get(key): + errors.append("Expected `{}` for key `{}`, found: `{}`".format( + expected[key], key, data.get(key))) + else: + del data[key] + for key in data: + errors.append("Extra data not expected: key: `{}`, data: `{}`".format( + key, data[key])) + return True + return False + + +if len(sys.argv) != 2: + print("Expected doc directory to check!") + sys.exit(1) + +errors = [] +if not find_redirect_map_file(sys.argv[1], errors): + print("Didn't find the map file in `{}`...".format(sys.argv[1])) + sys.exit(1) +for err in errors: + print("=> {}".format(err)) +if len(errors) != 0: + sys.exit(1) diff --git a/tests/run-make/rustdoc-output-path/Makefile b/tests/run-make/rustdoc-output-path/Makefile new file mode 100644 index 00000000000..8f5cda9e56e --- /dev/null +++ b/tests/run-make/rustdoc-output-path/Makefile @@ -0,0 +1,4 @@ +include ../tools.mk + +all: + $(RUSTDOC) -o "$(TMPDIR)/foo/bar/doc" foo.rs diff --git a/tests/run-make/rustdoc-output-path/foo.rs b/tests/run-make/rustdoc-output-path/foo.rs new file mode 100644 index 00000000000..4a835673a59 --- /dev/null +++ b/tests/run-make/rustdoc-output-path/foo.rs @@ -0,0 +1 @@ +pub struct Foo; diff --git a/tests/run-make/rustdoc-scrape-examples-macros/Makefile b/tests/run-make/rustdoc-scrape-examples-macros/Makefile new file mode 100644 index 00000000000..3cc6dcac366 --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-macros/Makefile @@ -0,0 +1,18 @@ +include ../../run-make/tools.mk + +OUTPUT_DIR := "$(TMPDIR)/rustdoc" +DYLIB_NAME := $(shell echo | $(RUSTC) --crate-name foobar_macro --crate-type dylib --print file-names -) + +all: + $(RUSTC) src/proc.rs --crate-name foobar_macro --edition=2021 --crate-type proc-macro --emit=dep-info,link + + $(RUSTC) src/lib.rs --crate-name foobar --edition=2021 --crate-type lib --emit=dep-info,link + + $(RUSTDOC) examples/ex.rs --crate-name ex --crate-type bin --output $(OUTPUT_DIR) \ + --extern foobar=$(TMPDIR)/libfoobar.rlib --extern foobar_macro=$(TMPDIR)/$(DYLIB_NAME) \ + -Z unstable-options --scrape-examples-output-path $(TMPDIR)/ex.calls --scrape-examples-target-crate foobar + + $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR) \ + -Z unstable-options --with-examples $(TMPDIR)/ex.calls + + $(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs diff --git a/tests/run-make/rustdoc-scrape-examples-macros/examples/ex.rs b/tests/run-make/rustdoc-scrape-examples-macros/examples/ex.rs new file mode 100644 index 00000000000..4d8c8b30e31 --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-macros/examples/ex.rs @@ -0,0 +1,27 @@ +extern crate foobar; +extern crate foobar_macro; + +use foobar::*; +use foobar_macro::*; + +a_proc_macro!(); // no + +#[an_attr_macro] +fn a() { + f(); // no +} + +#[an_attr_macro(with_span)] +fn b() { + f(); // yes +} + +fn c() { + a_rules_macro!(f()); // yes +} + +fn d() { + a_rules_macro!(()); // no +} + +fn main(){} diff --git a/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs new file mode 100644 index 00000000000..d8658a0f255 --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs @@ -0,0 +1,12 @@ +// Scraped example should only include line numbers for items b and c in ex.rs +// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '14' +// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '15' +// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '21' +// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '22' + +pub fn f() {} + +#[macro_export] +macro_rules! a_rules_macro { + ($e:expr) => { ($e, foobar::f()); } +} diff --git a/tests/run-make/rustdoc-scrape-examples-macros/src/proc.rs b/tests/run-make/rustdoc-scrape-examples-macros/src/proc.rs new file mode 100644 index 00000000000..46e518fdf6a --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-macros/src/proc.rs @@ -0,0 +1,39 @@ +extern crate proc_macro; +use proc_macro::*; + +#[proc_macro] +pub fn a_proc_macro(_item: TokenStream) -> TokenStream { + "fn ex() { foobar::f(); }".parse().unwrap() +} + +// inserts foobar::f() to the end of the function +#[proc_macro_attribute] +pub fn an_attr_macro(attr: TokenStream, item: TokenStream) -> TokenStream { + let new_call: TokenStream = "foobar::f();".parse().unwrap(); + + let mut tokens = item.into_iter(); + + let fn_tok = tokens.next().unwrap(); + let ident_tok = tokens.next().unwrap(); + let args_tok = tokens.next().unwrap(); + let body = match tokens.next().unwrap() { + TokenTree::Group(g) => { + let new_g = Group::new(g.delimiter(), new_call); + let mut outer_g = Group::new( + g.delimiter(), + [TokenTree::Group(g.clone()), TokenTree::Group(new_g)].into_iter().collect(), + ); + + if attr.to_string() == "with_span" { + outer_g.set_span(g.span()); + } + + TokenTree::Group(outer_g) + } + _ => unreachable!(), + }; + + let tokens = vec![fn_tok, ident_tok, args_tok, body].into_iter().collect::(); + + tokens +} diff --git a/tests/run-make/rustdoc-target-spec-json-path/Makefile b/tests/run-make/rustdoc-target-spec-json-path/Makefile new file mode 100644 index 00000000000..6d0bc4186f2 --- /dev/null +++ b/tests/run-make/rustdoc-target-spec-json-path/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# Test that rustdoc will properly canonicalize the target spec json path just like rustc + +OUTPUT_DIR := "$(TMPDIR)/rustdoc-target-spec-json-path" + +all: + $(RUSTC) --crate-type lib dummy_core.rs --target target.json + $(RUSTDOC) -o $(OUTPUT_DIR) -L $(TMPDIR) my_crate.rs --target target.json diff --git a/tests/run-make/rustdoc-target-spec-json-path/dummy_core.rs b/tests/run-make/rustdoc-target-spec-json-path/dummy_core.rs new file mode 100644 index 00000000000..da27b7f3463 --- /dev/null +++ b/tests/run-make/rustdoc-target-spec-json-path/dummy_core.rs @@ -0,0 +1,2 @@ +#![feature(no_core)] +#![no_core] diff --git a/tests/run-make/rustdoc-target-spec-json-path/my_crate.rs b/tests/run-make/rustdoc-target-spec-json-path/my_crate.rs new file mode 100644 index 00000000000..12aa0822084 --- /dev/null +++ b/tests/run-make/rustdoc-target-spec-json-path/my_crate.rs @@ -0,0 +1,3 @@ +#![feature(no_core)] +#![no_core] +extern crate dummy_core; diff --git a/tests/run-make/rustdoc-target-spec-json-path/target.json b/tests/run-make/rustdoc-target-spec-json-path/target.json new file mode 100644 index 00000000000..34357182c20 --- /dev/null +++ b/tests/run-make/rustdoc-target-spec-json-path/target.json @@ -0,0 +1,38 @@ +{ + "arch": "x86_64", + "cpu": "x86-64", + "crt-static-respected": true, + "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", + "dynamic-linking": true, + "env": "gnu", + "executables": true, + "has-elf-tls": true, + "has-rpath": true, + "linker-is-gnu": true, + "llvm-target": "x86_64-unknown-linux-gnu", + "max-atomic-width": 64, + "os": "linux", + "position-independent-executables": true, + "pre-link-args": { + "gcc": [ + "-m64" + ] + }, + "relro-level": "full", + "stack-probes": { + "kind": "inline-or-call", + "min-llvm-version-for-inline": [ + 11, + 0, + 1 + ] + }, + "supported-sanitizers": [ + "address", + "leak", + "memory", + "thread" + ], + "target-family": "unix", + "target-pointer-width": "64" +} diff --git a/tests/run-make/rustdoc-themes/Makefile b/tests/run-make/rustdoc-themes/Makefile new file mode 100644 index 00000000000..a6d9a43addf --- /dev/null +++ b/tests/run-make/rustdoc-themes/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +# Test that rustdoc will properly load in a theme file and display it in the theme selector. + +OUTPUT_DIR := "$(TMPDIR)/rustdoc-themes" + +all: + cp $(S)/src/librustdoc/html/static/css/themes/light.css $(TMPDIR)/test.css + $(RUSTDOC) -o $(OUTPUT_DIR) foo.rs --theme $(TMPDIR)/test.css + $(HTMLDOCCK) $(OUTPUT_DIR) foo.rs diff --git a/tests/run-make/rustdoc-themes/foo.rs b/tests/run-make/rustdoc-themes/foo.rs new file mode 100644 index 00000000000..995544aeff9 --- /dev/null +++ b/tests/run-make/rustdoc-themes/foo.rs @@ -0,0 +1,4 @@ +// @has test.css +// @has foo/struct.Foo.html +// @has - '//*[@id="rustdoc-vars"]/@data-themes' 'test' +pub struct Foo; diff --git a/tests/run-make/sanitizer-cdylib-link/Makefile b/tests/run-make/sanitizer-cdylib-link/Makefile new file mode 100644 index 00000000000..691585268bf --- /dev/null +++ b/tests/run-make/sanitizer-cdylib-link/Makefile @@ -0,0 +1,16 @@ +# needs-sanitizer-support +# needs-sanitizer-address + +include ../tools.mk + +LOG := $(TMPDIR)/log.txt + +# This test builds a shared object, then an executable that links it as a native +# rust library (contrast to an rlib). The shared library and executable both +# are compiled with address sanitizer, and we assert that a fault in the cdylib +# is correctly detected. + +all: + $(RUSTC) -g -Z sanitizer=address --crate-type cdylib --target $(TARGET) library.rs + $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -llibrary program.rs + LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow diff --git a/tests/run-make/sanitizer-cdylib-link/library.rs b/tests/run-make/sanitizer-cdylib-link/library.rs new file mode 100644 index 00000000000..f2a52cb5ca1 --- /dev/null +++ b/tests/run-make/sanitizer-cdylib-link/library.rs @@ -0,0 +1,5 @@ +#[no_mangle] +pub extern "C" fn overflow() { + let xs = [0, 1, 2, 3]; + let _y = unsafe { *xs.as_ptr().offset(4) }; +} diff --git a/tests/run-make/sanitizer-cdylib-link/program.rs b/tests/run-make/sanitizer-cdylib-link/program.rs new file mode 100644 index 00000000000..ef053aa2e7a --- /dev/null +++ b/tests/run-make/sanitizer-cdylib-link/program.rs @@ -0,0 +1,7 @@ +extern "C" { + fn overflow(); +} + +fn main() { + unsafe { overflow() } +} diff --git a/tests/run-make/sanitizer-dylib-link/Makefile b/tests/run-make/sanitizer-dylib-link/Makefile new file mode 100644 index 00000000000..b0a91e5b197 --- /dev/null +++ b/tests/run-make/sanitizer-dylib-link/Makefile @@ -0,0 +1,16 @@ +# needs-sanitizer-support +# needs-sanitizer-address + +include ../tools.mk + +LOG := $(TMPDIR)/log.txt + +# This test builds a shared object, then an executable that links it as a native +# rust library (contrast to an rlib). The shared library and executable both +# are compiled with address sanitizer, and we assert that a fault in the dylib +# is correctly detected. + +all: + $(RUSTC) -g -Z sanitizer=address --crate-type dylib --target $(TARGET) library.rs + $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -llibrary program.rs + LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow diff --git a/tests/run-make/sanitizer-dylib-link/library.rs b/tests/run-make/sanitizer-dylib-link/library.rs new file mode 100644 index 00000000000..f2a52cb5ca1 --- /dev/null +++ b/tests/run-make/sanitizer-dylib-link/library.rs @@ -0,0 +1,5 @@ +#[no_mangle] +pub extern "C" fn overflow() { + let xs = [0, 1, 2, 3]; + let _y = unsafe { *xs.as_ptr().offset(4) }; +} diff --git a/tests/run-make/sanitizer-dylib-link/program.rs b/tests/run-make/sanitizer-dylib-link/program.rs new file mode 100644 index 00000000000..ef053aa2e7a --- /dev/null +++ b/tests/run-make/sanitizer-dylib-link/program.rs @@ -0,0 +1,7 @@ +extern "C" { + fn overflow(); +} + +fn main() { + unsafe { overflow() } +} diff --git a/tests/run-make/sanitizer-staticlib-link/Makefile b/tests/run-make/sanitizer-staticlib-link/Makefile new file mode 100644 index 00000000000..7b1a286ed12 --- /dev/null +++ b/tests/run-make/sanitizer-staticlib-link/Makefile @@ -0,0 +1,20 @@ +# needs-sanitizer-support +# needs-sanitizer-address + +include ../tools.mk + +# This test first builds a staticlib with AddressSanitizer and checks that +# linking it to an executable fails due to the missing sanitizer runtime. +# It then builds an executable linking to the staticlib and checks that +# the fault in the staticlib is detected correctly. + +# Note that checking for the link failure actually checks two things at once: +# 1) That the library has the sanitizer intrumentation +# 2) and that library does not have the sanitizer runtime + +all: + $(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs + ! $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS) + $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -L . program.rs + LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow + diff --git a/tests/run-make/sanitizer-staticlib-link/library.rs b/tests/run-make/sanitizer-staticlib-link/library.rs new file mode 100644 index 00000000000..f2a52cb5ca1 --- /dev/null +++ b/tests/run-make/sanitizer-staticlib-link/library.rs @@ -0,0 +1,5 @@ +#[no_mangle] +pub extern "C" fn overflow() { + let xs = [0, 1, 2, 3]; + let _y = unsafe { *xs.as_ptr().offset(4) }; +} diff --git a/tests/run-make/sanitizer-staticlib-link/program.c b/tests/run-make/sanitizer-staticlib-link/program.c new file mode 100644 index 00000000000..735e2b147fd --- /dev/null +++ b/tests/run-make/sanitizer-staticlib-link/program.c @@ -0,0 +1,6 @@ +void overflow(); + +int main() { + overflow(); + return 0; +} diff --git a/tests/run-make/sanitizer-staticlib-link/program.rs b/tests/run-make/sanitizer-staticlib-link/program.rs new file mode 100644 index 00000000000..ec59bdb11c8 --- /dev/null +++ b/tests/run-make/sanitizer-staticlib-link/program.rs @@ -0,0 +1,10 @@ +#[link(name = "library")] +extern "C" { + fn overflow(); +} + +fn main() { + unsafe { + overflow(); + } +} diff --git a/tests/run-make/separate-link-fail/Makefile b/tests/run-make/separate-link-fail/Makefile new file mode 100644 index 00000000000..bfd18fbf972 --- /dev/null +++ b/tests/run-make/separate-link-fail/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + echo 'fn main(){}' > $(TMPDIR)/main.rs + # Make sure that this fails + ! $(RUSTC) -Z link-only $(TMPDIR)/main.rs 2> $(TMPDIR)/stderr.txt + $(CGREP) "The input does not look like a .rlink file" < $(TMPDIR)/stderr.txt diff --git a/tests/run-make/separate-link/Makefile b/tests/run-make/separate-link/Makefile new file mode 100644 index 00000000000..3ccdb6275d1 --- /dev/null +++ b/tests/run-make/separate-link/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + echo 'fn main(){}' | $(RUSTC) -Z no-link - + $(RUSTC) -Z link-only $(TMPDIR)/rust_out.rlink + $(call RUN,rust_out) diff --git a/tests/run-make/sepcomp-cci-copies/Makefile b/tests/run-make/sepcomp-cci-copies/Makefile new file mode 100644 index 00000000000..df289d0b0b1 --- /dev/null +++ b/tests/run-make/sepcomp-cci-copies/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +# Check that cross-crate inlined items are inlined in all compilation units +# that refer to them, and not in any other compilation units. +# Note that we have to pass `-C codegen-units=6` because up to two CGUs may be +# created for each source module (see `rustc_const_eval::monomorphize::partitioning`). + +all: + $(RUSTC) cci_lib.rs + $(RUSTC) foo.rs --emit=llvm-ir -C codegen-units=6 \ + -Z inline-in-all-cgus + [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ .*cci_fn)" -eq "2" ] diff --git a/tests/run-make/sepcomp-cci-copies/cci_lib.rs b/tests/run-make/sepcomp-cci-copies/cci_lib.rs new file mode 100644 index 00000000000..869d4a6cd3e --- /dev/null +++ b/tests/run-make/sepcomp-cci-copies/cci_lib.rs @@ -0,0 +1,6 @@ +#![crate_type = "rlib"] + +#[inline] +pub fn cci_fn() -> usize { + 1234 +} diff --git a/tests/run-make/sepcomp-cci-copies/foo.rs b/tests/run-make/sepcomp-cci-copies/foo.rs new file mode 100644 index 00000000000..ba251fcb0ac --- /dev/null +++ b/tests/run-make/sepcomp-cci-copies/foo.rs @@ -0,0 +1,25 @@ +extern crate cci_lib; +use cci_lib::cci_fn; + +fn call1() -> usize { + cci_fn() +} + +mod a { + use cci_lib::cci_fn; + pub fn call2() -> usize { + cci_fn() + } +} + +mod b { + pub fn call3() -> usize { + 0 + } +} + +fn main() { + call1(); + a::call2(); + b::call3(); +} diff --git a/tests/run-make/sepcomp-inlining/Makefile b/tests/run-make/sepcomp-inlining/Makefile new file mode 100644 index 00000000000..327aeb75e5e --- /dev/null +++ b/tests/run-make/sepcomp-inlining/Makefile @@ -0,0 +1,15 @@ +include ../tools.mk + +# Test that #[inline] functions still get inlined across compilation unit +# boundaries. Compilation should produce three IR files, but only the two +# compilation units that have a usage of the #[inline] function should +# contain a definition. Also, the non-#[inline] function should be defined +# in only one compilation unit. + +all: + $(RUSTC) foo.rs --emit=llvm-ir -C codegen-units=3 \ + -Z inline-in-all-cgus + [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ i32\ .*inlined)" -eq "0" ] + [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ internal\ i32\ .*inlined)" -eq "2" ] + [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ hidden\ i32\ .*normal)" -eq "1" ] + [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c declare\ hidden\ i32\ .*normal)" -eq "2" ] diff --git a/tests/run-make/sepcomp-inlining/foo.rs b/tests/run-make/sepcomp-inlining/foo.rs new file mode 100644 index 00000000000..2fe5f9cb726 --- /dev/null +++ b/tests/run-make/sepcomp-inlining/foo.rs @@ -0,0 +1,30 @@ +#![feature(start)] + +#[inline] +fn inlined() -> u32 { + 1234 +} + +fn normal() -> u32 { + 2345 +} + +mod a { + pub fn f() -> u32 { + ::inlined() + ::normal() + } +} + +mod b { + pub fn f() -> u32 { + ::inlined() + ::normal() + } +} + +#[start] +fn start(_: isize, _: *const *const u8) -> isize { + a::f(); + b::f(); + + 0 +} diff --git a/tests/run-make/sepcomp-separate/Makefile b/tests/run-make/sepcomp-separate/Makefile new file mode 100644 index 00000000000..62cf54a88fb --- /dev/null +++ b/tests/run-make/sepcomp-separate/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# Test that separate compilation actually puts code into separate compilation +# units. `foo.rs` defines `magic_fn` in three different modules, which should +# wind up in three different compilation units. + +all: + $(RUSTC) foo.rs --emit=llvm-ir -C codegen-units=3 + [ "$$(cat "$(TMPDIR)"/foo.*.ll | grep -c define\ .*magic_fn)" -eq "3" ] diff --git a/tests/run-make/sepcomp-separate/foo.rs b/tests/run-make/sepcomp-separate/foo.rs new file mode 100644 index 00000000000..169bafa9b3a --- /dev/null +++ b/tests/run-make/sepcomp-separate/foo.rs @@ -0,0 +1,21 @@ +fn magic_fn() -> usize { + 1234 +} + +mod a { + pub fn magic_fn() -> usize { + 2345 + } +} + +mod b { + pub fn magic_fn() -> usize { + 3456 + } +} + +fn main() { + magic_fn(); + a::magic_fn(); + b::magic_fn(); +} diff --git a/tests/run-make/share-generics-dylib/Makefile b/tests/run-make/share-generics-dylib/Makefile new file mode 100644 index 00000000000..065fb574c3c --- /dev/null +++ b/tests/run-make/share-generics-dylib/Makefile @@ -0,0 +1,22 @@ +# This test makes sure all generic instances get re-exported from Rust dylibs for use by +# `-Zshare-generics`. There are two rlibs (`instance_provider_a` and `instance_provider_b`) +# which both provide an instance of `Cell::set`. There is `instance_user_dylib` which is +# supposed to re-export both these instances, and then there are `instance_user_a_rlib` and +# `instance_user_b_rlib` which each rely on a specific instance to be available. +# +# In the end everything is linked together into `linked_leaf`. If `instance_user_dylib` does +# not export both then we'll get an `undefined reference` error for one of the instances. +# +# This is regression test for https://github.com/rust-lang/rust/issues/67276. + +include ../../run-make-fulldeps/tools.mk + +COMMON_ARGS=-Cprefer-dynamic -Zshare-generics=yes -Ccodegen-units=1 -Csymbol-mangling-version=v0 + +all: + $(RUSTC) instance_provider_a.rs $(COMMON_ARGS) --crate-type=rlib + $(RUSTC) instance_provider_b.rs $(COMMON_ARGS) --crate-type=rlib + $(RUSTC) instance_user_dylib.rs $(COMMON_ARGS) --crate-type=dylib + $(RUSTC) instance_user_a_rlib.rs $(COMMON_ARGS) --crate-type=rlib + $(RUSTC) instance_user_b_rlib.rs $(COMMON_ARGS) --crate-type=rlib + $(RUSTC) linked_leaf.rs $(COMMON_ARGS) --crate-type=bin diff --git a/tests/run-make/share-generics-dylib/instance_provider_a.rs b/tests/run-make/share-generics-dylib/instance_provider_a.rs new file mode 100644 index 00000000000..b4e125ac052 --- /dev/null +++ b/tests/run-make/share-generics-dylib/instance_provider_a.rs @@ -0,0 +1,6 @@ +use std::cell::Cell; + +pub fn foo() { + let a: Cell = Cell::new(1); + a.set(123); +} diff --git a/tests/run-make/share-generics-dylib/instance_provider_b.rs b/tests/run-make/share-generics-dylib/instance_provider_b.rs new file mode 100644 index 00000000000..f613db873e6 --- /dev/null +++ b/tests/run-make/share-generics-dylib/instance_provider_b.rs @@ -0,0 +1,6 @@ +use std::cell::Cell; + +pub fn foo() { + let b: Cell = Cell::new(1); + b.set(123); +} diff --git a/tests/run-make/share-generics-dylib/instance_user_a_rlib.rs b/tests/run-make/share-generics-dylib/instance_user_a_rlib.rs new file mode 100644 index 00000000000..c8e6ab95cf9 --- /dev/null +++ b/tests/run-make/share-generics-dylib/instance_user_a_rlib.rs @@ -0,0 +1,9 @@ +extern crate instance_provider_a as upstream; +use std::cell::Cell; + +pub fn foo() { + upstream::foo(); + + let b: Cell = Cell::new(1); + b.set(123); +} diff --git a/tests/run-make/share-generics-dylib/instance_user_b_rlib.rs b/tests/run-make/share-generics-dylib/instance_user_b_rlib.rs new file mode 100644 index 00000000000..7c34af6d0dc --- /dev/null +++ b/tests/run-make/share-generics-dylib/instance_user_b_rlib.rs @@ -0,0 +1,9 @@ +extern crate instance_provider_b as upstream; +use std::cell::Cell; + +pub fn foo() { + upstream::foo(); + + let b: Cell = Cell::new(1); + b.set(123); +} diff --git a/tests/run-make/share-generics-dylib/instance_user_dylib.rs b/tests/run-make/share-generics-dylib/instance_user_dylib.rs new file mode 100644 index 00000000000..7c8368eec65 --- /dev/null +++ b/tests/run-make/share-generics-dylib/instance_user_dylib.rs @@ -0,0 +1,7 @@ +extern crate instance_provider_a; +extern crate instance_provider_b; + +pub fn foo() { + instance_provider_a::foo(); + instance_provider_b::foo(); +} diff --git a/tests/run-make/share-generics-dylib/linked_leaf.rs b/tests/run-make/share-generics-dylib/linked_leaf.rs new file mode 100644 index 00000000000..e510dad691c --- /dev/null +++ b/tests/run-make/share-generics-dylib/linked_leaf.rs @@ -0,0 +1,15 @@ +extern crate instance_user_dylib; +extern crate instance_user_a_rlib; +extern crate instance_user_b_rlib; + +use std::cell::Cell; + +fn main() { + + instance_user_a_rlib::foo(); + instance_user_b_rlib::foo(); + instance_user_dylib::foo(); + + let a: Cell = Cell::new(1); + a.set(123); +} diff --git a/tests/run-make/simd-ffi/Makefile b/tests/run-make/simd-ffi/Makefile new file mode 100644 index 00000000000..29735347041 --- /dev/null +++ b/tests/run-make/simd-ffi/Makefile @@ -0,0 +1,47 @@ +include ../tools.mk + +TARGETS = +ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm) +# construct a fairly exhaustive list of platforms that we +# support. These ones don't follow a pattern +TARGETS += arm-linux-androideabi arm-unknown-linux-gnueabihf arm-unknown-linux-gnueabi +endif + +ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) +X86_ARCHS = i686 x86_64 +else +X86_ARCHS = +endif + +# these ones do, each OS lists the architectures it supports +LINUX=$(filter aarch64 mips,$(LLVM_COMPONENTS)) $(X86_ARCHS) +ifeq ($(filter mips,$(LLVM_COMPONENTS)),mips) +LINUX += mipsel +endif + +WINDOWS=$(X86_ARCHS) +# fails with: failed to get iphonesimulator SDK path: no such file or directory +#IOS=i386 aarch64 armv7 +DARWIN=$(X86_ARCHS) + +$(foreach arch,$(LINUX),$(eval TARGETS += $(arch)-unknown-linux-gnu)) +$(foreach arch,$(WINDOWS),$(eval TARGETS += $(arch)-pc-windows-gnu)) +#$(foreach arch,$(IOS),$(eval TARGETS += $(arch)-apple-ios)) +$(foreach arch,$(DARWIN),$(eval TARGETS += $(arch)-apple-darwin)) + +all: $(TARGETS) + +define MK_TARGETS +# compile the rust file to the given target, but only to asm and IR +# form, to avoid having to have an appropriate linker. +# +# we need some features because the integer SIMD instructions are not +# enabled by-default for i686 and ARM; these features will be invalid +# on some platforms, but LLVM just prints a warning so that's fine for +# now. +$(1): simd.rs + $$(RUSTC) --target=$(1) --emit=llvm-ir,asm simd.rs \ + -C target-feature='+neon,+sse2' -C extra-filename=-$(1) +endef + +$(foreach targetxxx,$(TARGETS),$(eval $(call MK_TARGETS,$(targetxxx)))) diff --git a/tests/run-make/simd-ffi/simd.rs b/tests/run-make/simd-ffi/simd.rs new file mode 100644 index 00000000000..d11cfd77c5b --- /dev/null +++ b/tests/run-make/simd-ffi/simd.rs @@ -0,0 +1,82 @@ +// ensures that public symbols are not removed completely +#![crate_type = "lib"] +// we can compile to a variety of platforms, because we don't need +// cross-compiled standard libraries. +#![feature(no_core, auto_traits)] +#![no_core] +#![feature(repr_simd, simd_ffi, link_llvm_intrinsics, lang_items, rustc_attrs)] + +#[derive(Copy)] +#[repr(simd)] +pub struct f32x4(f32, f32, f32, f32); + +extern "C" { + #[link_name = "llvm.sqrt.v4f32"] + fn vsqrt(x: f32x4) -> f32x4; +} + +pub fn foo(x: f32x4) -> f32x4 { + unsafe { vsqrt(x) } +} + +#[derive(Copy)] +#[repr(simd)] +pub struct i32x4(i32, i32, i32, i32); + +extern "C" { + // _mm_sll_epi32 + #[cfg(any(target_arch = "x86", target_arch = "x86-64"))] + #[link_name = "llvm.x86.sse2.psll.d"] + fn integer(a: i32x4, b: i32x4) -> i32x4; + + // vmaxq_s32 + #[cfg(target_arch = "arm")] + #[link_name = "llvm.arm.neon.vmaxs.v4i32"] + fn integer(a: i32x4, b: i32x4) -> i32x4; + // vmaxq_s32 + #[cfg(target_arch = "aarch64")] + #[link_name = "llvm.aarch64.neon.maxs.v4i32"] + fn integer(a: i32x4, b: i32x4) -> i32x4; + + // just some substitute foreign symbol, not an LLVM intrinsic; so + // we still get type checking, but not as detailed as (ab)using + // LLVM. + #[cfg(not(any( + target_arch = "x86", + target_arch = "x86-64", + target_arch = "arm", + target_arch = "aarch64" + )))] + fn integer(a: i32x4, b: i32x4) -> i32x4; +} + +pub fn bar(a: i32x4, b: i32x4) -> i32x4 { + unsafe { integer(a, b) } +} + +#[lang = "sized"] +pub trait Sized {} + +#[lang = "copy"] +pub trait Copy {} + +impl Copy for f32 {} +impl Copy for i32 {} + +pub mod marker { + pub use Copy; +} + +#[lang = "freeze"] +auto trait Freeze {} + +#[macro_export] +#[rustc_builtin_macro] +macro_rules! Copy { + () => {}; +} +#[macro_export] +#[rustc_builtin_macro] +macro_rules! derive { + () => {}; +} diff --git a/tests/run-make/simple-dylib/Makefile b/tests/run-make/simple-dylib/Makefile new file mode 100644 index 00000000000..5dda5d66d1c --- /dev/null +++ b/tests/run-make/simple-dylib/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk +all: + $(RUSTC) bar.rs --crate-type=dylib -C prefer-dynamic + $(RUSTC) foo.rs + $(call RUN,foo) diff --git a/tests/run-make/simple-dylib/bar.rs b/tests/run-make/simple-dylib/bar.rs new file mode 100644 index 00000000000..c5c0bc606cd --- /dev/null +++ b/tests/run-make/simple-dylib/bar.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/simple-dylib/foo.rs b/tests/run-make/simple-dylib/foo.rs new file mode 100644 index 00000000000..8d68535e3b6 --- /dev/null +++ b/tests/run-make/simple-dylib/foo.rs @@ -0,0 +1,5 @@ +extern crate bar; + +fn main() { + bar::bar(); +} diff --git a/tests/run-make/simple-rlib/Makefile b/tests/run-make/simple-rlib/Makefile new file mode 100644 index 00000000000..d912b8a7bab --- /dev/null +++ b/tests/run-make/simple-rlib/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk +all: + $(RUSTC) bar.rs --crate-type=rlib + $(RUSTC) foo.rs + $(call RUN,foo) diff --git a/tests/run-make/simple-rlib/bar.rs b/tests/run-make/simple-rlib/bar.rs new file mode 100644 index 00000000000..c5c0bc606cd --- /dev/null +++ b/tests/run-make/simple-rlib/bar.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/simple-rlib/foo.rs b/tests/run-make/simple-rlib/foo.rs new file mode 100644 index 00000000000..8d68535e3b6 --- /dev/null +++ b/tests/run-make/simple-rlib/foo.rs @@ -0,0 +1,5 @@ +extern crate bar; + +fn main() { + bar::bar(); +} diff --git a/tests/run-make/split-debuginfo/Makefile b/tests/run-make/split-debuginfo/Makefile new file mode 100644 index 00000000000..44cda0d3d11 --- /dev/null +++ b/tests/run-make/split-debuginfo/Makefile @@ -0,0 +1,308 @@ +include ../tools.mk + +all: off packed unpacked + +ifeq ($(UNAME),Darwin) +# If disabled, don't run `dsymutil`. +off: + rm -rf $(TMPDIR)/*.dSYM + $(RUSTC) foo.rs -g -C split-debuginfo=off + [ ! -d $(TMPDIR)/foo.dSYM ] + +# Packed by default, but only if debuginfo is requested +packed: + rm -rf $(TMPDIR)/*.dSYM + $(RUSTC) foo.rs + [ ! -d $(TMPDIR)/foo.dSYM ] + rm -rf $(TMPDIR)/*.dSYM + $(RUSTC) foo.rs -g + [ -d $(TMPDIR)/foo.dSYM ] + rm -rf $(TMPDIR)/*.dSYM + $(RUSTC) foo.rs -g -C split-debuginfo=packed + [ -d $(TMPDIR)/foo.dSYM ] + rm -rf $(TMPDIR)/*.dSYM + +# Object files are preserved with unpacked and `dsymutil` isn't run +unpacked: + $(RUSTC) foo.rs -g -C split-debuginfo=unpacked + ls $(TMPDIR)/*.o + [ ! -d $(TMPDIR)/foo.dSYM ] +else +ifdef IS_WINDOWS +# Windows only supports packed debuginfo - nothing to test. +off: +packed: +unpacked: +else +# Some non-Windows, non-Darwin platforms are not stable, and some are. +ifeq ($(UNAME),Linux) + UNSTABLEOPTS := +else + UNSTABLEOPTS := -Zunstable-options +endif + +# - Debuginfo in `.o` files +# - `.o` deleted +# - `.dwo` never created +# - `.dwp` never created +off: + $(RUSTC) foo.rs -g -C $(UNSTABLEOPTS) split-debuginfo=off + [ ! -f $(TMPDIR)/*.dwp ] + [ ! -f $(TMPDIR)/*.dwo ] + $(RUSTC) foo.rs -g + [ ! -f $(TMPDIR)/*.dwp ] + [ ! -f $(TMPDIR)/*.dwo ] + +packed: packed-split packed-single packed-lto packed-remapped packed-crosscrate + +# - Debuginfo in `.dwo` files +# - `.o` deleted +# - `.dwo` deleted +# - `.dwp` present +packed-split: + $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=packed -Zsplit-dwarf-kind=split + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/foo.dwp + rm $(TMPDIR)/$(call BIN,foo) + +# - Debuginfo in `.o` files +# - `.o` deleted +# - `.dwo` never created +# - `.dwp` present +packed-single: + $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=packed -Zsplit-dwarf-kind=single + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/foo.dwp + rm $(TMPDIR)/$(call BIN,foo) + +packed-lto: packed-lto-split packed-lto-single + +# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated +# - `.o` never created +# - `.dwo` never created +# - `.dwp` never created +packed-lto-split: + $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split \ + --crate-type=rlib -Clinker-plugin-lto + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/libbaz.rlib + +# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated +# - `.o` never created +# - `.dwo` never created +# - `.dwp` never created +packed-lto-single: + $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=single \ + --crate-type=rlib -Clinker-plugin-lto + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/libbaz.rlib + +packed-remapped: packed-remapped-split packed-remapped-single + +# - Debuginfo in `.dwo` files +# - `.o` and binary refer to remapped `.dwo` paths which do not exist +# - `.o` deleted +# - `.dwo` deleted +# - `.dwp` present +packed-remapped-split: + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ + -Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/foo.dwp + rm $(TMPDIR)/$(call BIN,foo) + +# - Debuginfo in `.o` files +# - `.o` and binary refer to remapped `.o` paths which do not exist +# - `.o` deleted +# - `.dwo` never created +# - `.dwp` present +packed-remapped-single: + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ + -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/foo.dwp + rm $(TMPDIR)/$(call BIN,foo) + +packed-crosscrate: packed-crosscrate-split packed-crosscrate-single + +# - Debuginfo in `.dwo` files +# - (bar) `.rlib` file created, contains `.dwo` +# - (bar) `.o` deleted +# - (bar) `.dwo` deleted +# - (bar) `.dwp` never created +# - (main) `.o` deleted +# - (main) `.dwo` deleted +# - (main) `.dwp` present +packed-crosscrate-split: + $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=packed \ + -Zsplit-dwarf-kind=split -C debuginfo=2 -g bar.rs + ls $(TMPDIR)/*.rlib + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ + -C split-debuginfo=packed -Zsplit-dwarf-kind=split -C debuginfo=2 -g main.rs + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/main.dwp + rm $(TMPDIR)/$(call BIN,main) + +# - Debuginfo in `.o` files +# - (bar) `.rlib` file created, contains `.o` +# - (bar) `.o` deleted +# - (bar) `.dwo` never created +# - (bar) `.dwp` never created +# - (main) `.o` deleted +# - (main) `.dwo` never created +# - (main) `.dwp` present +packed-crosscrate-single: + $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=packed \ + -Zsplit-dwarf-kind=single -C debuginfo=2 -g bar.rs + ls $(TMPDIR)/*.rlib + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ + -C split-debuginfo=packed -Zsplit-dwarf-kind=single -C debuginfo=2 -g main.rs + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/main.dwp + rm $(TMPDIR)/$(call BIN,main) + +unpacked: unpacked-split unpacked-single unpacked-lto unpacked-remapped unpacked-crosscrate + +# - Debuginfo in `.dwo` files +# - `.o` deleted +# - `.dwo` present +# - `.dwp` never created +unpacked-split: + $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=unpacked -Zsplit-dwarf-kind=split + ls $(TMPDIR)/*.o && exit 1 || exit 0 + rm $(TMPDIR)/*.dwo + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,foo) + +# - Debuginfo in `.o` files +# - `.o` present +# - `.dwo` never created +# - `.dwp` never created +unpacked-single: + $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=unpacked -Zsplit-dwarf-kind=single + ls $(TMPDIR)/*.o + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,foo) + +unpacked-lto: packed-lto-split packed-lto-single + +# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated +# - `.o` never created +# - `.dwo` never created +# - `.dwp` never created +unpacked-lto-split: + $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=split \ + --crate-type=rlib -Clinker-plugin-lto + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/libbaz.rlib + +# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated +# - `.o` never created +# - `.dwo` never created +# - `.dwp` never created +unpacked-lto-single: + $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=single \ + --crate-type=rlib -Clinker-plugin-lto + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/libbaz.rlib + +unpacked-remapped: unpacked-remapped-split unpacked-remapped-single + +# - Debuginfo in `.dwo` files +# - `.o` and binary refer to remapped `.dwo` paths which do not exist +# - `.o` deleted +# - `.dwo` present +# - `.dwp` never created +unpacked-remapped-split: + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ + -Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 + ls $(TMPDIR)/*.o && exit 1 || exit 0 + rm $(TMPDIR)/*.dwo + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,foo) + +# - Debuginfo in `.o` files +# - `.o` and binary refer to remapped `.o` paths which do not exist +# - `.o` present +# - `.dwo` never created +# - `.dwp` never created +unpacked-remapped-single: + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ + -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 + rm $(TMPDIR)/*.o + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,foo) + +unpacked-crosscrate: unpacked-crosscrate-split unpacked-crosscrate-single + +# - Debuginfo in `.dwo` files +# - (bar) `.rlib` file created, contains `.dwo` +# - (bar) `.o` deleted +# - (bar) `.dwo` present +# - (bar) `.dwp` never created +# - (main) `.o` deleted +# - (main) `.dwo` present +# - (main) `.dwp` never created +unpacked-crosscrate-split: + $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=unpacked \ + -Zsplit-dwarf-kind=split -C debuginfo=2 -g bar.rs + ls $(TMPDIR)/*.rlib + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ + -C split-debuginfo=unpacked -Zsplit-dwarf-kind=split -C debuginfo=2 -g main.rs + ls $(TMPDIR)/*.o && exit 1 || exit 0 + rm $(TMPDIR)/*.dwo + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,main) + +# - Debuginfo in `.o` files +# - (bar) `.rlib` file created, contains `.o` +# - (bar) `.o` present +# - (bar) `.dwo` never created +# - (bar) `.dwp` never created +# - (main) `.o` present +# - (main) `.dwo` never created +# - (main) `.dwp` never created +unpacked-crosscrate-single: + $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=unpacked \ + -Zsplit-dwarf-kind=single -C debuginfo=2 -g bar.rs + ls $(TMPDIR)/*.rlib + ls $(TMPDIR)/*.o + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ + -C split-debuginfo=unpacked -Zsplit-dwarf-kind=single -C debuginfo=2 -g main.rs + ls $(TMPDIR)/*.o + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,main) +endif +endif diff --git a/tests/run-make/split-debuginfo/bar.rs b/tests/run-make/split-debuginfo/bar.rs new file mode 100644 index 00000000000..07dd0715252 --- /dev/null +++ b/tests/run-make/split-debuginfo/bar.rs @@ -0,0 +1,13 @@ +pub struct Bar { + x: u32, +} + +impl Bar { + pub fn print(&self) { + println!("{}", self.x); + } +} + +pub fn make_bar(x: u32) -> Bar { + Bar { x } +} diff --git a/tests/run-make/split-debuginfo/baz.rs b/tests/run-make/split-debuginfo/baz.rs new file mode 100644 index 00000000000..8b1a393741c --- /dev/null +++ b/tests/run-make/split-debuginfo/baz.rs @@ -0,0 +1 @@ +// empty diff --git a/tests/run-make/split-debuginfo/foo.rs b/tests/run-make/split-debuginfo/foo.rs new file mode 100644 index 00000000000..b058e540862 --- /dev/null +++ b/tests/run-make/split-debuginfo/foo.rs @@ -0,0 +1,15 @@ +pub struct Foo { + x: u32, +} + +impl Foo { + pub fn print(&self) { + println!("{}", self.x); + } +} + +pub fn make_foo(x: u32) -> Foo { + Foo { x } +} + +fn main() {} diff --git a/tests/run-make/split-debuginfo/main.rs b/tests/run-make/split-debuginfo/main.rs new file mode 100644 index 00000000000..21fa16e40a4 --- /dev/null +++ b/tests/run-make/split-debuginfo/main.rs @@ -0,0 +1,8 @@ +extern crate bar; + +use bar::{Bar, make_bar}; + +fn main() { + let b = make_bar(3); + b.print(); +} diff --git a/tests/run-make/stable-symbol-names/Makefile b/tests/run-make/stable-symbol-names/Makefile new file mode 100644 index 00000000000..bbfb8e38881 --- /dev/null +++ b/tests/run-make/stable-symbol-names/Makefile @@ -0,0 +1,41 @@ +include ../tools.mk + +# The following command will: +# 1. dump the symbols of a library using `nm` +# 2. extract only those lines that we are interested in via `grep` +# 3. from those lines, extract just the symbol name via `sed`, which: +# * always starts with "_ZN" and ends with "E" (`legacy` mangling) +# * always starts with "_R" (`v0` mangling) +# 4. sort those symbol names for deterministic comparison +# 5. write the result into a file + +dump-symbols = nm "$(TMPDIR)/lib$(1).rlib" \ + | grep -E "$(2)" \ + | sed -E "s/.*(_ZN.*E|_R[a-zA-Z0-9_]*).*/\1/" \ + | sort \ + > "$(TMPDIR)/$(1)$(3).nm" + +# This test +# - compiles each of the two crates 2 times and makes sure each time we get +# exactly the same symbol names +# - makes sure that both crates agree on the same symbol names for monomorphic +# functions + +all: + $(RUSTC) stable-symbol-names1.rs + $(call dump-symbols,stable_symbol_names1,generic_|mono_,_v1) + rm $(TMPDIR)/libstable_symbol_names1.rlib + $(RUSTC) stable-symbol-names1.rs + $(call dump-symbols,stable_symbol_names1,generic_|mono_,_v2) + cmp "$(TMPDIR)/stable_symbol_names1_v1.nm" "$(TMPDIR)/stable_symbol_names1_v2.nm" + + $(RUSTC) stable-symbol-names2.rs + $(call dump-symbols,stable_symbol_names2,generic_|mono_,_v1) + rm $(TMPDIR)/libstable_symbol_names2.rlib + $(RUSTC) stable-symbol-names2.rs + $(call dump-symbols,stable_symbol_names2,generic_|mono_,_v2) + cmp "$(TMPDIR)/stable_symbol_names2_v1.nm" "$(TMPDIR)/stable_symbol_names2_v2.nm" + + $(call dump-symbols,stable_symbol_names1,mono_,_cross) + $(call dump-symbols,stable_symbol_names2,mono_,_cross) + cmp "$(TMPDIR)/stable_symbol_names1_cross.nm" "$(TMPDIR)/stable_symbol_names2_cross.nm" diff --git a/tests/run-make/stable-symbol-names/stable-symbol-names1.rs b/tests/run-make/stable-symbol-names/stable-symbol-names1.rs new file mode 100644 index 00000000000..b85a428278c --- /dev/null +++ b/tests/run-make/stable-symbol-names/stable-symbol-names1.rs @@ -0,0 +1,31 @@ +#![crate_type="rlib"] + +pub trait Foo { + fn generic_method(); +} + +pub struct Bar; + +impl Foo for Bar { + fn generic_method() {} +} + +pub fn mono_function() { + Bar::generic_method::(); +} + +pub fn mono_function_lifetime<'a>(x: &'a u64) -> u64 { + *x +} + +pub fn generic_function(t: T) -> T { + t +} + +pub fn user() { + generic_function(0u32); + generic_function("abc"); + let x = 2u64; + generic_function(&x); + let _ = mono_function_lifetime(&x); +} diff --git a/tests/run-make/stable-symbol-names/stable-symbol-names2.rs b/tests/run-make/stable-symbol-names/stable-symbol-names2.rs new file mode 100644 index 00000000000..33df9d6c689 --- /dev/null +++ b/tests/run-make/stable-symbol-names/stable-symbol-names2.rs @@ -0,0 +1,17 @@ +#![crate_type="rlib"] + +extern crate stable_symbol_names1; + +pub fn user() { + stable_symbol_names1::generic_function(1u32); + stable_symbol_names1::generic_function("def"); + let x = 2u64; + stable_symbol_names1::generic_function(&x); + stable_symbol_names1::mono_function(); + stable_symbol_names1::mono_function_lifetime(&0); +} + +pub fn trait_impl_test_function() { + use stable_symbol_names1::*; + Bar::generic_method::(); +} diff --git a/tests/run-make/static-dylib-by-default/Makefile b/tests/run-make/static-dylib-by-default/Makefile new file mode 100644 index 00000000000..eedd0b32092 --- /dev/null +++ b/tests/run-make/static-dylib-by-default/Makefile @@ -0,0 +1,16 @@ +include ../tools.mk + +TO_LINK := $(call DYLIB,bar) +ifdef IS_MSVC +LINK_ARG = $(TO_LINK:dll=dll.lib) +else +LINK_ARG = $(TO_LINK) +endif + +all: + $(RUSTC) foo.rs + $(RUSTC) bar.rs + $(CC) main.c $(call OUT_EXE,main) $(LINK_ARG) $(EXTRACFLAGS) + rm $(TMPDIR)/*.rlib + rm $(call DYLIB,foo) + $(call RUN,main) diff --git a/tests/run-make/static-dylib-by-default/bar.rs b/tests/run-make/static-dylib-by-default/bar.rs new file mode 100644 index 00000000000..14421165e2d --- /dev/null +++ b/tests/run-make/static-dylib-by-default/bar.rs @@ -0,0 +1,8 @@ +#![crate_type = "dylib"] + +extern crate foo; + +#[no_mangle] +pub extern "C" fn bar() { + foo::foo(); +} diff --git a/tests/run-make/static-dylib-by-default/foo.rs b/tests/run-make/static-dylib-by-default/foo.rs new file mode 100644 index 00000000000..7ebec872055 --- /dev/null +++ b/tests/run-make/static-dylib-by-default/foo.rs @@ -0,0 +1,4 @@ +#![crate_type = "rlib"] +#![crate_type = "dylib"] + +pub fn foo() {} diff --git a/tests/run-make/static-dylib-by-default/main.c b/tests/run-make/static-dylib-by-default/main.c new file mode 100644 index 00000000000..5f7f2c27cd3 --- /dev/null +++ b/tests/run-make/static-dylib-by-default/main.c @@ -0,0 +1,6 @@ +extern void bar(); + +int main() { + bar(); + return 0; +} diff --git a/tests/run-make/static-extern-type/Makefile b/tests/run-make/static-extern-type/Makefile new file mode 100644 index 00000000000..e9aa95e63a0 --- /dev/null +++ b/tests/run-make/static-extern-type/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: $(call NATIVE_STATICLIB,define-foo) + $(RUSTC) -ldefine-foo use-foo.rs + $(call RUN,use-foo) || exit 1 diff --git a/tests/run-make/static-extern-type/define-foo.c b/tests/run-make/static-extern-type/define-foo.c new file mode 100644 index 00000000000..39be5acfa11 --- /dev/null +++ b/tests/run-make/static-extern-type/define-foo.c @@ -0,0 +1,11 @@ +#include + +struct Foo { + uint8_t x; +}; + +struct Foo FOO = { 42 }; + +uint8_t bar(const struct Foo* foo) { + return foo->x; +} diff --git a/tests/run-make/static-extern-type/use-foo.rs b/tests/run-make/static-extern-type/use-foo.rs new file mode 100644 index 00000000000..932b5b5944b --- /dev/null +++ b/tests/run-make/static-extern-type/use-foo.rs @@ -0,0 +1,14 @@ +#![feature(extern_types)] + +extern "C" { + type Foo; + static FOO: Foo; + fn bar(foo: *const Foo) -> u8; +} + +fn main() { + unsafe { + let foo = &FOO; + assert_eq!(bar(foo), 42); + } +} diff --git a/tests/run-make/static-unwinding/Makefile b/tests/run-make/static-unwinding/Makefile new file mode 100644 index 00000000000..9c755d4ab18 --- /dev/null +++ b/tests/run-make/static-unwinding/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + $(RUSTC) lib.rs + $(RUSTC) main.rs + $(call RUN,main) diff --git a/tests/run-make/static-unwinding/lib.rs b/tests/run-make/static-unwinding/lib.rs new file mode 100644 index 00000000000..3fb1117a110 --- /dev/null +++ b/tests/run-make/static-unwinding/lib.rs @@ -0,0 +1,15 @@ +#![crate_type = "rlib"] + +pub static mut statik: isize = 0; + +struct A; +impl Drop for A { + fn drop(&mut self) { + unsafe { statik = 1; } + } +} + +pub fn callback(f: F) where F: FnOnce() { + let _a = A; + f(); +} diff --git a/tests/run-make/static-unwinding/main.rs b/tests/run-make/static-unwinding/main.rs new file mode 100644 index 00000000000..0c66ea1aa07 --- /dev/null +++ b/tests/run-make/static-unwinding/main.rs @@ -0,0 +1,24 @@ +extern crate lib; + +use std::thread; + +static mut statik: isize = 0; + +struct A; +impl Drop for A { + fn drop(&mut self) { + unsafe { statik = 1; } + } +} + +fn main() { + thread::spawn(move|| { + let _a = A; + lib::callback(|| panic!()); + }).join().unwrap_err(); + + unsafe { + assert_eq!(lib::statik, 1); + assert_eq!(statik, 1); + } +} diff --git a/tests/run-make/staticlib-blank-lib/Makefile b/tests/run-make/staticlib-blank-lib/Makefile new file mode 100644 index 00000000000..fcbf87758fb --- /dev/null +++ b/tests/run-make/staticlib-blank-lib/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + $(AR) crus $(TMPDIR)/libfoo.a foo.rs + $(AR) d $(TMPDIR)/libfoo.a foo.rs + $(RUSTC) foo.rs diff --git a/tests/run-make/staticlib-blank-lib/foo.rs b/tests/run-make/staticlib-blank-lib/foo.rs new file mode 100644 index 00000000000..bf48d069da9 --- /dev/null +++ b/tests/run-make/staticlib-blank-lib/foo.rs @@ -0,0 +1,6 @@ +#![crate_type = "staticlib"] + +#[link(name = "foo", kind = "static")] +extern "C" {} + +fn main() {} diff --git a/tests/run-make/std-core-cycle/Makefile b/tests/run-make/std-core-cycle/Makefile new file mode 100644 index 00000000000..4f252863767 --- /dev/null +++ b/tests/run-make/std-core-cycle/Makefile @@ -0,0 +1,16 @@ +include ../tools.mk + +ifeq ($(UNAME),Darwin) +FLAGS := +else +ifdef IS_WINDOWS +FLAGS := +else +FLAGS := -C link-args=-Wl,--no-undefined +endif +endif + +all: + $(RUSTC) bar.rs + $(RUSTC) foo.rs $(FLAGS) + $(RUSTC) foo.rs $(FLAGS) -C panic=abort diff --git a/tests/run-make/std-core-cycle/bar.rs b/tests/run-make/std-core-cycle/bar.rs new file mode 100644 index 00000000000..9f5e7c29bdd --- /dev/null +++ b/tests/run-make/std-core-cycle/bar.rs @@ -0,0 +1,16 @@ +#![feature(allocator_api)] +#![crate_type = "rlib"] + +use std::alloc::*; + +pub struct A; + +unsafe impl GlobalAlloc for A { + unsafe fn alloc(&self, _: Layout) -> *mut u8 { + loop {} + } + + unsafe fn dealloc(&self, _ptr: *mut u8, _: Layout) { + loop {} + } +} diff --git a/tests/run-make/std-core-cycle/foo.rs b/tests/run-make/std-core-cycle/foo.rs new file mode 100644 index 00000000000..6aa6e1ac3c5 --- /dev/null +++ b/tests/run-make/std-core-cycle/foo.rs @@ -0,0 +1,11 @@ +#![crate_type = "cdylib"] + +extern crate bar; + +#[global_allocator] +static A: bar::A = bar::A; + +#[no_mangle] +pub extern "C" fn a(a: u32, b: u32) -> u32 { + a / b +} diff --git a/tests/run-make/stdin-non-utf8/Makefile b/tests/run-make/stdin-non-utf8/Makefile new file mode 100644 index 00000000000..709d4cf1408 --- /dev/null +++ b/tests/run-make/stdin-non-utf8/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + cp non-utf8 $(TMPDIR)/non-utf.rs + cat $(TMPDIR)/non-utf.rs | $(RUSTC) - 2>&1 \ + | $(CGREP) "error: couldn't read from stdin, as it did not contain valid UTF-8" diff --git a/tests/run-make/stdin-non-utf8/non-utf8 b/tests/run-make/stdin-non-utf8/non-utf8 new file mode 100644 index 00000000000..bc87051a852 --- /dev/null +++ b/tests/run-make/stdin-non-utf8/non-utf8 @@ -0,0 +1 @@ +Ò diff --git a/tests/run-make/suspicious-library/Makefile b/tests/run-make/suspicious-library/Makefile new file mode 100644 index 00000000000..2af9e85c228 --- /dev/null +++ b/tests/run-make/suspicious-library/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) foo.rs -C prefer-dynamic + touch $(call DYLIB,foo-something-special) + touch $(call DYLIB,foo-something-special2) + $(RUSTC) bar.rs diff --git a/tests/run-make/suspicious-library/bar.rs b/tests/run-make/suspicious-library/bar.rs new file mode 100644 index 00000000000..550c94cd0c6 --- /dev/null +++ b/tests/run-make/suspicious-library/bar.rs @@ -0,0 +1,3 @@ +extern crate foo; + +fn main() { foo::foo() } diff --git a/tests/run-make/suspicious-library/foo.rs b/tests/run-make/suspicious-library/foo.rs new file mode 100644 index 00000000000..a382d8f2c7f --- /dev/null +++ b/tests/run-make/suspicious-library/foo.rs @@ -0,0 +1,3 @@ +#![crate_type = "dylib"] + +pub fn foo() {} diff --git a/tests/run-make/symbol-visibility/Makefile b/tests/run-make/symbol-visibility/Makefile new file mode 100644 index 00000000000..17052ef4e63 --- /dev/null +++ b/tests/run-make/symbol-visibility/Makefile @@ -0,0 +1,122 @@ +include ../tools.mk + +# ignore-windows-msvc + +NM=nm -D +CDYLIB_NAME=liba_cdylib.so +RDYLIB_NAME=liba_rust_dylib.so +PROC_MACRO_NAME=liba_proc_macro.so +EXE_NAME=an_executable +COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.so + +ifeq ($(UNAME),Darwin) +NM=nm -gU +CDYLIB_NAME=liba_cdylib.dylib +RDYLIB_NAME=liba_rust_dylib.dylib +PROC_MACRO_NAME=liba_proc_macro.dylib +EXE_NAME=an_executable +COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.dylib +endif + +ifdef IS_WINDOWS +NM=nm -g +CDYLIB_NAME=liba_cdylib.dll.a +RDYLIB_NAME=liba_rust_dylib.dll.a +PROC_MACRO_NAME=liba_proc_macro.dll +EXE_NAME=an_executable.exe +COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.dll.a +endif + +# `grep` regex for symbols produced by either `legacy` or `v0` mangling +RE_ANY_RUST_SYMBOL="_ZN.*h.*E\|_R[a-zA-Z0-9_]+" + +all: + $(RUSTC) -Zshare-generics=no an_rlib.rs + $(RUSTC) -Zshare-generics=no a_cdylib.rs + $(RUSTC) -Zshare-generics=no a_rust_dylib.rs + $(RUSTC) -Zshare-generics=no a_proc_macro.rs + $(RUSTC) -Zshare-generics=no an_executable.rs + $(RUSTC) -Zshare-generics=no a_cdylib.rs --crate-name combined_rlib_dylib --crate-type=rlib,cdylib + + # Check that a cdylib exports its public #[no_mangle] functions + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] + # Check that a cdylib exports the public #[no_mangle] functions of dependencies + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + # Check that a cdylib DOES NOT export any public Rust functions + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] + + # Check that a Rust dylib exports its monomorphic functions + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rust_dylib)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rust_dylib)" -eq "1" ] + # Check that a Rust dylib does not export generics if -Zshare-generics=no + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rust_dylib)" -eq "0" ] + + + # Check that a Rust dylib exports the monomorphic functions from its dependencies + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rlib)" -eq "1" ] + # Check that a Rust dylib does not export generics if -Zshare-generics=no + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rlib)" -eq "0" ] + + # Check that a proc macro exports its public #[no_mangle] functions + # FIXME(#99978) avoid exporting #[no_mangle] symbols for proc macros + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] + # Check that a proc macro exports the public #[no_mangle] functions of dependencies + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + # Check that a proc macro DOES NOT export any public Rust functions + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] + +# FIXME(nbdd0121): This is broken in MinGW, see https://github.com/rust-lang/rust/pull/95604#issuecomment-1101564032 +ifndef IS_WINDOWS + # Check that an executable does not export any dynamic symbols + [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "0" ] + [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_rust_function_from_exe)" -eq "0" ] +endif + + + # Check the combined case, where we generate a cdylib and an rlib in the same + # compilation session: + # Check that a cdylib exports its public #[no_mangle] functions + [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] + # Check that a cdylib exports the public #[no_mangle] functions of dependencies + [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + # Check that a cdylib DOES NOT export any public Rust functions + [ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] + + + $(RUSTC) -Zshare-generics=yes an_rlib.rs + $(RUSTC) -Zshare-generics=yes a_cdylib.rs + $(RUSTC) -Zshare-generics=yes a_rust_dylib.rs + $(RUSTC) -Zshare-generics=yes a_proc_macro.rs + $(RUSTC) -Zshare-generics=yes an_executable.rs + + # Check that a cdylib exports its public #[no_mangle] functions + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] + # Check that a cdylib exports the public #[no_mangle] functions of dependencies + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + # Check that a cdylib DOES NOT export any public Rust functions + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] + + # Check that a Rust dylib exports its monomorphic functions, including generics this time + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rust_dylib)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rust_dylib)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rust_dylib)" -eq "1" ] + + # Check that a Rust dylib exports the monomorphic functions from its dependencies + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_rust_function_from_rlib)" -eq "1" ] + [ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -v __imp_ | grep -c public_generic_function_from_rlib)" -eq "1" ] + + # Check that a proc macro exports its public #[no_mangle] functions + # FIXME(#99978) avoid exporting #[no_mangle] symbols for proc macros + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_cdylib)" -eq "1" ] + # Check that a proc macro exports the public #[no_mangle] functions of dependencies + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "1" ] + # Check that a proc macro DOES NOT export any public Rust functions + [ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -v __imp_ | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ] + +ifndef IS_WINDOWS + # Check that an executable does not export any dynamic symbols + [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_c_function_from_rlib)" -eq "0" ] + [ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -v __imp_ | grep -c public_rust_function_from_exe)" -eq "0" ] +endif diff --git a/tests/run-make/symbol-visibility/a_cdylib.rs b/tests/run-make/symbol-visibility/a_cdylib.rs new file mode 100644 index 00000000000..d4fbff85bfe --- /dev/null +++ b/tests/run-make/symbol-visibility/a_cdylib.rs @@ -0,0 +1,12 @@ +#![crate_type="cdylib"] + +extern crate an_rlib; + +// This should not be exported +pub fn public_rust_function_from_cdylib() {} + +// This should be exported +#[no_mangle] +pub extern "C" fn public_c_function_from_cdylib() { + an_rlib::public_c_function_from_rlib(); +} diff --git a/tests/run-make/symbol-visibility/a_proc_macro.rs b/tests/run-make/symbol-visibility/a_proc_macro.rs new file mode 100644 index 00000000000..9fd1a8a6717 --- /dev/null +++ b/tests/run-make/symbol-visibility/a_proc_macro.rs @@ -0,0 +1,9 @@ +#![crate_type = "proc-macro"] + +extern crate an_rlib; + +// This should not be exported +#[no_mangle] +extern "C" fn public_c_function_from_cdylib() { + an_rlib::public_c_function_from_rlib(); +} diff --git a/tests/run-make/symbol-visibility/a_rust_dylib.rs b/tests/run-make/symbol-visibility/a_rust_dylib.rs new file mode 100644 index 00000000000..a47df0ab7ee --- /dev/null +++ b/tests/run-make/symbol-visibility/a_rust_dylib.rs @@ -0,0 +1,15 @@ +#![crate_type="dylib"] + +extern crate an_rlib; + +// This should be exported +pub fn public_rust_function_from_rust_dylib() {} + +// This should be exported +#[no_mangle] +pub extern "C" fn public_c_function_from_rust_dylib() { + let _ = public_generic_function_from_rust_dylib(1u16); +} + +// This should be exported if -Zshare-generics=yes +pub fn public_generic_function_from_rust_dylib(x: T) -> T { x } diff --git a/tests/run-make/symbol-visibility/an_executable.rs b/tests/run-make/symbol-visibility/an_executable.rs new file mode 100644 index 00000000000..3f5e125ad19 --- /dev/null +++ b/tests/run-make/symbol-visibility/an_executable.rs @@ -0,0 +1,7 @@ +#![crate_type="bin"] + +extern crate an_rlib; + +pub fn public_rust_function_from_exe() {} + +fn main() {} diff --git a/tests/run-make/symbol-visibility/an_rlib.rs b/tests/run-make/symbol-visibility/an_rlib.rs new file mode 100644 index 00000000000..3696422b11e --- /dev/null +++ b/tests/run-make/symbol-visibility/an_rlib.rs @@ -0,0 +1,12 @@ +#![crate_type="rlib"] + +pub fn public_rust_function_from_rlib() {} + +#[no_mangle] +pub extern "C" fn public_c_function_from_rlib() { + let _ = public_generic_function_from_rlib(0u64); +} + +pub fn public_generic_function_from_rlib(x: T) -> T { + x +} diff --git a/tests/run-make/symbols-include-type-name/Makefile b/tests/run-make/symbols-include-type-name/Makefile new file mode 100644 index 00000000000..ac26a852e36 --- /dev/null +++ b/tests/run-make/symbols-include-type-name/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# Check that symbol names for methods include type names, instead of . + +OUT=$(TMPDIR)/lib.s + +all: + $(RUSTC) --crate-type staticlib --emit asm lib.rs + $(CGREP) Def < $(OUT) diff --git a/tests/run-make/symbols-include-type-name/lib.rs b/tests/run-make/symbols-include-type-name/lib.rs new file mode 100644 index 00000000000..37d44591767 --- /dev/null +++ b/tests/run-make/symbols-include-type-name/lib.rs @@ -0,0 +1,14 @@ +pub struct Def { + pub id: i32, +} + +impl Def { + pub fn new(id: i32) -> Def { + Def { id: id } + } +} + +#[no_mangle] +pub fn user() { + let _ = Def::new(0); +} diff --git a/tests/run-make/symlinked-extern/Makefile b/tests/run-make/symlinked-extern/Makefile new file mode 100644 index 00000000000..058f43e857a --- /dev/null +++ b/tests/run-make/symlinked-extern/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +# ignore-windows +# `ln` is actually `cp` on msys. + +all: + $(RUSTC) foo.rs + mkdir -p $(TMPDIR)/other + ln -nsf $(TMPDIR)/libfoo.rlib $(TMPDIR)/other + $(RUSTC) bar.rs -L $(TMPDIR) + $(RUSTC) baz.rs --extern foo=$(TMPDIR)/other/libfoo.rlib -L $(TMPDIR) diff --git a/tests/run-make/symlinked-extern/bar.rs b/tests/run-make/symlinked-extern/bar.rs new file mode 100644 index 00000000000..cd9c959d5e6 --- /dev/null +++ b/tests/run-make/symlinked-extern/bar.rs @@ -0,0 +1,6 @@ +#![crate_type = "rlib"] + +extern crate foo; + +pub fn bar(_s: foo::S) { +} diff --git a/tests/run-make/symlinked-extern/baz.rs b/tests/run-make/symlinked-extern/baz.rs new file mode 100644 index 00000000000..cd433a3ac7a --- /dev/null +++ b/tests/run-make/symlinked-extern/baz.rs @@ -0,0 +1,6 @@ +extern crate bar; +extern crate foo; + +fn main() { + bar::bar(foo::foo()); +} diff --git a/tests/run-make/symlinked-extern/foo.rs b/tests/run-make/symlinked-extern/foo.rs new file mode 100644 index 00000000000..c00700b8cf8 --- /dev/null +++ b/tests/run-make/symlinked-extern/foo.rs @@ -0,0 +1,5 @@ +#![crate_type = "rlib"] + +pub struct S; + +pub fn foo() -> S { S } diff --git a/tests/run-make/symlinked-libraries/Makefile b/tests/run-make/symlinked-libraries/Makefile new file mode 100644 index 00000000000..576bf7e54be --- /dev/null +++ b/tests/run-make/symlinked-libraries/Makefile @@ -0,0 +1,10 @@ +include ../tools.mk + +# ignore-windows +# `ln` is actually `cp` on msys. + +all: + $(RUSTC) foo.rs -C prefer-dynamic + mkdir -p $(TMPDIR)/other + ln -nsf $(TMPDIR)/$(call DYLIB_GLOB,foo) $(TMPDIR)/other + $(RUSTC) bar.rs -L $(TMPDIR)/other diff --git a/tests/run-make/symlinked-libraries/bar.rs b/tests/run-make/symlinked-libraries/bar.rs new file mode 100644 index 00000000000..fde0d746634 --- /dev/null +++ b/tests/run-make/symlinked-libraries/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::bar(); +} diff --git a/tests/run-make/symlinked-libraries/foo.rs b/tests/run-make/symlinked-libraries/foo.rs new file mode 100644 index 00000000000..cde9e291b45 --- /dev/null +++ b/tests/run-make/symlinked-libraries/foo.rs @@ -0,0 +1,3 @@ +#![crate_type = "dylib"] + +pub fn bar() {} diff --git a/tests/run-make/symlinked-rlib/Makefile b/tests/run-make/symlinked-rlib/Makefile new file mode 100644 index 00000000000..49d3f220a35 --- /dev/null +++ b/tests/run-make/symlinked-rlib/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# ignore-windows +# `ln` is actually `cp` on msys. + +all: + $(RUSTC) foo.rs --crate-type=rlib -o $(TMPDIR)/foo.xxx + ln -nsf $(TMPDIR)/foo.xxx $(TMPDIR)/libfoo.rlib + $(RUSTC) bar.rs -L $(TMPDIR) diff --git a/tests/run-make/symlinked-rlib/bar.rs b/tests/run-make/symlinked-rlib/bar.rs new file mode 100644 index 00000000000..fde0d746634 --- /dev/null +++ b/tests/run-make/symlinked-rlib/bar.rs @@ -0,0 +1,5 @@ +extern crate foo; + +fn main() { + foo::bar(); +} diff --git a/tests/run-make/symlinked-rlib/foo.rs b/tests/run-make/symlinked-rlib/foo.rs new file mode 100644 index 00000000000..c5c0bc606cd --- /dev/null +++ b/tests/run-make/symlinked-rlib/foo.rs @@ -0,0 +1 @@ +pub fn bar() {} diff --git a/tests/run-make/sysroot-crates-are-unstable/Makefile b/tests/run-make/sysroot-crates-are-unstable/Makefile new file mode 100644 index 00000000000..1e267fb9576 --- /dev/null +++ b/tests/run-make/sysroot-crates-are-unstable/Makefile @@ -0,0 +1,2 @@ +all: + '$(PYTHON)' test.py diff --git a/tests/run-make/sysroot-crates-are-unstable/test.py b/tests/run-make/sysroot-crates-are-unstable/test.py new file mode 100644 index 00000000000..cb77eb34fef --- /dev/null +++ b/tests/run-make/sysroot-crates-are-unstable/test.py @@ -0,0 +1,74 @@ +import sys +import os +from os import listdir +from os.path import isfile, join +from subprocess import PIPE, Popen + + +# This is n list of files which are stable crates or simply are not crates, +# we don't check for the instability of these crates as they're all stable! +STABLE_CRATES = ['std', 'alloc', 'core', 'proc_macro', + 'rsbegin.o', 'rsend.o', 'dllcrt2.o', 'crt2.o', 'clang_rt'] + + +def convert_to_string(s): + if s.__class__.__name__ == 'bytes': + return s.decode('utf-8') + return s + + +def set_ld_lib_path(): + var = os.environ.get("LD_LIB_PATH_ENVVAR") + rpath = os.environ.get("HOST_RPATH_DIR") + if var and rpath: + path = os.environ.get(var) + if path: + os.environ[var] = rpath + os.pathsep + path + else: + os.environ[var] = rpath + + +def exec_command(command, to_input=None): + child = None + if to_input is None: + child = Popen(command, stdout=PIPE, stderr=PIPE) + else: + child = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE) + stdout, stderr = child.communicate(input=to_input) + return (convert_to_string(stdout), convert_to_string(stderr)) + + +def check_lib(lib): + if lib['name'] in STABLE_CRATES: + return True + print('verifying if {} is an unstable crate'.format(lib['name'])) + stdout, stderr = exec_command([os.environ['RUSTC'], '-', '--crate-type', 'rlib', + '--extern', '{}={}'.format(lib['name'], lib['path'])], + to_input=('extern crate {};'.format(lib['name'])).encode('utf-8')) + if not 'use of unstable library feature' in '{}{}'.format(stdout, stderr): + print('crate {} "{}" is not unstable'.format(lib['name'], lib['path'])) + print('{}{}'.format(stdout, stderr)) + print('') + return False + return True + +# Generate a list of all crates in the sysroot. To do this we list all files in +# rustc's sysroot, look at the filename, strip everything after the `-`, and +# strip the leading `lib` (if present) +def get_all_libs(dir_path): + return [{ 'path': join(dir_path, f), 'name': f[3:].split('-')[0] } + for f in listdir(dir_path) + if isfile(join(dir_path, f)) and f.endswith('.rlib') and f not in STABLE_CRATES] + + +set_ld_lib_path() +sysroot = exec_command([os.environ['RUSTC'], '--print', 'sysroot'])[0].replace('\n', '') +assert sysroot, "Could not read the rustc sysroot!" +libs = get_all_libs(join(sysroot, 'lib/rustlib/{}/lib'.format(os.environ['TARGET']))) + +ret = 0 +for lib in libs: + if not check_lib(lib): + # We continue so users can see all the not unstable crates. + ret = 1 +sys.exit(ret) diff --git a/tests/run-make/target-cpu-native/Makefile b/tests/run-make/target-cpu-native/Makefile new file mode 100644 index 00000000000..eb3ca1e13aa --- /dev/null +++ b/tests/run-make/target-cpu-native/Makefile @@ -0,0 +1,20 @@ +include ../tools.mk + +# only-linux +# only-x86_64 +# +# I *really* don't want to deal with a cross-platform way to compare file sizes, +# tests in `make` sort of are awful + +all: $(TMPDIR)/out.log + # Make sure no warnings about "unknown CPU `native`" were emitted + if [ "$$(wc -c $(TMPDIR)/out.log | cut -d' ' -f 1)" = "0" ]; then \ + echo no warnings generated; \ + else \ + exit 1; \ + fi + + +$(TMPDIR)/out.log: + $(RUSTC) foo.rs -C target-cpu=native 2>&1 | tee $(TMPDIR)/out.log + $(call RUN,foo) diff --git a/tests/run-make/target-cpu-native/foo.rs b/tests/run-make/target-cpu-native/foo.rs new file mode 100644 index 00000000000..f79c691f085 --- /dev/null +++ b/tests/run-make/target-cpu-native/foo.rs @@ -0,0 +1,2 @@ +fn main() { +} diff --git a/tests/run-make/target-specs/Makefile b/tests/run-make/target-specs/Makefile new file mode 100644 index 00000000000..a33f5368e3c --- /dev/null +++ b/tests/run-make/target-specs/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk +all: + $(RUSTC) foo.rs --target=my-awesome-platform.json --crate-type=lib --emit=asm + $(CGREP) -v morestack < $(TMPDIR)/foo.s + $(RUSTC) foo.rs --target=my-invalid-platform.json 2>&1 | $(CGREP) "Error loading target specification" + $(RUSTC) foo.rs --target=my-incomplete-platform.json 2>&1 | $(CGREP) 'Field llvm-target' + RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-awesome-platform --crate-type=lib --emit=asm + RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-x86_64-unknown-linux-gnu-platform --crate-type=lib --emit=asm + $(RUSTC) -Z unstable-options --target=my-awesome-platform.json --print target-spec-json > $(TMPDIR)/test-platform.json && $(RUSTC) -Z unstable-options --target=$(TMPDIR)/test-platform.json --print target-spec-json | diff -q $(TMPDIR)/test-platform.json - + $(RUSTC) foo.rs --target=definitely-not-builtin-target 2>&1 | $(CGREP) 'may not set is_builtin' + $(RUSTC) foo.rs --target=mismatching-data-layout --crate-type=lib diff --git a/tests/run-make/target-specs/definitely-not-builtin-target.json b/tests/run-make/target-specs/definitely-not-builtin-target.json new file mode 100644 index 00000000000..b36fa993d97 --- /dev/null +++ b/tests/run-make/target-specs/definitely-not-builtin-target.json @@ -0,0 +1,7 @@ +{ + "arch": "x86_64", + "is-builtin": true, + "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", + "llvm-target": "x86_64-unknown-unknown-gnu", + "target-pointer-width": "64" +} diff --git a/tests/run-make/target-specs/foo.rs b/tests/run-make/target-specs/foo.rs new file mode 100644 index 00000000000..22939e87912 --- /dev/null +++ b/tests/run-make/target-specs/foo.rs @@ -0,0 +1,24 @@ +#![feature(lang_items, no_core, auto_traits)] +#![no_core] + +#[lang = "copy"] +trait Copy {} + +#[lang = "sized"] +trait Sized {} + +#[lang = "freeze"] +auto trait Freeze {} + +#[lang = "start"] +fn start(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { + 0 +} + +extern "C" { + fn _foo() -> [u8; 16]; +} + +fn _main() { + let _a = unsafe { _foo() }; +} diff --git a/tests/run-make/target-specs/mismatching-data-layout.json b/tests/run-make/target-specs/mismatching-data-layout.json new file mode 100644 index 00000000000..d12caaad14a --- /dev/null +++ b/tests/run-make/target-specs/mismatching-data-layout.json @@ -0,0 +1,6 @@ +{ + "arch": "x86_64", + "data-layout": "e-m:e-i64:16:32:64", + "llvm-target": "x86_64-unknown-unknown-gnu", + "target-pointer-width": "64" +} diff --git a/tests/run-make/target-specs/my-awesome-platform.json b/tests/run-make/target-specs/my-awesome-platform.json new file mode 100644 index 00000000000..00de3de05f0 --- /dev/null +++ b/tests/run-make/target-specs/my-awesome-platform.json @@ -0,0 +1,11 @@ +{ + "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", + "linker-flavor": "gcc", + "llvm-target": "i686-unknown-linux-gnu", + "target-endian": "little", + "target-pointer-width": "32", + "target-c-int-width": "32", + "arch": "x86", + "os": "linux", + "morestack": false +} diff --git a/tests/run-make/target-specs/my-incomplete-platform.json b/tests/run-make/target-specs/my-incomplete-platform.json new file mode 100644 index 00000000000..ceaa25cdf2f --- /dev/null +++ b/tests/run-make/target-specs/my-incomplete-platform.json @@ -0,0 +1,10 @@ +{ + "data-layout": "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32", + "linker-flavor": "gcc", + "target-endian": "little", + "target-pointer-width": "32", + "target-c-int-width": "32", + "arch": "x86", + "os": "foo", + "morestack": false +} diff --git a/tests/run-make/target-specs/my-invalid-platform.json b/tests/run-make/target-specs/my-invalid-platform.json new file mode 100644 index 00000000000..3feac45b7d6 --- /dev/null +++ b/tests/run-make/target-specs/my-invalid-platform.json @@ -0,0 +1 @@ +wow this json is really broke! diff --git a/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json new file mode 100644 index 00000000000..6d5e964ed4f --- /dev/null +++ b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json @@ -0,0 +1,12 @@ +{ + "pre-link-args": {"gcc": ["-m64"]}, + "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", + "linker-flavor": "gcc", + "llvm-target": "x86_64-unknown-linux-gnu", + "target-endian": "little", + "target-pointer-width": "64", + "target-c-int-width": "32", + "arch": "x86_64", + "os": "linux", + "morestack": false +} diff --git a/tests/run-make/target-without-atomic-cas/Makefile b/tests/run-make/target-without-atomic-cas/Makefile new file mode 100644 index 00000000000..451f03d66cd --- /dev/null +++ b/tests/run-make/target-without-atomic-cas/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +# The target used below doesn't support atomic CAS operations. Verify that's the case +all: + $(RUSTC) --print cfg --target thumbv6m-none-eabi | $(CGREP) -v 'target_has_atomic="ptr"' diff --git a/tests/run-make/test-harness/Makefile b/tests/run-make/test-harness/Makefile new file mode 100644 index 00000000000..1fe059b07d2 --- /dev/null +++ b/tests/run-make/test-harness/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +all: + # check that #[cfg_attr(..., ignore)] does the right thing. + $(RUSTC) --test test-ignore-cfg.rs --cfg ignorecfg + $(call RUN,test-ignore-cfg) | $(CGREP) 'shouldnotignore ... ok' 'shouldignore ... ignored' + $(call RUN,test-ignore-cfg --quiet) | $(CGREP) -e "^i\.$$" + $(call RUN,test-ignore-cfg --quiet) | $(CGREP) -v 'should' diff --git a/tests/run-make/test-harness/test-ignore-cfg.rs b/tests/run-make/test-harness/test-ignore-cfg.rs new file mode 100644 index 00000000000..31ef131f2ad --- /dev/null +++ b/tests/run-make/test-harness/test-ignore-cfg.rs @@ -0,0 +1,9 @@ +#[test] +#[cfg_attr(ignorecfg, ignore)] +fn shouldignore() { +} + +#[test] +#[cfg_attr(noignorecfg, ignore)] +fn shouldnotignore() { +} diff --git a/tests/run-make/type-mismatch-same-crate-name/Makefile b/tests/run-make/type-mismatch-same-crate-name/Makefile new file mode 100644 index 00000000000..a2a2a41c7a5 --- /dev/null +++ b/tests/run-make/type-mismatch-same-crate-name/Makefile @@ -0,0 +1,19 @@ +include ../tools.mk + +all: + # compile two different versions of crateA + $(RUSTC) --crate-type=rlib crateA.rs -C metadata=-1 -C extra-filename=-1 + $(RUSTC) --crate-type=rlib crateA.rs -C metadata=-2 -C extra-filename=-2 + # make crateB depend on version 1 of crateA + $(RUSTC) --crate-type=rlib crateB.rs --extern crateA=$(TMPDIR)/libcrateA-1.rlib + # make crateC depend on version 2 of crateA + $(RUSTC) crateC.rs --extern crateA=$(TMPDIR)/libcrateA-2.rlib 2>&1 | \ + tr -d '\r\n' | $(CGREP) -e \ + "mismatched types.*\ + crateB::try_foo\(foo2\);.*\ + expected \`crateA::foo::Foo\`, found \`Foo\`.*\ + different versions of crate \`crateA\`.*\ + mismatched types.*\ + crateB::try_bar\(bar2\);.*\ + expected trait \`crateA::bar::Bar\`, found trait \`Bar\`.*\ + different versions of crate \`crateA\`" diff --git a/tests/run-make/type-mismatch-same-crate-name/crateA.rs b/tests/run-make/type-mismatch-same-crate-name/crateA.rs new file mode 100644 index 00000000000..4871c8c2e9c --- /dev/null +++ b/tests/run-make/type-mismatch-same-crate-name/crateA.rs @@ -0,0 +1,16 @@ +mod foo { + pub struct Foo; +} + +mod bar { + pub trait Bar{} + + pub fn bar() -> Box { + unimplemented!() + } +} + +// This makes the publicly accessible path +// differ from the internal one. +pub use foo::Foo; +pub use bar::{Bar, bar}; diff --git a/tests/run-make/type-mismatch-same-crate-name/crateB.rs b/tests/run-make/type-mismatch-same-crate-name/crateB.rs new file mode 100644 index 00000000000..24fcc7cadc1 --- /dev/null +++ b/tests/run-make/type-mismatch-same-crate-name/crateB.rs @@ -0,0 +1,4 @@ +extern crate crateA; + +pub fn try_foo(x: crateA::Foo){} +pub fn try_bar(x: Box){} diff --git a/tests/run-make/type-mismatch-same-crate-name/crateC.rs b/tests/run-make/type-mismatch-same-crate-name/crateC.rs new file mode 100644 index 00000000000..71b38a9f8ca --- /dev/null +++ b/tests/run-make/type-mismatch-same-crate-name/crateC.rs @@ -0,0 +1,25 @@ +// This tests the extra note reported when a type error deals with +// seemingly identical types. +// The main use case of this error is when there are two crates +// (generally different versions of the same crate) with the same name +// causing a type mismatch. + +// The test is nearly the same as the one in +// ui/type/type-mismatch-same-crate-name.rs +// but deals with the case where one of the crates +// is only introduced as an indirect dependency. +// and the type is accessed via a re-export. +// This is similar to how the error can be introduced +// when using cargo's automatic dependency resolution. + +extern crate crateA; + +fn main() { + let foo2 = crateA::Foo; + let bar2 = crateA::bar(); + { + extern crate crateB; + crateB::try_foo(foo2); + crateB::try_bar(bar2); + } +} diff --git a/tests/run-make/use-extern-for-plugins/Makefile b/tests/run-make/use-extern-for-plugins/Makefile new file mode 100644 index 00000000000..6ae53afad20 --- /dev/null +++ b/tests/run-make/use-extern-for-plugins/Makefile @@ -0,0 +1,17 @@ +include ../tools.mk + +# ignore-freebsd +# ignore-openbsd +# ignore-sunos + +HOST := $(shell $(RUSTC) -vV | grep 'host:' | sed 's/host: //') +ifeq ($(findstring i686,$(HOST)),i686) +TARGET := $(subst i686,x86_64,$(HOST)) +else +TARGET := $(subst x86_64,i686,$(HOST)) +endif + +all: + $(RUSTC) foo.rs -C extra-filename=-host + $(RUSTC) bar.rs -C extra-filename=-targ --target $(TARGET) + $(RUSTC) baz.rs --extern a=$(TMPDIR)/liba-targ.rlib --target $(TARGET) diff --git a/tests/run-make/use-extern-for-plugins/bar.rs b/tests/run-make/use-extern-for-plugins/bar.rs new file mode 100644 index 00000000000..704d2120362 --- /dev/null +++ b/tests/run-make/use-extern-for-plugins/bar.rs @@ -0,0 +1,9 @@ +#![feature(no_core)] +#![no_core] +#![crate_type = "lib"] +#![crate_name = "a"] + +#[macro_export] +macro_rules! bar { + () => () +} diff --git a/tests/run-make/use-extern-for-plugins/baz.rs b/tests/run-make/use-extern-for-plugins/baz.rs new file mode 100644 index 00000000000..49a96a0c80b --- /dev/null +++ b/tests/run-make/use-extern-for-plugins/baz.rs @@ -0,0 +1,8 @@ +#![feature(no_core)] +#![no_core] +#![crate_type = "lib"] + +#[macro_use] +extern crate a; + +bar!(); diff --git a/tests/run-make/use-extern-for-plugins/foo.rs b/tests/run-make/use-extern-for-plugins/foo.rs new file mode 100644 index 00000000000..dffdc079887 --- /dev/null +++ b/tests/run-make/use-extern-for-plugins/foo.rs @@ -0,0 +1,8 @@ +#![no_std] +#![crate_type = "lib"] +#![crate_name = "a"] + +#[macro_export] +macro_rules! foo { + () => () +} diff --git a/tests/run-make/use-suggestions-rust-2018/Makefile b/tests/run-make/use-suggestions-rust-2018/Makefile new file mode 100644 index 00000000000..37cd6283c0a --- /dev/null +++ b/tests/run-make/use-suggestions-rust-2018/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +all: + $(RUSTC) ep-nested-lib.rs + + $(RUSTC) use-suggestions.rs --edition=2018 --extern ep_nested_lib=$(TMPDIR)/libep_nested_lib.rlib 2>&1 | $(CGREP) "use ep_nested_lib::foo::bar::Baz" + diff --git a/tests/run-make/use-suggestions-rust-2018/ep-nested-lib.rs b/tests/run-make/use-suggestions-rust-2018/ep-nested-lib.rs new file mode 100644 index 00000000000..62a0a9d8f1b --- /dev/null +++ b/tests/run-make/use-suggestions-rust-2018/ep-nested-lib.rs @@ -0,0 +1,7 @@ +#![crate_type = "rlib"] + +pub mod foo { + pub mod bar { + pub struct Baz; + } +} diff --git a/tests/run-make/use-suggestions-rust-2018/use-suggestions.rs b/tests/run-make/use-suggestions-rust-2018/use-suggestions.rs new file mode 100644 index 00000000000..d262d6f9877 --- /dev/null +++ b/tests/run-make/use-suggestions-rust-2018/use-suggestions.rs @@ -0,0 +1,3 @@ +fn main() { + let x = Baz{}; +} diff --git a/tests/run-make/used-cdylib-macos/Makefile b/tests/run-make/used-cdylib-macos/Makefile new file mode 100644 index 00000000000..38a4c31c7b3 --- /dev/null +++ b/tests/run-make/used-cdylib-macos/Makefile @@ -0,0 +1,11 @@ +include ../tools.mk + +# only-macos +# +# This checks that `#[used]` passes through to the linker on +# darwin. This is subject to change in the future, see +# https://github.com/rust-lang/rust/pull/93718 for discussion + +all: + $(RUSTC) -Copt-level=3 dylib_used.rs + nm $(TMPDIR)/libdylib_used.dylib | $(CGREP) VERY_IMPORTANT_SYMBOL diff --git a/tests/run-make/used-cdylib-macos/dylib_used.rs b/tests/run-make/used-cdylib-macos/dylib_used.rs new file mode 100644 index 00000000000..85f0ff92fe7 --- /dev/null +++ b/tests/run-make/used-cdylib-macos/dylib_used.rs @@ -0,0 +1,4 @@ +#![crate_type = "cdylib"] + +#[used] +static VERY_IMPORTANT_SYMBOL: u32 = 12345; diff --git a/tests/run-make/used/Makefile b/tests/run-make/used/Makefile new file mode 100644 index 00000000000..e80eb9e4020 --- /dev/null +++ b/tests/run-make/used/Makefile @@ -0,0 +1,7 @@ +include ../tools.mk + +# ignore-windows-msvc + +all: + $(RUSTC) -C opt-level=3 --emit=obj used.rs + nm $(TMPDIR)/used.o | $(CGREP) FOO diff --git a/tests/run-make/used/used.rs b/tests/run-make/used/used.rs new file mode 100644 index 00000000000..dca0a5e1167 --- /dev/null +++ b/tests/run-make/used/used.rs @@ -0,0 +1,6 @@ +#![crate_type = "lib"] + +#[used] +static FOO: u32 = 0; + +static BAR: u32 = 0; diff --git a/tests/run-make/version/Makefile b/tests/run-make/version/Makefile new file mode 100644 index 00000000000..3a130545d69 --- /dev/null +++ b/tests/run-make/version/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + $(RUSTC) -V + $(RUSTC) -vV + $(RUSTC) --version --verbose diff --git a/tests/run-make/volatile-intrinsics/Makefile b/tests/run-make/volatile-intrinsics/Makefile new file mode 100644 index 00000000000..2a78c7b9cfe --- /dev/null +++ b/tests/run-make/volatile-intrinsics/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +all: + # The tests must pass... + $(RUSTC) main.rs + $(call RUN,main) + # ... and the loads/stores must not be optimized out. + $(RUSTC) main.rs --emit=llvm-ir + $(CGREP) "load volatile" "store volatile" < $(TMPDIR)/main.ll diff --git a/tests/run-make/volatile-intrinsics/main.rs b/tests/run-make/volatile-intrinsics/main.rs new file mode 100644 index 00000000000..4295d95f3f3 --- /dev/null +++ b/tests/run-make/volatile-intrinsics/main.rs @@ -0,0 +1,24 @@ +#![feature(core_intrinsics, volatile)] + +use std::intrinsics::{ + unaligned_volatile_load, unaligned_volatile_store, volatile_load, volatile_store, +}; +use std::ptr::{read_volatile, write_volatile}; + +pub fn main() { + unsafe { + let mut i: isize = 1; + volatile_store(&mut i, 2); + assert_eq!(volatile_load(&i), 2); + } + unsafe { + let mut i: isize = 1; + unaligned_volatile_store(&mut i, 2); + assert_eq!(unaligned_volatile_load(&i), 2); + } + unsafe { + let mut i: isize = 1; + write_volatile(&mut i, 2); + assert_eq!(read_volatile(&i), 2); + } +} diff --git a/tests/run-make/weird-output-filenames/Makefile b/tests/run-make/weird-output-filenames/Makefile new file mode 100644 index 00000000000..d3a34e3b46e --- /dev/null +++ b/tests/run-make/weird-output-filenames/Makefile @@ -0,0 +1,15 @@ +include ../tools.mk + +all: + cp foo.rs $(TMPDIR)/.foo.rs + $(RUSTC) $(TMPDIR)/.foo.rs 2>&1 \ + | $(CGREP) -e "invalid character.*in crate name:" + cp foo.rs $(TMPDIR)/.foo.bar + $(RUSTC) $(TMPDIR)/.foo.bar 2>&1 \ + | $(CGREP) -e "invalid character.*in crate name:" + cp foo.rs $(TMPDIR)/+foo+bar.rs + $(RUSTC) $(TMPDIR)/+foo+bar.rs 2>&1 \ + | $(CGREP) -e "invalid character.*in crate name:" + cp foo.rs $(TMPDIR)/-foo.rs + $(RUSTC) $(TMPDIR)/-foo.rs 2>&1 \ + | $(CGREP) 'crate names cannot start with a `-`' diff --git a/tests/run-make/weird-output-filenames/foo.rs b/tests/run-make/weird-output-filenames/foo.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/weird-output-filenames/foo.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/windows-binary-no-external-deps/Makefile b/tests/run-make/windows-binary-no-external-deps/Makefile new file mode 100644 index 00000000000..8960020fed5 --- /dev/null +++ b/tests/run-make/windows-binary-no-external-deps/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# only-windows + +PATH=$(SYSTEMROOT)/system32 + +all: + $(RUSTC) hello.rs + $(TMPDIR)/hello.exe diff --git a/tests/run-make/windows-binary-no-external-deps/hello.rs b/tests/run-make/windows-binary-no-external-deps/hello.rs new file mode 100644 index 00000000000..47ad8c63411 --- /dev/null +++ b/tests/run-make/windows-binary-no-external-deps/hello.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello World!"); +} diff --git a/tests/run-make/windows-spawn/Makefile b/tests/run-make/windows-spawn/Makefile new file mode 100644 index 00000000000..b6cdb169bab --- /dev/null +++ b/tests/run-make/windows-spawn/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +# only-windows + +all: + $(RUSTC) -o "$(TMPDIR)/hopefullydoesntexist bar.exe" hello.rs + $(RUSTC) spawn.rs + $(TMPDIR)/spawn.exe diff --git a/tests/run-make/windows-spawn/hello.rs b/tests/run-make/windows-spawn/hello.rs new file mode 100644 index 00000000000..47ad8c63411 --- /dev/null +++ b/tests/run-make/windows-spawn/hello.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello World!"); +} diff --git a/tests/run-make/windows-spawn/spawn.rs b/tests/run-make/windows-spawn/spawn.rs new file mode 100644 index 00000000000..c34da3d5fde --- /dev/null +++ b/tests/run-make/windows-spawn/spawn.rs @@ -0,0 +1,12 @@ +use std::io::ErrorKind; +use std::process::Command; + +fn main() { + // Make sure it doesn't try to run "hopefullydoesntexist bar.exe". + assert_eq!(Command::new("hopefullydoesntexist") + .arg("bar") + .spawn() + .unwrap_err() + .kind(), + ErrorKind::NotFound); +} diff --git a/tests/run-make/windows-subsystem/Makefile b/tests/run-make/windows-subsystem/Makefile new file mode 100644 index 00000000000..78c4e2ac1e8 --- /dev/null +++ b/tests/run-make/windows-subsystem/Makefile @@ -0,0 +1,5 @@ +include ../tools.mk + +all: + $(RUSTC) windows.rs + $(RUSTC) console.rs diff --git a/tests/run-make/windows-subsystem/console.rs b/tests/run-make/windows-subsystem/console.rs new file mode 100644 index 00000000000..61a92eb6a9d --- /dev/null +++ b/tests/run-make/windows-subsystem/console.rs @@ -0,0 +1,3 @@ +#![windows_subsystem = "console"] + +fn main() {} diff --git a/tests/run-make/windows-subsystem/windows.rs b/tests/run-make/windows-subsystem/windows.rs new file mode 100644 index 00000000000..1138248f07d --- /dev/null +++ b/tests/run-make/windows-subsystem/windows.rs @@ -0,0 +1,3 @@ +#![windows_subsystem = "windows"] + +fn main() {} -- cgit 1.4.1-3-g733a5