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 {
#[derive(Debug, Parser, tlua::Push)]
#[clap(about = "Run picodata integration tests")]
pub struct Test {
#[clap()]
#[clap(env = "PICODATA_TEST_FILTER")]
/// Only run tests matching the filter.
pub filter: Option<String>,
#[clap(long = "nocapture", env = "PICODATA_TEST_NOCAPTURE")]
/// Do not capture test output.
pub nocapture: bool,
}
impl Test {
......
......@@ -942,8 +942,10 @@ fn main_test(args: args::Test) -> ! {
ForkResult::Child => {
drop(rx);
unistd::close(0).ok(); // stdin
unistd::dup2(*tx, 1).ok(); // stdout
unistd::dup2(*tx, 2).ok(); // stderr
if !args.nocapture {
unistd::dup2(*tx, 1).ok(); // stdout
unistd::dup2(*tx, 2).ok(); // stderr
}
drop(tx);
let rc = tarantool_main!(
......@@ -959,9 +961,11 @@ fn main_test(args: args::Test) -> ! {
let log = {
let mut buf = Vec::new();
use std::io::Read;
rx.read_to_end(&mut buf)
.map_err(|e| println!("error reading ipc pipe: {e}"))
.ok();
if !args.nocapture {
rx.read_to_end(&mut buf)
.map_err(|e| println!("error reading ipc pipe: {e}"))
.ok();
}
buf
};
......@@ -981,6 +985,10 @@ fn main_test(args: args::Test) -> ! {
println!("{FAILED}");
cnt_failed += 1;
if args.nocapture {
continue;
}
use std::io::Write;
println!();
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