diff options
author | Nadrieril Feneanar | 2020-03-20 19:04:17 +0000 |
---|---|---|
committer | GitHub | 2020-03-20 19:04:17 +0000 |
commit | c944a61c17cffde8620c46c70fceb36462b082ca (patch) | |
tree | 4722f8c1b934e0398e4676d2e396dbac93e816d0 /dhall | |
parent | 6f06ff5e6168f4a55b4dcc1175f89b1d67c98ab1 (diff) | |
parent | 48bc731fe8eb7d4ecfad5e8f834754c3a91e4359 (diff) |
Merge pull request #153 from Nadrieril/grcov
Use grcov for coverage
Diffstat (limited to 'dhall')
-rw-r--r-- | dhall/build.rs | 4 | ||||
-rw-r--r-- | dhall/src/tests.rs | 24 |
2 files changed, 19 insertions, 9 deletions
diff --git a/dhall/build.rs b/dhall/build.rs index fb3f9ee..19abcc4 100644 --- a/dhall/build.rs +++ b/dhall/build.rs @@ -333,7 +333,7 @@ fn generate_tests() -> std::io::Result<()> { || path == "unit/MergeHandlerFreeVar" }), output_type: Some(FileType::UI), - ..default_feature.clone() + ..default_feature }, ]; @@ -450,7 +450,7 @@ fn convert_abnf_to_pest() -> std::io::Result<()> { Ok(()) } -// Generate pest parser manually becaue otherwise we'd need to modify something outside of +// Generate pest parser manually because otherwise we'd need to modify something outside of // OUT_DIR and that's forbidden by docs.rs. fn generate_pest_parser() -> std::io::Result<()> { let out_dir = env::var("OUT_DIR").unwrap(); diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs index d305b98..a5a278c 100644 --- a/dhall/src/tests.rs +++ b/dhall/src/tests.rs @@ -235,9 +235,22 @@ impl TestFile { } #[allow(dead_code)] -fn run_test_stringy_error(test: Test) -> std::result::Result<(), String> { - run_test(test).map_err(|e| e.to_string())?; - Ok(()) +fn run_test_or_panic(test: Test) { + let res = if env::var("CI_GRCOV").is_ok() { + // Augment stack size when running with 0 inlining to avoid overflows + std::thread::Builder::new() + .stack_size(128 * 1024 * 1024) + .spawn(|| run_test(test)) + .unwrap() + .join() + .unwrap() + } else { + run_test(test) + }; + match res { + Ok(_) => {} + Err(e) => panic!(e.to_string()), + } } fn run_test(test: Test) -> Result<()> { @@ -322,10 +335,7 @@ mod spec { fn $name() { use crate::tests::Test::*; use crate::tests::*; - match run_test_stringy_error($type) { - Ok(_) => {} - Err(s) => panic!(s), - } + run_test_or_panic($type); } }; } |