Skip to content

Commit 5a8e903

Browse files
Update tests to use config.toml instead
1 parent ff263d0 commit 5a8e903

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

Cargo.lock

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ tempfile = "3.7.1"
3737
[dev-dependencies]
3838
lang_tester = "0.3.9"
3939
tempfile = "3.1.0"
40+
boml = "0.3.1"
4041

4142
[profile.dev]
4243
# By compiling dependencies with optimizations, performing tests gets much faster.

tests/lang_tests_common.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::{
77

88
use lang_tester::LangTester;
99
use tempfile::TempDir;
10+
use boml::Toml;
1011

1112
/// Controls the compile options (e.g., optimization level) used to compile
1213
/// test code.
@@ -20,8 +21,16 @@ pub fn main_inner(profile: Profile) {
2021
let tempdir = TempDir::new().expect("temp dir");
2122
let current_dir = current_dir().expect("current dir");
2223
let current_dir = current_dir.to_str().expect("current dir").to_string();
23-
let gcc_path = include_str!("../gcc_path");
24-
let gcc_path = gcc_path.trim();
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();
29+
let gcc_path = Path::new(&gcc_path)
30+
.canonicalize()
31+
.expect("failed to get absolute path of `gcc-path`")
32+
.display()
33+
.to_string();
2534
env::set_var("LD_LIBRARY_PATH", gcc_path);
2635

2736
fn rust_filter(filename: &Path) -> bool {

0 commit comments

Comments
 (0)