Skip to content

Commit

Permalink
fix: return code should be non-zero if test case failed (#33)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Chi <[email protected]>
  • Loading branch information
skyzh authored Mar 29, 2022
1 parent a485002 commit b9a0cbe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sqllogictest"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
description = "Sqllogictest parser and runner."
license = "MIT OR Apache-2.0"
Expand Down
12 changes: 11 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,25 @@ async fn main() -> Result<()> {
engine_name: opt.engine,
};

let mut has_failed = false;

let mut failed_case = vec![];

for file in files {
let file = file?;
if let Err(e) = run_test_file(pg.clone(), &file).await {
println!("{}\n\n{:?}", style("[FAILED]").red().bold(), e);
println!();
has_failed = true;
failed_case.push(file.to_string_lossy().to_string());
}
}

Ok(())
if has_failed {
Err(anyhow!("some test case failed:\n{:#?}", failed_case))
} else {
Ok(())
}
}

async fn flush_stdout() -> std::io::Result<()> {
Expand Down

0 comments on commit b9a0cbe

Please sign in to comment.