|
15 | 15 | #![deny(warnings)]
|
16 | 16 |
|
17 | 17 | use std::collections::HashSet;
|
18 |
| -use std::path::PathBuf; |
19 | 18 |
|
20 | 19 | use run_make_support::object::read::Object;
|
21 | 20 | use run_make_support::object::read::archive::ArchiveFile;
|
22 | 21 | use run_make_support::object::{ObjectSection, ObjectSymbol, RelocationTarget};
|
23 | 22 | use run_make_support::rfs::{read, read_dir};
|
24 |
| -use run_make_support::{cmd, env_var, object}; |
| 23 | +use run_make_support::{cargo, env_var, object, path, target}; |
25 | 24 |
|
26 | 25 | fn main() {
|
27 |
| - let target_dir = PathBuf::from("target"); |
28 |
| - let target = env_var("TARGET"); |
29 |
| - |
30 |
| - println!("Testing compiler_builtins for {}", target); |
31 |
| - |
32 |
| - let manifest_path = PathBuf::from("Cargo.toml"); |
33 |
| - |
34 |
| - let path = env_var("PATH"); |
35 |
| - let rustc = env_var("RUSTC"); |
36 |
| - let cargo = env_var("CARGO"); |
37 |
| - let mut cmd = cmd(cargo); |
38 |
| - cmd.args(&[ |
39 |
| - "build", |
40 |
| - "--manifest-path", |
41 |
| - manifest_path.to_str().unwrap(), |
42 |
| - "-Zbuild-std=core", |
43 |
| - "--target", |
44 |
| - &target, |
45 |
| - ]) |
46 |
| - .env("PATH", path) |
47 |
| - .env("RUSTC", rustc) |
48 |
| - .env("RUSTFLAGS", "-Copt-level=0 -Cdebug-assertions=yes") |
49 |
| - .env("CARGO_TARGET_DIR", &target_dir) |
50 |
| - .env("RUSTC_BOOTSTRAP", "1") |
51 |
| - // Visual Studio 2022 requires that the LIB env var be set so it can |
52 |
| - // find the Windows SDK. |
53 |
| - .env("LIB", std::env::var("LIB").unwrap_or_default()); |
54 |
| - |
55 |
| - cmd.run(); |
56 |
| - |
57 |
| - let rlibs_path = target_dir.join(target).join("debug").join("deps"); |
| 26 | + let target_dir = path("target"); |
| 27 | + |
| 28 | + println!("Testing compiler_builtins for {}", target()); |
| 29 | + |
| 30 | + cargo() |
| 31 | + .args(&[ |
| 32 | + "build", |
| 33 | + "--manifest-path", |
| 34 | + "Cargo.toml", |
| 35 | + "-Zbuild-std=core", |
| 36 | + "--target", |
| 37 | + &target(), |
| 38 | + ]) |
| 39 | + .env("PATH", env_var("PATH")) |
| 40 | + .env("RUSTC", env_var("RUSTC")) |
| 41 | + .env("RUSTFLAGS", "-Copt-level=0 -Cdebug-assertions=yes") |
| 42 | + .env("CARGO_TARGET_DIR", &target_dir) |
| 43 | + .env("RUSTC_BOOTSTRAP", "1") |
| 44 | + // Visual Studio 2022 requires that the LIB env var be set so it can |
| 45 | + // find the Windows SDK. |
| 46 | + .env("LIB", std::env::var("LIB").unwrap_or_default()) |
| 47 | + .run(); |
| 48 | + |
| 49 | + let rlibs_path = target_dir.join(target()).join("debug").join("deps"); |
58 | 50 | let compiler_builtins_rlib = read_dir(rlibs_path)
|
59 | 51 | .find_map(|e| {
|
60 | 52 | let path = e.unwrap().path();
|
|
0 commit comments