Log full output on match failure

This commit is contained in:
Brendan Hansknecht 2020-10-26 18:00:33 -07:00
parent 78b13ae59d
commit b4df0b0ba8
2 changed files with 9 additions and 9 deletions

View file

@ -26,8 +26,8 @@ mod cli_run {
let ending = "Hello, World!!!!!!!!!!!!!\n"; let ending = "Hello, World!!!!!!!!!!!!!\n";
if !&valgrind_out.stdout.ends_with(ending) { if !&valgrind_out.stdout.ends_with(ending) {
panic!( panic!(
"expected output to end with {:?} but instead got {:?}", "expected output to end with {:?} but instead got {:#?}",
ending, &valgrind_out.stdout ending, valgrind_out
); );
} }
let memory_errors = extract_valgrind_errors(&raw_xml); let memory_errors = extract_valgrind_errors(&raw_xml);
@ -67,8 +67,8 @@ mod cli_run {
let ending = "[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2]\n"; let ending = "[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2]\n";
if !&valgrind_out.stdout.ends_with(ending) { if !&valgrind_out.stdout.ends_with(ending) {
panic!( panic!(
"expected output to end with {:?} but instead got {:?}", "expected output to end with {:?} but instead got {:#?}",
ending, &valgrind_out.stdout ending, valgrind_out
); );
} }
let memory_errors = extract_valgrind_errors(&raw_xml); let memory_errors = extract_valgrind_errors(&raw_xml);
@ -82,7 +82,7 @@ mod cli_run {
#[serial(quicksort)] #[serial(quicksort)]
// TODO: Stop ignoring this test once we are correctly freeing the RocList even when in dev build. // TODO: Stop ignoring this test once we are correctly freeing the RocList even when in dev build.
#[ignore] #[ignore]
fn run_quicksort_valgrind() { fn run_quicksort() {
check_quicksort_output(run_roc(&[ check_quicksort_output(run_roc(&[
"build", "build",
example_file("quicksort", "Quicksort.roc").to_str().unwrap(), example_file("quicksort", "Quicksort.roc").to_str().unwrap(),
@ -91,7 +91,7 @@ mod cli_run {
#[test] #[test]
#[serial(quicksort)] #[serial(quicksort)]
fn run_quicksort_valgrind_optimized() { fn run_quicksort_optimized() {
check_quicksort_output(run_roc(&[ check_quicksort_output(run_roc(&[
"build", "build",
"--optimize", "--optimize",
@ -107,12 +107,11 @@ mod cli_run {
let (valgrind_out, raw_xml) = let (valgrind_out, raw_xml) =
run_with_valgrind(&[example_file("multi-module", "app").to_str().unwrap()]); run_with_valgrind(&[example_file("multi-module", "app").to_str().unwrap()]);
// let valgrind_out = run_cmd(example_file("multi-module", "app").to_str().unwrap(), &[]);
let ending = "[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2]\n"; let ending = "[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2]\n";
if !&valgrind_out.stdout.ends_with(ending) { if !&valgrind_out.stdout.ends_with(ending) {
panic!( panic!(
"expected output to end with {:?} but instead got {:?}", "expected output to end with {:?} but instead got {:#?}",
ending, &valgrind_out.stdout ending, valgrind_out
); );
} }
let memory_errors = extract_valgrind_errors(&raw_xml); let memory_errors = extract_valgrind_errors(&raw_xml);

View file

@ -15,6 +15,7 @@ use std::path::PathBuf;
use std::process::{Command, ExitStatus, Stdio}; use std::process::{Command, ExitStatus, Stdio};
use tempfile::NamedTempFile; use tempfile::NamedTempFile;
#[derive(Debug)]
pub struct Out { pub struct Out {
pub stdout: String, pub stdout: String,
pub stderr: String, pub stderr: String,