Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3e5885f

Browse files
committedAug 8, 2024
changes after review
1 parent ae68b2f commit 3e5885f

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed
 

‎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]
+22-11
Original file line numberDiff line numberDiff line change
@@ -1,51 +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+
//!
19
//! How to run this
210
//! $ ./x.py clean
311
//! $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi tests/run-make
412
//!
5-
//! For supported targets, see `example/.cargo/config`
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
620
721
//@ only-thumb
822

923
use std::path::PathBuf;
1024

11-
use run_make_support::{cmd, env_var};
25+
use run_make_support::{cmd, env_var, path_helpers, target};
1226

1327
const CRATE: &str = "example";
1428

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

18-
let target = env_var("TARGET");
1932
let bootstrap_cargo = env_var("BOOTSTRAP_CARGO");
2033
let path = env_var("PATH");
2134
let rustc = env_var("RUSTC");
2235

23-
let target_dir = PathBuf::from("target");
24-
let manifest_path = PathBuf::from("Cargo.toml");
36+
let target_dir = path_helpers::path("target");
37+
let manifest_path = path_helpers::path("Cargo.toml");
2538

2639
let debug = {
2740
let mut cmd = cmd(&bootstrap_cargo);
28-
cmd.args(&["run", "--target", &target])
41+
cmd.args(&["run", "--target", &target()])
2942
.env("RUSTFLAGS", "-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x")
3043
.env("CARGO_TARGET_DIR", &target_dir)
3144
.env("PATH", &path)
3245
.env("RUSTC", &rustc);
3346
cmd.run()
3447
};
3548

36-
let stdout = debug.stdout_utf8();
37-
assert!(stdout.contains("x = 42"), "stdout: {:?}", stdout);
49+
debug.assert_stdout_contains("x = 42");
3850

3951
let release = {
4052
let mut cmd = cmd(&bootstrap_cargo);
41-
cmd.args(&["run", "--release", "--target", &target])
53+
cmd.args(&["run", "--release", "--target", &target()])
4254
.env("RUSTFLAGS", "-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x")
4355
.env("CARGO_TARGET_DIR", &target_dir)
4456
.env("PATH", &path)
4557
.env("RUSTC", &rustc);
4658
cmd.run()
4759
};
4860

49-
let stdout = release.stdout_utf8();
50-
assert!(stdout.contains("x = 42"), "stdout: {:?}", stdout);
61+
release.assert_stdout_contains("x = 42");
5162
}

0 commit comments

Comments
 (0)
Failed to load comments.