summaryrefslogtreecommitdiff
path: root/dhall/src
diff options
context:
space:
mode:
authorNadrieril2020-03-20 17:45:00 +0000
committerNadrieril2020-03-20 18:24:17 +0000
commit694ff62501e534b7f93a1813abc12f73ec695fd8 (patch)
treef6adc2f73c04995ccb497cad50c47e1407e96e8e /dhall/src
parent6f06ff5e6168f4a55b4dcc1175f89b1d67c98ab1 (diff)
Add coverage gathering with grcov
Diffstat (limited to '')
-rw-r--r--dhall/src/tests.rs24
1 files changed, 17 insertions, 7 deletions
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);
}
};
}