Skip to content

Commit d04ffb0

Browse files
Update lang_tests_common.rs test
1 parent 65f4b63 commit d04ffb0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/lang_tests_common.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ pub fn main_inner(profile: Profile) {
2121
let tempdir = TempDir::new().expect("temp dir");
2222
let current_dir = current_dir().expect("current dir");
2323
let current_dir = current_dir.to_str().expect("current dir").to_string();
24-
let gcc_path = Toml::parse(include_str!("../config.toml"))
25-
.expect("Failed to parse `config.toml`")
26-
.get_string("gcc-path")
27-
.expect("Missing `gcc-path` key in `config.toml`")
28-
.to_string();
24+
let toml = Toml::parse(include_str!("../config.toml"))
25+
.expect("Failed to parse `config.toml`");
26+
let gcc_path = if let Ok(gcc_path) = toml.get_string("gcc-path") {
27+
PathBuf::from(gcc_path.to_string())
28+
} else {
29+
// then we try to retrieve it from the `target` folder.
30+
let commit = include_str!("../libgccjit.version").trim();
31+
Path::new("target/libgccjit").join(commit)
32+
};
33+
2934
let gcc_path = Path::new(&gcc_path)
3035
.canonicalize()
3136
.expect("failed to get absolute path of `gcc-path`")

0 commit comments

Comments
 (0)