Skip to content

Commit 2048386

Browse files
committedAug 8, 2024·
Auto merge of rust-lang#128639 - folkertdev:rmake-thumb-none-qemu, r=jieyouxu
migrate `thumb-none-qemu` to rmake tracking issue: rust-lang#121876 I think this one is actually simpler than rust-lang#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
2 parents d3a3939 + 3e5885f commit 2048386

File tree

5 files changed

+64
-51
lines changed

5 files changed

+64
-51
lines changed
 

‎src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ run-make/rlib-format-packed-bundled-libs/Makefile
2222
run-make/split-debuginfo/Makefile
2323
run-make/symbol-mangling-hashed/Makefile
2424
run-make/sysroot-crates-are-unstable/Makefile
25-
run-make/thumb-none-qemu/Makefile
2625
run-make/translation/Makefile
2726
run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile

‎tests/run-make/thumb-none-qemu/Makefile

-27
This file was deleted.

‎tests/run-make/thumb-none-qemu/example/.cargo/config ‎tests/run-make/thumb-none-qemu/example/.cargo/config.toml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[target.thumbv6m-none-eabi]
2-
# FIXME: Should be Cortex-M0, but Qemu used by CI is too old
3-
runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
2+
runner = "qemu-system-arm -cpu cortex-m0 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
43

54
[target.thumbv7m-none-eabi]
65
runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
@@ -12,7 +11,7 @@ runner = "qemu-system-arm -cpu cortex-m4 -machine lm3s6965evb -nographic -semiho
1211
runner = "qemu-system-arm -cpu cortex-m4 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
1312

1413
[target.thumbv8m.base-none-eabi]
15-
# FIXME: Should be the Cortex-M23, bt Qemu does not currently support it
14+
# FIXME: Should be the Cortex-M23, but Qemu does not currently support it
1615
runner = "qemu-system-arm -cpu cortex-m33 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
1716

1817
[target.thumbv8m.main-none-eabi]
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
//! This test runs a basic application for thumb targets, using the cortex-m crate.
2+
//!
3+
//! These targets are very bare-metal: the first instruction the core runs on
4+
//! power-on is already user code. The cortex-m-rt has to initialize the stack, .data,
5+
//! .bss, enable the FPU if present, etc.
6+
//!
7+
//! This test builds and runs the applications for various thumb targets using qemu.
8+
//!
9+
//! How to run this
10+
//! $ ./x.py clean
11+
//! $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi tests/run-make
12+
//!
13+
//! For supported targets, see `example/.cargo/config.toml`
14+
//!
15+
//! FIXME: https://github.com/rust-lang/rust/issues/128733 this test uses external
16+
//! dependencies, and needs an active internet connection
17+
//!
18+
//! FIXME: https://github.com/rust-lang/rust/issues/128734 extract bootstrap cargo
19+
//! to a proper command
20+
21+
//@ only-thumb
22+
23+
use std::path::PathBuf;
24+
25+
use run_make_support::{cmd, env_var, path_helpers, target};
26+
27+
const CRATE: &str = "example";
28+
29+
fn main() {
30+
std::env::set_current_dir(CRATE).unwrap();
31+
32+
let bootstrap_cargo = env_var("BOOTSTRAP_CARGO");
33+
let path = env_var("PATH");
34+
let rustc = env_var("RUSTC");
35+
36+
let target_dir = path_helpers::path("target");
37+
let manifest_path = path_helpers::path("Cargo.toml");
38+
39+
let debug = {
40+
let mut cmd = cmd(&bootstrap_cargo);
41+
cmd.args(&["run", "--target", &target()])
42+
.env("RUSTFLAGS", "-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x")
43+
.env("CARGO_TARGET_DIR", &target_dir)
44+
.env("PATH", &path)
45+
.env("RUSTC", &rustc);
46+
cmd.run()
47+
};
48+
49+
debug.assert_stdout_contains("x = 42");
50+
51+
let release = {
52+
let mut cmd = cmd(&bootstrap_cargo);
53+
cmd.args(&["run", "--release", "--target", &target()])
54+
.env("RUSTFLAGS", "-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x")
55+
.env("CARGO_TARGET_DIR", &target_dir)
56+
.env("PATH", &path)
57+
.env("RUSTC", &rustc);
58+
cmd.run()
59+
};
60+
61+
release.assert_stdout_contains("x = 42");
62+
}

‎tests/run-make/thumb-none-qemu/script.sh

-20
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.