This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 7b2284c8a0 Allow using `cargo nextest` for running tests (#13045)
7b2284c8a0 is described below

commit 7b2284c8a0b49234e9607bfef10d73ef788d9458
Author: Andrew Lamb <[email protected]>
AuthorDate: Fri Oct 25 17:27:23 2024 -0400

    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]>
---
 datafusion/sqllogictest/bin/sqllogictests.rs | 29 ++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/datafusion/sqllogictest/bin/sqllogictests.rs 
b/datafusion/sqllogictest/bin/sqllogictests.rs
index baa49057e1..501fd3517a 100644
--- a/datafusion/sqllogictest/bin/sqllogictests.rs
+++ b/datafusion/sqllogictest/bin/sqllogictests.rs
@@ -62,6 +62,15 @@ async fn run_tests() -> Result<()> {
     env_logger::init();
 
     let options: Options = clap::Parser::parse();
+    if options.list {
+        // nextest parses stdout, so print messages to stderr
+        eprintln!("NOTICE: --list option unsupported, quitting");
+        // return Ok, not error so that tools like nextest which are listing 
all
+        // workspace tests (by running `cargo test ... --list --format terse`)
+        // do not fail when they encounter this binary. Instead, print nothing
+        // to stdout and return OK so they can continue listing other tests.
+        return Ok(());
+    }
     options.warn_on_ignored();
 
     // 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<()> {
 
 /// Parsed command line options
 ///
-/// This structure attempts to mimic the command line options
+/// This structure attempts to mimic the command line options of the built in 
rust test runner
 /// accepted by IDEs such as CLion that pass arguments
 ///
 /// See <https://github.com/apache/datafusion/issues/8287> for more details
@@ -320,6 +329,18 @@ struct Options {
         help = "IGNORED (for compatibility with built in rust test runner)"
     )]
     show_output: bool,
+
+    #[clap(
+        long,
+        help = "Quits immediately, not listing anything (for compatibility 
with built-in rust test runner)"
+    )]
+    list: bool,
+
+    #[clap(
+        long,
+        help = "IGNORED (for compatibility with built-in rust test runner)"
+    )]
+    ignored: bool,
 }
 
 impl Options {
@@ -354,15 +375,15 @@ impl Options {
     /// Logs warning messages to stdout if any ignored options are passed
     fn warn_on_ignored(&self) {
         if self.format.is_some() {
-            println!("WARNING: Ignoring `--format` compatibility option");
+            eprintln!("WARNING: Ignoring `--format` compatibility option");
         }
 
         if self.z_options.is_some() {
-            println!("WARNING: Ignoring `-Z` compatibility option");
+            eprintln!("WARNING: Ignoring `-Z` compatibility option");
         }
 
         if self.show_output {
-            println!("WARNING: Ignoring `--show-output` compatibility option");
+            eprintln!("WARNING: Ignoring `--show-output` compatibility 
option");
         }
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to