Skip to content
Snippets Groups Projects
Commit 79369d73 authored by Georgy Moshkin's avatar Georgy Moshkin :speech_balloon:
Browse files

test: picodata test --nocapture & PICODATA_TEST_* variables

parent 95f6fe7a
No related branches found
No related tags found
1 merge request!256test: picodata test --nocapture & PICODATA_TEST_* variables
Pipeline #12186 failed
...@@ -229,9 +229,13 @@ impl Expel { ...@@ -229,9 +229,13 @@ impl Expel {
#[derive(Debug, Parser, tlua::Push)] #[derive(Debug, Parser, tlua::Push)]
#[clap(about = "Run picodata integration tests")] #[clap(about = "Run picodata integration tests")]
pub struct Test { pub struct Test {
#[clap()] #[clap(env = "PICODATA_TEST_FILTER")]
/// Only run tests matching the filter. /// Only run tests matching the filter.
pub filter: Option<String>, pub filter: Option<String>,
#[clap(long = "nocapture", env = "PICODATA_TEST_NOCAPTURE")]
/// Do not capture test output.
pub nocapture: bool,
} }
impl Test { impl Test {
......
...@@ -942,8 +942,10 @@ fn main_test(args: args::Test) -> ! { ...@@ -942,8 +942,10 @@ fn main_test(args: args::Test) -> ! {
ForkResult::Child => { ForkResult::Child => {
drop(rx); drop(rx);
unistd::close(0).ok(); // stdin unistd::close(0).ok(); // stdin
unistd::dup2(*tx, 1).ok(); // stdout if !args.nocapture {
unistd::dup2(*tx, 2).ok(); // stderr unistd::dup2(*tx, 1).ok(); // stdout
unistd::dup2(*tx, 2).ok(); // stderr
}
drop(tx); drop(tx);
let rc = tarantool_main!( let rc = tarantool_main!(
...@@ -959,9 +961,11 @@ fn main_test(args: args::Test) -> ! { ...@@ -959,9 +961,11 @@ fn main_test(args: args::Test) -> ! {
let log = { let log = {
let mut buf = Vec::new(); let mut buf = Vec::new();
use std::io::Read; use std::io::Read;
rx.read_to_end(&mut buf) if !args.nocapture {
.map_err(|e| println!("error reading ipc pipe: {e}")) rx.read_to_end(&mut buf)
.ok(); .map_err(|e| println!("error reading ipc pipe: {e}"))
.ok();
}
buf buf
}; };
...@@ -981,6 +985,10 @@ fn main_test(args: args::Test) -> ! { ...@@ -981,6 +985,10 @@ fn main_test(args: args::Test) -> ! {
println!("{FAILED}"); println!("{FAILED}");
cnt_failed += 1; cnt_failed += 1;
if args.nocapture {
continue;
}
use std::io::Write; use std::io::Write;
println!(); println!();
std::io::stderr() std::io::stderr()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment