Skip to content

Commit 38dc3b2

Browse files
authored
Rollup merge of #128636 - folkertdev:rmake-thumb-none-cortex-m, r=jieyouxu
migrate `thumb-none-cortex-m` to rmake tracking issue: #121876 I'll leave some comments/questions inline r? ```@jieyouxu``` try-job: armhf-gnu try-job: dist-various-1 try-job: test-various
2 parents b817900 + 201ca3f commit 38dc3b2

File tree

3 files changed

+59
-39
lines changed

3 files changed

+59
-39
lines changed

Diff for: src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ run-make/split-debuginfo/Makefile
2323
run-make/staticlib-dylib-linkage/Makefile
2424
run-make/symbol-mangling-hashed/Makefile
2525
run-make/sysroot-crates-are-unstable/Makefile
26-
run-make/thumb-none-cortex-m/Makefile
2726
run-make/thumb-none-qemu/Makefile
2827
run-make/translation/Makefile
2928
run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile

Diff for: tests/run-make/thumb-none-cortex-m/Makefile

-38
This file was deleted.

Diff for: tests/run-make/thumb-none-cortex-m/rmake.rs

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//! Test building of the `cortex-m` crate, a foundational crate in the embedded ecosystem
2+
//! for a collection of thumb targets. This is a smoke test that verifies that both cargo
3+
//! and rustc work in this case.
4+
//!
5+
//! How to run this
6+
//! $ ./x.py clean
7+
//! $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi tests/run-make
8+
//!
9+
//! Supported targets:
10+
//! - thumbv6m-none-eabi (Bare Cortex-M0, M0+, M1)
11+
//! - thumbv7em-none-eabi (Bare Cortex-M4, M7)
12+
//! - thumbv7em-none-eabihf (Bare Cortex-M4F, M7F, FPU, hardfloat)
13+
//! - thumbv7m-none-eabi (Bare Cortex-M3)
14+
15+
//@ only-thumb
16+
17+
use std::path::PathBuf;
18+
19+
use run_make_support::rfs::create_dir;
20+
use run_make_support::{cmd, env_var, target};
21+
22+
const CRATE: &str = "cortex-m";
23+
const CRATE_URL: &str = "https://github.com/rust-embedded/cortex-m";
24+
const CRATE_SHA1: &str = "a448e9156e2cb1e556e5441fd65426952ef4b927"; // v0.5.0
25+
26+
fn main() {
27+
// FIXME: requires an internet connection https://github.com/rust-lang/rust/issues/128733
28+
// See below link for git usage:
29+
// https://stackoverflow.com/questions/3489173#14091182
30+
cmd("git").args(["clone", CRATE_URL, CRATE]).run();
31+
std::env::set_current_dir(CRATE).unwrap();
32+
cmd("git").args(["reset", "--hard", CRATE_SHA1]).run();
33+
34+
let target_dir = PathBuf::from("target");
35+
let manifest_path = PathBuf::from("Cargo.toml");
36+
37+
let path = env_var("PATH");
38+
let rustc = env_var("RUSTC");
39+
let bootstrap_cargo = env_var("BOOTSTRAP_CARGO");
40+
// FIXME: extract bootstrap cargo invocations to a proper command
41+
// https://github.com/rust-lang/rust/issues/128734
42+
let mut cmd = cmd(bootstrap_cargo);
43+
cmd.args(&[
44+
"build",
45+
"--manifest-path",
46+
manifest_path.to_str().unwrap(),
47+
"-Zbuild-std=core",
48+
"--target",
49+
&target(),
50+
])
51+
.env("PATH", path)
52+
.env("RUSTC", rustc)
53+
.env("CARGO_TARGET_DIR", &target_dir)
54+
// Don't make lints fatal, but they need to at least warn
55+
// or they break Cargo's target info parsing.
56+
.env("RUSTFLAGS", "-Copt-level=0 -Cdebug-assertions=yes --cap-lints=warn");
57+
58+
cmd.run();
59+
}

0 commit comments

Comments
 (0)