diff options
| author | Jieyou Xu <jieyouxu@outlook.com> | 2025-09-05 16:28:10 +0800 |
|---|---|---|
| committer | Jieyou Xu <jieyouxu@outlook.com> | 2025-09-05 21:22:51 +0800 |
| commit | 7154d39231fd8051bc207dda3afba21a11b14fcd (patch) | |
| tree | 1d04e8f643f458d0155151a0130c29ec3000b402 /tests/run-make | |
| parent | aebcbe0a4b1bb7df327bccf94a82117b4ca99a9f (diff) | |
| download | rust-7154d39231fd8051bc207dda3afba21a11b14fcd.tar.gz rust-7154d39231fd8051bc207dda3afba21a11b14fcd.zip | |
tests: move `run-make` tests requiring in-tree cargo to `run-make-cargo` test suite
Diffstat (limited to 'tests/run-make')
51 files changed, 0 insertions, 1286 deletions
diff --git a/tests/run-make/apple-slow-tls/rmake.rs b/tests/run-make/apple-slow-tls/rmake.rs deleted file mode 100644 index 231e0b1668e..00000000000 --- a/tests/run-make/apple-slow-tls/rmake.rs +++ /dev/null @@ -1,37 +0,0 @@ -//! Test if compilation with has-thread-local=false works, and if the output -//! has indeed no fast TLS variables. - -//@ only-apple - -use run_make_support::serde_json::{self, Value}; -use run_make_support::{cargo, llvm_nm, rfs, rustc}; - -fn main() { - let output = - rustc().print("target-spec-json").args(["-Z", "unstable-options"]).run().stdout_utf8(); - - let mut target_json: Value = serde_json::from_str(&output).unwrap(); - let has_thread_local = &mut target_json["has-thread-local"]; - assert!(matches!(has_thread_local, Value::Bool(true)), "{:?}", has_thread_local); - *has_thread_local = Value::Bool(false); - - let out_path = "t.json"; - rfs::write(out_path, serde_json::to_string(&target_json).unwrap()); - - cargo() - .args([ - "b", - "--manifest-path", - "tls_test/Cargo.toml", - "--target", - "t.json", - "-Zbuild-std=std,core,panic_abort", - ]) - .run(); - - // If a binary has any fast TLS variables, it should also contain the symbols - // __tlv_bootstrap and __tlv_atexit. We don't want them. - let output = llvm_nm().arg("tls_test/target/t/debug/tls_test").run().stdout_utf8(); - assert!(!output.contains("_tlv_bootstrap")); - assert!(!output.contains("_tlv_atexit")); -} diff --git a/tests/run-make/apple-slow-tls/tls_test/Cargo.toml b/tests/run-make/apple-slow-tls/tls_test/Cargo.toml deleted file mode 100644 index c8e5a228eef..00000000000 --- a/tests/run-make/apple-slow-tls/tls_test/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "tls_test" -version = "0.1.0" -edition = "2024" - -[dependencies] diff --git a/tests/run-make/apple-slow-tls/tls_test/src/main.rs b/tests/run-make/apple-slow-tls/tls_test/src/main.rs deleted file mode 100644 index d48d22bb3d1..00000000000 --- a/tests/run-make/apple-slow-tls/tls_test/src/main.rs +++ /dev/null @@ -1,10 +0,0 @@ -use std::cell::RefCell; - -fn main() { - thread_local! { - static S: RefCell<String> = RefCell::default(); - } - - S.with(|x| *x.borrow_mut() = "pika pika".to_string()); - S.with(|x| println!("{}", x.borrow())); -} diff --git a/tests/run-make/compiler-builtins/Cargo.toml b/tests/run-make/compiler-builtins/Cargo.toml deleted file mode 100644 index 869210c4a68..00000000000 --- a/tests/run-make/compiler-builtins/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "scratch" -version = "0.1.0" -edition = "2021" - -[lib] -path = "lib.rs" diff --git a/tests/run-make/compiler-builtins/lib.rs b/tests/run-make/compiler-builtins/lib.rs deleted file mode 100644 index 0c9ac1ac8e4..00000000000 --- a/tests/run-make/compiler-builtins/lib.rs +++ /dev/null @@ -1 +0,0 @@ -#![no_std] diff --git a/tests/run-make/compiler-builtins/rmake.rs b/tests/run-make/compiler-builtins/rmake.rs deleted file mode 100644 index 10093db2258..00000000000 --- a/tests/run-make/compiler-builtins/rmake.rs +++ /dev/null @@ -1,117 +0,0 @@ -//! The compiler_builtins library is special. It can call functions in core, but it must not -//! require linkage against a build of core. If it ever does, building the standard library *may* -//! result in linker errors, depending on whether the linker in use applies optimizations first or -//! resolves symbols first. So the portable and safe approach is to forbid such a linkage -//! requirement entirely. -//! -//! In addition, whether compiler_builtins requires linkage against core can depend on optimization -//! settings. Turning off optimizations and enabling debug assertions tends to produce the most -//! dependence on core that is possible, so that is the configuration we test here. - -// wasm and nvptx targets don't produce rlib files that object can parse. -//@ ignore-wasm -//@ ignore-nvptx64 - -#![deny(warnings)] - -use std::collections::HashSet; - -use run_make_support::object::read::Object; -use run_make_support::object::read::archive::ArchiveFile; -use run_make_support::object::{ObjectSection, ObjectSymbol, RelocationTarget}; -use run_make_support::rfs::{read, read_dir}; -use run_make_support::{cargo, object, path, target}; - -fn main() { - let target_dir = path("target"); - - println!("Testing compiler_builtins for {}", target()); - - cargo() - .args(&[ - "build", - "--manifest-path", - "Cargo.toml", - "-Zbuild-std=core", - "--target", - &target(), - ]) - .env("RUSTFLAGS", "-Copt-level=0 -Cdebug-assertions=yes") - .env("CARGO_TARGET_DIR", &target_dir) - .env("RUSTC_BOOTSTRAP", "1") - // Visual Studio 2022 requires that the LIB env var be set so it can - // find the Windows SDK. - .env("LIB", std::env::var("LIB").unwrap_or_default()) - .run(); - - let rlibs_path = target_dir.join(target()).join("debug").join("deps"); - let compiler_builtins_rlib = read_dir(rlibs_path) - .find_map(|e| { - let path = e.unwrap().path(); - let file_name = path.file_name().unwrap().to_str().unwrap(); - if file_name.starts_with("libcompiler_builtins") && file_name.ends_with(".rlib") { - Some(path) - } else { - None - } - }) - .unwrap(); - - // rlib files are archives, where the archive members each a CGU, and we also have one called - // lib.rmeta which is the encoded metadata. Each of the CGUs is an object file. - let data = read(compiler_builtins_rlib); - - let mut defined_symbols = HashSet::new(); - let mut undefined_relocations = HashSet::new(); - - let archive = ArchiveFile::parse(&*data).unwrap(); - for member in archive.members() { - let member = member.unwrap(); - if member.name() == b"lib.rmeta" { - continue; - } - let data = member.data(&*data).unwrap(); - let object = object::File::parse(&*data).unwrap(); - - // Record all defined symbols in this CGU. - for symbol in object.symbols() { - if !symbol.is_undefined() { - let name = symbol.name().unwrap(); - defined_symbols.insert(name); - } - } - - // Find any relocations against undefined symbols. Calls within this CGU are relocations - // against a defined symbol. - for (_offset, relocation) in object.sections().flat_map(|section| section.relocations()) { - let RelocationTarget::Symbol(symbol_index) = relocation.target() else { - continue; - }; - let symbol = object.symbol_by_index(symbol_index).unwrap(); - if symbol.is_undefined() { - let name = symbol.name().unwrap(); - undefined_relocations.insert(name); - } - } - } - - // We can have symbols in the compiler_builtins rlib that are actually from core, if they were - // monomorphized in the compiler_builtins crate. This is totally fine, because though the call - // is to a function in core, it's resolved internally. - // - // It is normal to have relocations against symbols not defined in the rlib for things like - // unwinding, or math functions provided the target's platform libraries. Finding these is not - // a problem, we want to specifically ban relocations against core which are not resolved - // internally. - undefined_relocations - .retain(|symbol| !defined_symbols.contains(symbol) && symbol.contains("core")); - - if !undefined_relocations.is_empty() { - panic!( - "compiler_builtins must not link against core, but it does. \n\ - These symbols may be undefined in a debug build of compiler_builtins:\n\ - {:?}", - undefined_relocations - ); - } -} diff --git a/tests/run-make/rustc-crates-on-stable/rmake.rs b/tests/run-make/rustc-crates-on-stable/rmake.rs deleted file mode 100644 index cbc1f24b8c1..00000000000 --- a/tests/run-make/rustc-crates-on-stable/rmake.rs +++ /dev/null @@ -1,42 +0,0 @@ -//! Checks if selected rustc crates can be compiled on the stable channel (or a "simulation" of it). -//! These crates are designed to be used by downstream users. - -use run_make_support::{cargo, rustc_path, source_root}; - -fn main() { - // Use the stage0 beta cargo for the compilation (it shouldn't really matter which cargo we use) - cargo() - // Ensure `proc-macro2`'s nightly detection is disabled - .env("RUSTC_STAGE", "0") - .env("RUSTC", rustc_path()) - // We want to disallow all nightly features to simulate a stable build - .env("RUSTFLAGS", "-Zallow-features=") - .arg("build") - .arg("--manifest-path") - .arg(source_root().join("Cargo.toml")) - .args(&[ - // Avoid depending on transitive rustc crates - "--no-default-features", - // Emit artifacts in this temporary directory, not in the source_root's `target` folder - "--target-dir", - "target", - ]) - // Check that these crates can be compiled on "stable" - .args(&[ - "-p", - "rustc_type_ir", - "-p", - "rustc_next_trait_solver", - "-p", - "rustc_pattern_analysis", - "-p", - "rustc_lexer", - "-p", - "rustc_abi", - "-p", - "rustc_parse_format", - "-p", - "rustc_hashes", - ]) - .run(); -} diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/Cargo.toml b/tests/run-make/rustdoc-scrape-examples-paths/foo/Cargo.toml deleted file mode 100644 index 6962028375b..00000000000 --- a/tests/run-make/rustdoc-scrape-examples-paths/foo/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "foo" -version = "0.0.1" -edition = "2024" - -[[example]] -name = "complex" -doc-scrape-examples = true diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/complex.rs b/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/complex.rs deleted file mode 100644 index 1cda7e098f4..00000000000 --- a/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/complex.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - let mut x = foo::X::new(); -} diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs b/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs deleted file mode 100644 index fbd1906ec09..00000000000 --- a/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs +++ /dev/null @@ -1 +0,0 @@ -// This file MUST exist to trigger the original bug. diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-paths/foo/src/lib.rs deleted file mode 100644 index a9bb0272c78..00000000000 --- a/tests/run-make/rustdoc-scrape-examples-paths/foo/src/lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub struct X; - -impl X { - pub fn new() -> Self { - X - } -} diff --git a/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs b/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs deleted file mode 100644 index 6784e438762..00000000000 --- a/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs +++ /dev/null @@ -1,16 +0,0 @@ -//! Test to ensure that the rustdoc `scrape-examples` feature is not panicking. -//! Regression test for <https://github.com/rust-lang/rust/issues/144752>. - -use run_make_support::cargo; -use run_make_support::scoped_run::run_in_tmpdir; - -fn main() { - // We copy the crate to be documented "outside" to prevent documenting - // the whole compiler. - std::env::set_current_dir("foo").unwrap(); - run_in_tmpdir(|| { - // The `scrape-examples` feature is also implemented in `cargo` so instead of reproducing - // what `cargo` does, better to just let `cargo` do it. - cargo().args(["doc", "-p", "foo", "-Zrustdoc-scrape-examples"]).run(); - }) -} diff --git a/tests/run-make/thumb-none-cortex-m/rmake.rs b/tests/run-make/thumb-none-cortex-m/rmake.rs deleted file mode 100644 index 27afef874da..00000000000 --- a/tests/run-make/thumb-none-cortex-m/rmake.rs +++ /dev/null @@ -1,45 +0,0 @@ -//! Test building of the `cortex-m` crate, a foundational crate in the embedded ecosystem -//! for a collection of thumb targets. This is a smoke test that verifies that both cargo -//! and rustc work in this case. -//! -//! How to run this -//! $ ./x.py clean -//! $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi tests/run-make -//! -//! Supported targets: -//! - thumbv6m-none-eabi (Bare Cortex-M0, M0+, M1) -//! - thumbv7em-none-eabi (Bare Cortex-M4, M7) -//! - thumbv7em-none-eabihf (Bare Cortex-M4F, M7F, FPU, hardfloat) -//! - thumbv7m-none-eabi (Bare Cortex-M3) - -//@ only-thumb - -use run_make_support::{cargo, cmd, env, env_var, target}; - -const CRATE: &str = "cortex-m"; -const CRATE_URL: &str = "https://github.com/rust-embedded/cortex-m"; -const CRATE_SHA1: &str = "a448e9156e2cb1e556e5441fd65426952ef4b927"; // v0.5.0 - -fn main() { - // FIXME: requires an internet connection https://github.com/rust-lang/rust/issues/128733 - // See below link for git usage: - // https://stackoverflow.com/questions/3489173#14091182 - cmd("git").args(["clone", CRATE_URL, CRATE]).run(); - env::set_current_dir(CRATE); - cmd("git").args(["reset", "--hard", CRATE_SHA1]).run(); - - cargo() - .args(&[ - "build", - "--manifest-path", - "Cargo.toml", - "-Zbuild-std=core", - "--target", - &target(), - ]) - .env("CARGO_TARGET_DIR", "target") - // Don't make lints fatal, but they need to at least warn - // or they break Cargo's target info parsing. - .env("RUSTFLAGS", "-Copt-level=0 -Cdebug-assertions=yes --cap-lints=warn") - .run(); -} diff --git a/tests/run-make/thumb-none-qemu/example/.cargo/config.toml b/tests/run-make/thumb-none-qemu/example/.cargo/config.toml deleted file mode 100644 index 7152e81b502..00000000000 --- a/tests/run-make/thumb-none-qemu/example/.cargo/config.toml +++ /dev/null @@ -1,44 +0,0 @@ -[target.thumbv6m-none-eabi] -runner = "qemu-system-arm -cpu cortex-m0 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - -[target.thumbv7m-none-eabi] -runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - -[target.thumbv7em-none-eabi] -runner = "qemu-system-arm -cpu cortex-m4 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - -[target.thumbv7em-none-eabihf] -runner = "qemu-system-arm -cpu cortex-m4 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - -[target.thumbv8m.base-none-eabi] -# FIXME: Should be the Cortex-M23, but Qemu does not currently support it -runner = "qemu-system-arm -cpu cortex-m33 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - -[target.thumbv8m.main-none-eabi] -runner = "qemu-system-arm -cpu cortex-m33 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - -[target.thumbv8m.main-none-eabihf] -runner = "qemu-system-arm -cpu cortex-m33 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel" - -[target.'cfg(all(target_arch = "arm", target_os = "none"))'] -# uncomment ONE of these three option to make `cargo run` start a GDB session -# which option to pick depends on your system -# runner = "arm-none-eabi-gdb -q -x openocd.gdb" -# runner = "gdb-multiarch -q -x openocd.gdb" -# runner = "gdb -q -x openocd.gdb" - -rustflags = [ - # LLD (shipped with the Rust toolchain) is used as the default linker - "-C", "link-arg=-Tlink.x", - - # if you run into problems with LLD switch to the GNU linker by commenting out - # this line - # "-C", "linker=arm-none-eabi-ld", - - # if you need to link to pre-compiled C libraries provided by a C toolchain - # use GCC as the linker by commenting out both lines above and then - # uncommenting the three lines below - # "-C", "linker=arm-none-eabi-gcc", - # "-C", "link-arg=-Wl,-Tlink.x", - # "-C", "link-arg=-nostartfiles", -] diff --git a/tests/run-make/thumb-none-qemu/example/Cargo.lock b/tests/run-make/thumb-none-qemu/example/Cargo.lock deleted file mode 100644 index 687b962a8b6..00000000000 --- a/tests/run-make/thumb-none-qemu/example/Cargo.lock +++ /dev/null @@ -1,199 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "aligned" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "as-slice 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "as-slice" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bare-metal" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cortex-m" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aligned 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bare-metal 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "volatile-register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cortex-m-rt" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cortex-m-rt-macros 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cortex-m-rt-macros" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cortex-m-semihosting" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cortex-m 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "example" -version = "0.1.0" -dependencies = [ - "cortex-m 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cortex-m-rt 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "cortex-m-semihosting 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "panic-halt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "generic-array" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "generic-array" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "panic-halt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "proc-macro2" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "r0" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "stable_deref_trait" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "syn" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "typenum" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "vcell" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "volatile-register" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "vcell 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum aligned 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eb1ce8b3382016136ab1d31a1b5ce807144f8b7eb2d5f16b2108f0f07edceb94" -"checksum as-slice 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "be6b7e95ac49d753f19cab5a825dea99a1149a04e4e3230b33ae16e120954c04" -"checksum bare-metal 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" -"checksum cortex-m 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2954942fbbdd49996704e6f048ce57567c3e1a4e2dc59b41ae9fde06a01fc763" -"checksum cortex-m-rt 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "33a716cd7d8627fae3892c2eede9249e50d2d79aedfb43ca28dad9a2b23876d9" -"checksum cortex-m-rt-macros 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "72b1073338d1e691b3b7aaf6bd61993e589ececce9242a02dfa5453e1b98918d" -"checksum cortex-m-semihosting 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "113ef0ecffee2b62b58f9380f4469099b30e9f9cbee2804771b4203ba1762cfa" -"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" -"checksum generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0ed1e761351b56f54eb9dcd0cfaca9fd0daecf93918e1cfc01c8a3d26ee7adcd" -"checksum panic-halt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" -"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" -"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum vcell 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "876e32dcadfe563a4289e994f7cb391197f362b6315dc45e8ba4aa6f564a4b3c" -"checksum volatile-register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d67cb4616d99b940db1d6bd28844ff97108b498a6ca850e5b6191a532063286" diff --git a/tests/run-make/thumb-none-qemu/example/Cargo.toml b/tests/run-make/thumb-none-qemu/example/Cargo.toml deleted file mode 100644 index 63eb5f90aec..00000000000 --- a/tests/run-make/thumb-none-qemu/example/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "example" -version = "0.1.0" -edition = "2018" - -[dependencies] -cortex-m = "0.6.2" -cortex-m-rt = "0.6.11" -panic-halt = "0.2.0" -cortex-m-semihosting = "0.3.1" diff --git a/tests/run-make/thumb-none-qemu/example/memory.x b/tests/run-make/thumb-none-qemu/example/memory.x deleted file mode 100644 index dc7ad967a42..00000000000 --- a/tests/run-make/thumb-none-qemu/example/memory.x +++ /dev/null @@ -1,23 +0,0 @@ -/* Device specific memory layout */ - -/* This file is used to build the cortex-m-rt examples, - but not other applications using cortex-m-rt. */ - -MEMORY -{ - /* FLASH and RAM are mandatory memory regions */ - /* Update examples/data_overflow.rs if you change these sizes. */ - FLASH : ORIGIN = 0x00000000, LENGTH = 256K - RAM : ORIGIN = 0x20000000, LENGTH = 64K - - /* More memory regions can declared: for example this is a second RAM region */ - /* CCRAM : ORIGIN = 0x10000000, LENGTH = 8K */ -} - -/* The location of the stack can be overridden using the `_stack_start` symbol. - By default it will be placed at the end of the RAM region */ -/* _stack_start = ORIGIN(CCRAM) + LENGTH(CCRAM); */ - -/* The location of the .text section can be overridden using the `_stext` symbol. - By default it will place after .vector_table */ -/* _stext = ORIGIN(FLASH) + 0x40c; */ \ No newline at end of file diff --git a/tests/run-make/thumb-none-qemu/example/src/main.rs b/tests/run-make/thumb-none-qemu/example/src/main.rs deleted file mode 100644 index 4b8162c4120..00000000000 --- a/tests/run-make/thumb-none-qemu/example/src/main.rs +++ /dev/null @@ -1,23 +0,0 @@ -#![no_main] -#![no_std] -use core::fmt::Write; - -use cortex_m::asm; -use cortex_m_rt::entry; -use {cortex_m_semihosting as semihosting, panic_halt as _}; - -#[entry] -fn main() -> ! { - let x = 42; - - loop { - asm::nop(); - - // write something through semihosting interface - let mut hstdout = semihosting::hio::hstdout().unwrap(); - let _ = write!(hstdout, "x = {}\n", x); - - // exit from qemu - semihosting::debug::exit(semihosting::debug::EXIT_SUCCESS); - } -} diff --git a/tests/run-make/thumb-none-qemu/rmake.rs b/tests/run-make/thumb-none-qemu/rmake.rs deleted file mode 100644 index 9d4b426f4a1..00000000000 --- a/tests/run-make/thumb-none-qemu/rmake.rs +++ /dev/null @@ -1,46 +0,0 @@ -//! This test runs a basic application for thumb targets, using the cortex-m crate. -//! -//! These targets are very bare-metal: the first instruction the core runs on -//! power-on is already user code. The cortex-m-rt has to initialize the stack, .data, -//! .bss, enable the FPU if present, etc. -//! -//! This test builds and runs the applications for various thumb targets using qemu. -//! -//! How to run this -//! $ ./x.py clean -//! $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi tests/run-make -//! -//! For supported targets, see `example/.cargo/config.toml` -//! -//! FIXME: https://github.com/rust-lang/rust/issues/128733 this test uses external -//! dependencies, and needs an active internet connection - -//@ only-thumb - -use std::path::PathBuf; - -use run_make_support::{cargo, cmd, env_var, path, target}; - -const CRATE: &str = "example"; - -fn main() { - std::env::set_current_dir(CRATE).unwrap(); - - let target_dir = path("target"); - - // Debug - cargo() - .args(&["run", "--target", &target()]) - .env("RUSTFLAGS", "-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x") - .env("CARGO_TARGET_DIR", &target_dir) - .run() - .assert_stdout_contains("x = 42"); - - // Release - cargo() - .args(&["run", "--release", "--target", &target()]) - .env("RUSTFLAGS", "-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x") - .env("CARGO_TARGET_DIR", &target_dir) - .run() - .assert_stdout_contains("x = 42"); -} diff --git a/tests/run-make/uefi-qemu/rmake.rs b/tests/run-make/uefi-qemu/rmake.rs deleted file mode 100644 index 55d42fba5e7..00000000000 --- a/tests/run-make/uefi-qemu/rmake.rs +++ /dev/null @@ -1,84 +0,0 @@ -//! This test builds and runs a basic UEFI application on QEMU for various targets. -//! -//! You must have the relevant OVMF or AAVMF firmware installed for this to work. -//! -//! Requires: qemu-system-x86_64, qemu-system-aarch64 -//! OVMF/AAVMF firmware -//! -//! Note: test assumes `/uefi_qemu_test` exists and is a self-contained crate. - -//@ only-uefi - -use std::path::Path; - -use run_make_support::{cargo, cmd, path, rfs}; - -fn main() { - let target = run_make_support::target(); - - let (boot_filename, ovmf_dir, ovmf_code_name, ovmf_vars_name, qemu, machine, cpu) = - match target.as_str() { - "aarch64-unknown-uefi" => ( - "bootaa64.efi", - Path::new("/usr/share/AAVMF"), - "AAVMF_CODE.fd", - "AAVMF_VARS.fd", - "qemu-system-aarch64", - "virt", - "cortex-a72", - ), - "i686-unknown-uefi" => ( - "bootia32.efi", - Path::new("/usr/share/OVMF"), - "OVMF32_CODE_4M.secboot.fd", - "OVMF32_VARS_4M.fd", - "qemu-system-x86_64", - "q35", - "qemu64", - ), - "x86_64-unknown-uefi" => ( - "bootx64.efi", - Path::new("/usr/share/OVMF"), - "OVMF_CODE_4M.fd", - "OVMF_VARS_4M.fd", - "qemu-system-x86_64", - "q35", - "qemu64", - ), - _ => panic!("unsupported target {target}"), - }; - - let tmp = std::env::temp_dir(); - let test_crate = tmp.join("uefi_qemu_test"); - rfs::copy_dir_all(path("uefi_qemu_test"), &test_crate); - - cargo().args(&["build", "--target", &target]).current_dir(&test_crate).run(); - - // Prepare ESP - let esp = test_crate.join("esp"); - let boot = esp.join("efi/boot"); - rfs::create_dir_all(&boot); - - let src_efi = test_crate.join("target").join(&target).join("debug/uefi_qemu_test.efi"); - let dst_efi = boot.join(boot_filename); - rfs::copy(&src_efi, &dst_efi); - - // Copy OVMF files - let code = ovmf_dir.join(ovmf_code_name); - let vars_src = ovmf_dir.join(ovmf_vars_name); - let vars_dst = tmp.join("vars.fd"); - rfs::copy(&vars_src, &vars_dst); - - let output = cmd(qemu) - .args(["-machine", machine]) - .args(["-cpu", cpu]) - .args(["-display", "none"]) - .args(["-serial", "stdio"]) - .args(["-drive", &format!("if=pflash,format=raw,readonly=on,file={}", code.display())]) - .args(["-drive", &format!("if=pflash,format=raw,readonly=off,file={}", vars_dst.display())]) - .args(["-drive", &format!("format=raw,file=fat:rw:{}", esp.display())]) - .run() - .stdout_utf8(); - - assert!(output.contains("Hello World!"), "invalid output for {target}:\n{output}"); -} diff --git a/tests/run-make/uefi-qemu/uefi_qemu_test/Cargo.lock b/tests/run-make/uefi-qemu/uefi_qemu_test/Cargo.lock deleted file mode 100644 index 8b6a664ad93..00000000000 --- a/tests/run-make/uefi-qemu/uefi_qemu_test/Cargo.lock +++ /dev/null @@ -1,16 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "r-efi" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" - -[[package]] -name = "uefi_qemu_test" -version = "0.0.0" -dependencies = [ - "r-efi", -] diff --git a/tests/run-make/uefi-qemu/uefi_qemu_test/Cargo.toml b/tests/run-make/uefi-qemu/uefi_qemu_test/Cargo.toml deleted file mode 100644 index 1a8d0d94368..00000000000 --- a/tests/run-make/uefi-qemu/uefi_qemu_test/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "uefi_qemu_test" -version = "0.0.0" -edition = "2021" - -[workspace] -resolver = "2" - -[dependencies] -r-efi = "5.2.0" diff --git a/tests/run-make/uefi-qemu/uefi_qemu_test/src/main.rs b/tests/run-make/uefi-qemu/uefi_qemu_test/src/main.rs deleted file mode 100644 index f8e1212a9f6..00000000000 --- a/tests/run-make/uefi-qemu/uefi_qemu_test/src/main.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Code is adapted from this hello world example: -// https://doc.rust-lang.org/nightly/rustc/platform-support/unknown-uefi.html - -#![no_main] -#![no_std] - -use core::{panic, ptr}; - -use r_efi::efi::{Char16, Handle, RESET_SHUTDOWN, Status, SystemTable}; - -#[panic_handler] -fn panic_handler(_info: &panic::PanicInfo) -> ! { - loop {} -} - -#[export_name = "efi_main"] -pub extern "C" fn main(_h: Handle, st: *mut SystemTable) -> Status { - let s = b"Hello World!\n\0".map(|c| u16::from(c)); - - // Print "Hello World!". - let r = unsafe { ((*(*st).con_out).output_string)((*st).con_out, s.as_ptr() as *mut Char16) }; - if r.is_error() { - return r; - } - - // Shut down. - unsafe { - ((*((*st).runtime_services)).reset_system)( - RESET_SHUTDOWN, - Status::SUCCESS, - 0, - ptr::null_mut(), - ); - } - - // This should never be reached because `reset_system` should never - // return, so fail with an error if we get here. - Status::UNSUPPORTED -} diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks deleted file mode 100644 index d2e53bee08f..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks +++ /dev/null @@ -1,7 +0,0 @@ -CHECK: cc_plus_one_asm -CHECK-NEXT: movl -CHECK-NEXT: lfence -CHECK-NEXT: incl -CHECK-NEXT: shlq $0x0, (%rsp) -CHECK-NEXT: lfence -CHECK-NEXT: retq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c.checks deleted file mode 100644 index b93b33afb3f..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c.checks +++ /dev/null @@ -1,6 +0,0 @@ -CHECK: cc_plus_one_c -CHECK: lfence -CHECK: popq -CHECK-NEXT: popq [[REGISTER:%[a-z]+]] -CHECK-NEXT: lfence -CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks deleted file mode 100644 index 0a3d1dced42..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks +++ /dev/null @@ -1,15 +0,0 @@ -CHECK: cc_plus_one_c_asm -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK-NEXT: incl -CHECK-NEXT: jmp -CHECK-NEXT: shlq $0x0, (%rsp) -CHECK-NEXT: lfence -CHECK-NEXT: retq -CHECK: popq -CHECK-NEXT: popq [[REGISTER:%[a-z]+]] -CHECK-NEXT: lfence -CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx.checks deleted file mode 100644 index f96f152c02f..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx.checks +++ /dev/null @@ -1,6 +0,0 @@ -CHECK: cc_plus_one_cxx -CHECK: lfence -CHECK: popq -CHECK-NEXT: popq [[REGISTER:%[a-z]+]] -CHECK-NEXT: lfence -CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks deleted file mode 100644 index 0126cd8ee64..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks +++ /dev/null @@ -1,16 +0,0 @@ -CHECK: cc_plus_one_cxx_asm -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: movl -CHECK: lfence -CHECK: lfence -CHECK-NEXT: incl -CHECK-NEXT: jmp 0x{{[[:xdigit:]]+}} <cc_plus_one_cxx_asm+0x{{[[:xdigit:]]+}}> -CHECK-NEXT: shlq $0x0, (%rsp) -CHECK-NEXT: lfence -CHECK-NEXT: retq -CHECK: popq -CHECK-NEXT: popq [[REGISTER:%[a-z]+]] -CHECK-NEXT: lfence -CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks deleted file mode 100644 index 61567548848..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks +++ /dev/null @@ -1,7 +0,0 @@ -CHECK: cmake_plus_one_asm -CHECK-NEXT: movl -CHECK-NEXT: lfence -CHECK-NEXT: incl -CHECK-NEXT: shlq $0x0, (%rsp) -CHECK-NEXT: lfence -CHECK-NEXT: retq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c.checks deleted file mode 100644 index f551356b2ff..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c.checks +++ /dev/null @@ -1,6 +0,0 @@ -CHECK: cmake_plus_one_c -CHECK: lfence -CHECK: popq -CHECK-NEXT: popq [[REGISTER:%[a-z]+]] -CHECK-NEXT: lfence -CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks deleted file mode 100644 index 17312b9126a..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks +++ /dev/null @@ -1,16 +0,0 @@ -CHECK: cmake_plus_one_c_asm -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: movl -CHECK: lfence -CHECK-NEXT: incl -CHECK-NEXT: jmp 0x{{[[:xdigit:]]+}} <cmake_plus_one_c_asm+0x{{[[:xdigit:]]+}}> -CHECK-NEXT: shlq $0x0, (%rsp) -CHECK-NEXT: lfence -CHECK-NEXT: retq -CHECK: popq -CHECK-NEXT: popq [[REGISTER:%[a-z]+]] -CHECK-NEXT: lfence -CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_global_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_global_asm.checks deleted file mode 100644 index 4b66cc5bc83..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_global_asm.checks +++ /dev/null @@ -1,2 +0,0 @@ -CHECK: cmake_plus_one_c_global_asm -CHECK: lfence diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx.checks deleted file mode 100644 index 0f403e0203c..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx.checks +++ /dev/null @@ -1,6 +0,0 @@ -CHECK: cmake_plus_one_cxx -CHECK: lfence -CHECK: popq -CHECK-NEXT: popq [[REGISTER:%[a-z]+]] -CHECK-NEXT: lfence -CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks deleted file mode 100644 index 222e4ef7983..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks +++ /dev/null @@ -1,16 +0,0 @@ -CHECK: cmake_plus_one_cxx_asm -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: movl -CHECK: lfence -CHECK-NEXT: incl -CHECK-NEXT: jmp 0x{{[[:xdigit:]]+}} <cmake_plus_one_cxx_asm+0x{{[[:xdigit:]]+}}> -CHECK-NEXT: shlq $0x0, (%rsp) -CHECK-NEXT: lfence -CHECK-NEXT: retq -CHECK: popq -CHECK-NEXT: popq [[REGISTER:%[a-z]+]] -CHECK-NEXT: lfence -CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks deleted file mode 100644 index 1d8fc96ad50..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks +++ /dev/null @@ -1,7 +0,0 @@ -CHECK: cmake_plus_one_cxx_global_asm -CHECK-NEXT: movl -CHECK-NEXT: lfence -CHECK-NEXT: incl -CHECK-NEXT: shlq $0x0, (%rsp) -CHECK-NEXT: lfence -CHECK-NEXT: retq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/Cargo.toml b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/Cargo.toml deleted file mode 100644 index 3a97c37e951..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "enclave" -version = "0.1.0" -edition = "2018" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[build-dependencies] -cc = "1.0" -cmake = "0.1" diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs deleted file mode 100644 index f1fb5803948..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs +++ /dev/null @@ -1,22 +0,0 @@ -fn main() { - cc::Build::new().file("foo.c").compile("foo_c"); - - cc::Build::new().file("foo_asm.s").compile("foo_asm"); - - cc::Build::new().cpp(true).cpp_set_stdlib(None).file("foo_cxx.cpp").compile("foo_cxx"); - - // When the cmake crate detects the clang compiler, it passes the - // "--target" argument to the linker which subsequently fails. The - // `CMAKE_C_COMPILER_FORCED` option makes sure that `cmake` does not - // tries to test the compiler. From version 3.6 the option - // `CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY` can be used - // https://cmake.org/cmake/help/v3.5/module/CMakeForceCompiler.html - let dst = cmake::Config::new("libcmake_foo") - .build_target("cmake_foo") - .define("CMAKE_C_COMPILER_FORCED", "1") - .define("CMAKE_CXX_COMPILER_FORCED", "1") - .define("CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY", "1") - .build(); - println!("cargo:rustc-link-search=native={}/build/", dst.display()); - println!("cargo:rustc-link-lib=static=cmake_foo"); -} diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo.c b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo.c deleted file mode 100644 index dd76d4f303a..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo.c +++ /dev/null @@ -1,18 +0,0 @@ -int cc_plus_one_c(int *arg) { - return *arg + 1; -} - -int cc_plus_one_c_asm(int *arg) { - int value = 0; - - asm volatile ( " movl (%1), %0\n" - " inc %0\n" - " jmp 1f\n" - " retq\n" // never executed, but a shortcut to determine how - // the assembler deals with `ret` instructions - "1:\n" - : "=r"(value) - : "r"(arg) ); - - return value; -} diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_asm.s b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_asm.s deleted file mode 100644 index 6d56214e87e..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_asm.s +++ /dev/null @@ -1,7 +0,0 @@ - .text - .global cc_plus_one_asm - .type cc_plus_one_asm, @function -cc_plus_one_asm: - movl (%rdi), %eax - inc %eax - retq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_cxx.cpp b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_cxx.cpp deleted file mode 100644 index ac6f64ac413..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_cxx.cpp +++ /dev/null @@ -1,21 +0,0 @@ -extern "C" int cc_plus_one_cxx(int *arg); -extern "C" int cc_plus_one_cxx_asm(int *arg); - -int cc_plus_one_cxx(int *arg) { - return *arg + 1; -} - -int cc_plus_one_cxx_asm(int *arg) { - int value = 0; - - asm volatile ( " movl (%1), %0\n" - " inc %0\n" - " jmp 1f\n" - " retq\n" // never executed, but a shortcut to determine how - // the assembler deals with `ret` instructions - "1:\n" - : "=r"(value) - : "r"(arg) ); - - return value; -} diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/CMakeLists.txt b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/CMakeLists.txt deleted file mode 100644 index 27cdf2ecf82..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -enable_language(C CXX ASM) - -set(C_SOURCES - src/foo.c - ) - -set_source_files_properties(${C_SOURCES} - PROPERTIES - LANGUAGE C) - -set(CXX_SOURCES - src/foo_cxx.cpp - ) - -set_source_files_properties(${CXX_SOURCES} - PROPERTIES - LANGUAGE CXX) - -set(ASM_SOURCES - src/foo_asm.s - ) - -set_source_files_properties(${ASM_SOURCES} - PROPERTIES - LANGUAGE ASM) - -set(SOURCES - ${C_SOURCES} - ${CXX_SOURCES} - ${ASM_SOURCES}) - -add_library(cmake_foo STATIC - ${SOURCES}) diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo.c b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo.c deleted file mode 100644 index c3b731a2d50..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo.c +++ /dev/null @@ -1,26 +0,0 @@ -int cmake_plus_one_c(int *arg) { - return *arg + 1; -} - -int cmake_plus_one_c_asm(int *arg) { - int value = 0; - - asm volatile ( " movl (%1), %0\n" - " inc %0\n" - " jmp 1f\n" - " retq\n" // never executed, but a shortcut to determine how - // the assembler deals with `ret` instructions - "1:\n" - : "=r"(value) - : "r"(arg) ); - - return value; -} - -asm(".text\n" -" .global cmake_plus_one_c_global_asm\n" -" .type cmake_plus_one_c_global_asm, @function\n" -"cmake_plus_one_c_global_asm:\n" -" movl (%rdi), %eax\n" -" inc %eax\n" -" retq\n" ); diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_asm.s b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_asm.s deleted file mode 100644 index 64b6b430eea..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_asm.s +++ /dev/null @@ -1,7 +0,0 @@ - .text - .global cmake_plus_one_asm - .type cmake_plus_one_asm, @function -cmake_plus_one_asm: - movl (%rdi), %eax - inc %eax - retq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_cxx.cpp b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_cxx.cpp deleted file mode 100644 index 824e2afebcc..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_cxx.cpp +++ /dev/null @@ -1,29 +0,0 @@ -extern "C" int cmake_plus_one_cxx(int *arg); -extern "C" int cmake_plus_one_cxx_asm(int *arg); - -int cmake_plus_one_cxx(int *arg) { - return *arg + 1; -} - -int cmake_plus_one_cxx_asm(int *arg) { - int value = 0; - - asm volatile ( " movl (%1), %0\n" - " inc %0\n" - " jmp 1f\n" - " retq\n" // never executed, but a shortcut to determine how - // the assembler deals with `ret` instructions - "1:\n" - : "=r"(value) - : "r"(arg) ); - - return value; -} - -asm(".text\n" -" .global cmake_plus_one_cxx_global_asm\n" -" .type cmake_plus_one_cxx_global_asm, @function\n" -"cmake_plus_one_cxx_global_asm:\n" -" movl (%rdi), %eax\n" -" inc %eax\n" -" retq\n" ); diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs deleted file mode 100644 index cde38aacf7f..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs +++ /dev/null @@ -1,49 +0,0 @@ -std::arch::global_asm!( - r#" - .text - .global rust_plus_one_global_asm - .type rust_plus_one_global_asm, @function -rust_plus_one_global_asm: - movl (%rdi), %eax - inc %eax - retq -"#, - options(att_syntax) -); - -extern "C" { - fn cc_plus_one_c(arg: &u32) -> u32; - fn cc_plus_one_c_asm(arg: &u32) -> u32; - fn cc_plus_one_cxx(arg: &u32) -> u32; - fn cc_plus_one_cxx_asm(arg: &u32) -> u32; - fn cc_plus_one_asm(arg: &u32) -> u32; - fn cmake_plus_one_c(arg: &u32) -> u32; - fn cmake_plus_one_c_asm(arg: &u32) -> u32; - fn cmake_plus_one_cxx(arg: &u32) -> u32; - fn cmake_plus_one_cxx_asm(arg: &u32) -> u32; - fn cmake_plus_one_c_global_asm(arg: &u32) -> u32; - fn cmake_plus_one_cxx_global_asm(arg: &u32) -> u32; - fn cmake_plus_one_asm(arg: &u32) -> u32; - fn rust_plus_one_global_asm(arg: &u32) -> u32; -} - -fn main() { - let value: u32 = 41; - let question = "Answer to the Ultimate Question of Life, the Universe, and Everything:"; - - unsafe { - println!("{}: {}!", question, rust_plus_one_global_asm(&value)); - println!("{}: {}!", question, cc_plus_one_c(&value)); - println!("{}: {}!", question, cc_plus_one_c_asm(&value)); - println!("{}: {}!", question, cc_plus_one_cxx(&value)); - println!("{}: {}!", question, cc_plus_one_cxx_asm(&value)); - println!("{}: {}!", question, cc_plus_one_asm(&value)); - println!("{}: {}!", question, cmake_plus_one_c(&value)); - println!("{}: {}!", question, cmake_plus_one_c_asm(&value)); - println!("{}: {}!", question, cmake_plus_one_cxx(&value)); - println!("{}: {}!", question, cmake_plus_one_cxx_asm(&value)); - println!("{}: {}!", question, cmake_plus_one_c_global_asm(&value)); - println!("{}: {}!", question, cmake_plus_one_cxx_global_asm(&value)); - println!("{}: {}!", question, cmake_plus_one_asm(&value)); - } -} diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks deleted file mode 100644 index 885bf461bf3..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks +++ /dev/null @@ -1,24 +0,0 @@ -CHECK: __libunwind_Registers_x86_64_jumpto -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK-NEXT: popq [[REGISTER:%[a-z]+]] -CHECK-NEXT: lfence -CHECK-NEXT: popq [[REGISTER:%[a-z]+]] -CHECK-NEXT: lfence -CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks deleted file mode 100644 index 485e20e3111..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks +++ /dev/null @@ -1,7 +0,0 @@ -CHECK: print -CHECK: lfence -CHECK: popq -CHECK: popq -CHECK-NEXT: popq [[REGISTER:%[a-z]+]] -CHECK-NEXT: lfence -CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.without_frame_pointers.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.without_frame_pointers.checks deleted file mode 100644 index e02fe094889..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.without_frame_pointers.checks +++ /dev/null @@ -1,6 +0,0 @@ -CHECK: print -CHECK: lfence -CHECK: popq -CHECK-NEXT: popq [[REGISTER:%[a-z]+]] -CHECK-NEXT: lfence -CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rmake.rs b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rmake.rs deleted file mode 100644 index 89754cdaf90..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rmake.rs +++ /dev/null @@ -1,113 +0,0 @@ -// ignore-tidy-linelength -// Reason: intel.com link - -// This security test checks that the disassembled form of certain symbols -// is "hardened" - that means, the assembly instructions match a pattern that -// mitigate potential Load Value Injection vulnerabilities. -// To do so, a test crate is compiled, and certain symbols are found, disassembled -// and checked one by one. -// See https://github.com/rust-lang/rust/pull/77008 - -// On load value injection: -// https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/load-value-injection.html - -//@ only-x86_64-fortanix-unknown-sgx - -use run_make_support::{ - cargo, cwd, llvm_filecheck, llvm_objdump, regex, run, set_current_dir, target, -}; - -fn main() { - cargo() - .arg("-v") - .arg("build") - .arg("--target") - .arg(target()) - .current_dir("enclave") - .env("CC_x86_64_fortanix_unknown_sgx", "clang") - .env( - "CFLAGS_x86_64_fortanix_unknown_sgx", - "-D__ELF__ -isystem/usr/include/x86_64-linux-gnu -mlvi-hardening -mllvm -x86-experimental-lvi-inline-asm-hardening", - ) - .env("CXX_x86_64_fortanix_unknown_sgx", "clang++") - .env( - "CXXFLAGS_x86_64_fortanix_unknown_sgx", - "-D__ELF__ -isystem/usr/include/x86_64-linux-gnu -mlvi-hardening -mllvm -x86-experimental-lvi-inline-asm-hardening", - ) - .run(); - - // Rust has several ways of including machine code into a binary: - // - // - Rust code - // - Inline assembly - // - Global assembly - // - C/C++ code compiled as part of Rust crates - // - // For each of those, check that the mitigations are applied. Mostly we check - // that ret instructions are no longer present. - - // Check that normal rust code has the right mitigations. - check("unw_getcontext", "unw_getcontext.checks"); - check("__libunwind_Registers_x86_64_jumpto", "jumpto.checks"); - - check("std::io::stdio::_print::[[:alnum:]]+", "print.with_frame_pointers.checks"); - - // Check that rust global assembly has the right mitigations. - check("rust_plus_one_global_asm", "rust_plus_one_global_asm.checks"); - - // Check that C code compiled using the `cc` crate has the right mitigations. - check("cc_plus_one_c", "cc_plus_one_c.checks"); - check("cc_plus_one_c_asm", "cc_plus_one_c_asm.checks"); - check("cc_plus_one_cxx", "cc_plus_one_cxx.checks"); - check("cc_plus_one_cxx_asm", "cc_plus_one_cxx_asm.checks"); - check("cc_plus_one_asm", "cc_plus_one_asm.checks"); - - // Check that C++ code compiled using the `cc` crate has the right mitigations. - check("cmake_plus_one_c", "cmake_plus_one_c.checks"); - check("cmake_plus_one_c_asm", "cmake_plus_one_c_asm.checks"); - check("cmake_plus_one_c_global_asm", "cmake_plus_one_c_global_asm.checks"); - check("cmake_plus_one_cxx", "cmake_plus_one_cxx.checks"); - check("cmake_plus_one_cxx_asm", "cmake_plus_one_cxx_asm.checks"); - check("cmake_plus_one_cxx_global_asm", "cmake_plus_one_cxx_global_asm.checks"); - check("cmake_plus_one_asm", "cmake_plus_one_asm.checks"); -} - -fn check(func_re: &str, mut checks: &str) { - let dump = llvm_objdump() - .input("enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave") - .args(&["--syms", "--demangle"]) - .run() - .stdout_utf8(); - let re = regex::Regex::new(&format!("[[:blank:]]+{func_re}")).unwrap(); - let func = re.find_iter(&dump).map(|m| m.as_str().trim()).collect::<Vec<&str>>().join(","); - assert!(!func.is_empty()); - let dump = llvm_objdump() - .input("enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave") - .args(&["--demangle", &format!("--disassemble-symbols={func}")]) - .run() - .stdout(); - - // Unique case, must succeed at one of two possible tests. - // This is because frame pointers are optional, and them being enabled requires - // an additional `popq` in the pattern checking file. - if func_re == "std::io::stdio::_print::[[:alnum:]]+" { - let output = llvm_filecheck().stdin_buf(&dump).patterns(checks).run_unchecked(); - if !output.status().success() { - checks = "print.without_frame_pointers.checks"; - llvm_filecheck().stdin_buf(&dump).patterns(checks).run(); - } - } else { - llvm_filecheck().stdin_buf(&dump).patterns(checks).run(); - } - if !["rust_plus_one_global_asm", "cmake_plus_one_c_global_asm", "cmake_plus_one_cxx_global_asm"] - .contains(&func_re) - { - // The assembler cannot avoid explicit `ret` instructions. Sequences - // of `shlq $0x0, (%rsp); lfence; retq` are used instead. - llvm_filecheck() - .args(&["--implicit-check-not", "ret"]) - .stdin_buf(dump) - .patterns(checks) - .run(); - } -} diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rust_plus_one_global_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rust_plus_one_global_asm.checks deleted file mode 100644 index fe6777537fb..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rust_plus_one_global_asm.checks +++ /dev/null @@ -1,2 +0,0 @@ -CHECK: rust_plus_one_global_asm -CHECK: lfence diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks deleted file mode 100644 index b46cf758384..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks +++ /dev/null @@ -1,6 +0,0 @@ -CHECK: unw_getcontext -CHECK: lfence -CHECK: lfence -CHECK: shlq $0x0, (%rsp) -CHECK-NEXT: lfence -CHECK-NEXT: retq |
