Skip to content

Commit

Permalink
Auto merge of #128639 - folkertdev:rmake-thumb-none-qemu, r=jieyouxu
Browse files Browse the repository at this point in the history
migrate `thumb-none-qemu` to rmake

tracking issue: #121876

I think this one is actually simpler than #128636, we invoke `cargo run` with the right target and see if the expected result appears.

r? `@jieyouxu`

try-job: armhf-gnu
try-job: dist-various-1
try-job: test-various
  • Loading branch information
bors committed Aug 8, 2024
2 parents d3a3939 + 3e5885f commit 2048386
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 51 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ run-make/rlib-format-packed-bundled-libs/Makefile
run-make/split-debuginfo/Makefile
run-make/symbol-mangling-hashed/Makefile
run-make/sysroot-crates-are-unstable/Makefile
run-make/thumb-none-qemu/Makefile
run-make/translation/Makefile
run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile
27 changes: 0 additions & 27 deletions tests/run-make/thumb-none-qemu/Makefile

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[target.thumbv6m-none-eabi]
# FIXME: Should be Cortex-M0, but Qemu used by CI is too old
runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
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"
Expand All @@ -12,7 +11,7 @@ runner = "qemu-system-arm -cpu cortex-m4 -machine lm3s6965evb -nographic -semiho
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, bt Qemu does not currently support it
# 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]
Expand Down
62 changes: 62 additions & 0 deletions tests/run-make/thumb-none-qemu/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//! 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
//!
//! FIXME: https://github.com/rust-lang/rust/issues/128734 extract bootstrap cargo
//! to a proper command
//@ only-thumb

use std::path::PathBuf;

use run_make_support::{cmd, env_var, path_helpers, target};

const CRATE: &str = "example";

fn main() {
std::env::set_current_dir(CRATE).unwrap();

let bootstrap_cargo = env_var("BOOTSTRAP_CARGO");
let path = env_var("PATH");
let rustc = env_var("RUSTC");

let target_dir = path_helpers::path("target");
let manifest_path = path_helpers::path("Cargo.toml");

let debug = {
let mut cmd = cmd(&bootstrap_cargo);
cmd.args(&["run", "--target", &target()])
.env("RUSTFLAGS", "-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x")
.env("CARGO_TARGET_DIR", &target_dir)
.env("PATH", &path)
.env("RUSTC", &rustc);
cmd.run()
};

debug.assert_stdout_contains("x = 42");

let release = {
let mut cmd = cmd(&bootstrap_cargo);
cmd.args(&["run", "--release", "--target", &target()])
.env("RUSTFLAGS", "-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x")
.env("CARGO_TARGET_DIR", &target_dir)
.env("PATH", &path)
.env("RUSTC", &rustc);
cmd.run()
};

release.assert_stdout_contains("x = 42");
}
20 changes: 0 additions & 20 deletions tests/run-make/thumb-none-qemu/script.sh

This file was deleted.

0 comments on commit 2048386

Please sign in to comment.