diff options
| author | Antoni Boucher <bouanto@zoho.com> | 2025-01-13 10:53:58 -0500 |
|---|---|---|
| committer | Antoni Boucher <bouanto@zoho.com> | 2025-01-13 10:53:58 -0500 |
| commit | 06f0a9bc785ad8654e1bf505f60ce7146b3850f3 (patch) | |
| tree | cedfc1ddcceaf4e0709e1a71fe36f8b4b6d9396e /compiler/rustc_codegen_gcc/tests/lang_tests_common.rs | |
| parent | 3ff1b6410e87a237559ab76ecd50f180afbe861f (diff) | |
| parent | 59a81c2ca1edc88ad3ac4b27a8e03977ffb8e73a (diff) | |
| download | rust-06f0a9bc785ad8654e1bf505f60ce7146b3850f3.tar.gz rust-06f0a9bc785ad8654e1bf505f60ce7146b3850f3.zip | |
Merge commit '59a81c2ca1edc88ad3ac4b27a8e03977ffb8e73a' into subtree-update_cg_gcc_2025_01_12
Diffstat (limited to 'compiler/rustc_codegen_gcc/tests/lang_tests_common.rs')
| -rw-r--r-- | compiler/rustc_codegen_gcc/tests/lang_tests_common.rs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/compiler/rustc_codegen_gcc/tests/lang_tests_common.rs b/compiler/rustc_codegen_gcc/tests/lang_tests_common.rs index aecea37ab5a..fafb7be55ce 100644 --- a/compiler/rustc_codegen_gcc/tests/lang_tests_common.rs +++ b/compiler/rustc_codegen_gcc/tests/lang_tests_common.rs @@ -22,14 +22,20 @@ pub fn main_inner(profile: Profile) { let tempdir = TempDir::new().expect("temp dir"); let current_dir = current_dir().expect("current dir"); let current_dir = current_dir.to_str().expect("current dir").to_string(); - let toml = Toml::parse(include_str!("../config.toml")).expect("Failed to parse `config.toml`"); - let gcc_path = if let Ok(gcc_path) = toml.get_string("gcc-path") { - PathBuf::from(gcc_path.to_string()) - } else { - // then we try to retrieve it from the `target` folder. - let commit = include_str!("../libgccjit.version").trim(); - Path::new("build/libgccjit").join(commit) - }; + + let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR")); + + let gcc_path = std::fs::read_to_string(manifest_dir.join("config.toml")) + .ok() + .and_then(|v| { + let toml = Toml::parse(&v).expect("Failed to parse `config.toml`"); + toml.get_string("gcc-path").map(PathBuf::from).ok() + }) + .unwrap_or_else(|| { + // then we try to retrieve it from the `target` folder. + let commit = include_str!("../libgccjit.version").trim(); + Path::new("build/libgccjit").join(commit) + }); let gcc_path = Path::new(&gcc_path) .canonicalize() @@ -83,6 +89,8 @@ pub fn main_inner(profile: Profile) { &format!("{}/build/build_sysroot/sysroot/", current_dir), "-C", "link-arg=-lc", + "--extern", + "mini_core=target/out/libmini_core.rlib", "-o", exe.to_str().expect("to_str"), path.to_str().expect("to_str"), |
