diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-02-12 22:52:57 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-02-13 15:43:42 +0100 |
| commit | d04ffb0ffc10bbf2623f32fc6840ed3a7614ff33 (patch) | |
| tree | 4ba8055a235a6ef35ec21c51d4def1d2db30ad12 | |
| parent | 65f4b6354d8899e9292f8666d2804a0306b0770e (diff) | |
| download | rust-d04ffb0ffc10bbf2623f32fc6840ed3a7614ff33.tar.gz rust-d04ffb0ffc10bbf2623f32fc6840ed3a7614ff33.zip | |
Update lang_tests_common.rs test
| -rw-r--r-- | tests/lang_tests_common.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/lang_tests_common.rs b/tests/lang_tests_common.rs index 029a3b98ff2..33dc6ef62ae 100644 --- a/tests/lang_tests_common.rs +++ b/tests/lang_tests_common.rs @@ -21,11 +21,16 @@ 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 gcc_path = Toml::parse(include_str!("../config.toml")) - .expect("Failed to parse `config.toml`") - .get_string("gcc-path") - .expect("Missing `gcc-path` key in `config.toml`") - .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("target/libgccjit").join(commit) + }; + let gcc_path = Path::new(&gcc_path) .canonicalize() .expect("failed to get absolute path of `gcc-path`") |
