Skip to content

Commit 7b2284c

Browse files
alambfindepi
andauthored
Allow using cargo nextest for running tests (#13045)
* Allow using `cargo nextest` for running tests * Update datafusion/sqllogictest/bin/sqllogictests.rs Co-authored-by: Piotr Findeisen <[email protected]> * Clarify rationale for returning OK * Apply suggestions from code review Co-authored-by: Piotr Findeisen <[email protected]> --------- Co-authored-by: Piotr Findeisen <[email protected]>
1 parent 21cfd6c commit 7b2284c

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

datafusion/sqllogictest/bin/sqllogictests.rs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ async fn run_tests() -> Result<()> {
6262
env_logger::init();
6363

6464
let options: Options = clap::Parser::parse();
65+
if options.list {
66+
// nextest parses stdout, so print messages to stderr
67+
eprintln!("NOTICE: --list option unsupported, quitting");
68+
// return Ok, not error so that tools like nextest which are listing all
69+
// workspace tests (by running `cargo test ... --list --format terse`)
70+
// do not fail when they encounter this binary. Instead, print nothing
71+
// to stdout and return OK so they can continue listing other tests.
72+
return Ok(());
73+
}
6574
options.warn_on_ignored();
6675

6776
// Run all tests in parallel, reporting failures at the end
@@ -276,7 +285,7 @@ fn read_dir_recursive_impl(dst: &mut Vec<PathBuf>, path: &Path) -> Result<()> {
276285

277286
/// Parsed command line options
278287
///
279-
/// This structure attempts to mimic the command line options
288+
/// This structure attempts to mimic the command line options of the built in rust test runner
280289
/// accepted by IDEs such as CLion that pass arguments
281290
///
282291
/// See <https://github.com/apache/datafusion/issues/8287> for more details
@@ -320,6 +329,18 @@ struct Options {
320329
help = "IGNORED (for compatibility with built in rust test runner)"
321330
)]
322331
show_output: bool,
332+
333+
#[clap(
334+
long,
335+
help = "Quits immediately, not listing anything (for compatibility with built-in rust test runner)"
336+
)]
337+
list: bool,
338+
339+
#[clap(
340+
long,
341+
help = "IGNORED (for compatibility with built-in rust test runner)"
342+
)]
343+
ignored: bool,
323344
}
324345

325346
impl Options {
@@ -354,15 +375,15 @@ impl Options {
354375
/// Logs warning messages to stdout if any ignored options are passed
355376
fn warn_on_ignored(&self) {
356377
if self.format.is_some() {
357-
println!("WARNING: Ignoring `--format` compatibility option");
378+
eprintln!("WARNING: Ignoring `--format` compatibility option");
358379
}
359380

360381
if self.z_options.is_some() {
361-
println!("WARNING: Ignoring `-Z` compatibility option");
382+
eprintln!("WARNING: Ignoring `-Z` compatibility option");
362383
}
363384

364385
if self.show_output {
365-
println!("WARNING: Ignoring `--show-output` compatibility option");
386+
eprintln!("WARNING: Ignoring `--show-output` compatibility option");
366387
}
367388
}
368389
}

0 commit comments

Comments
 (0)