You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by ji...@apache.org on 2023/12/11 22:04:11 UTC

(daffodil) branch main updated: Return FAIL if tests are not found

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

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


The following commit(s) were added to refs/heads/main by this push:
     new c58434c0b Return FAIL if tests are not found
c58434c0b is described below

commit c58434c0b6b7017861ec8f385e8a5f98496423d7
Author: 200019465 <ka...@ge.com>
AuthorDate: Mon Dec 11 15:48:07 2023 -0500

    Return FAIL if tests are not found
    
    Include specified test names in test list even if not found in
    test file in order to print names of tests not found. Return
    FAIL if any tests fail or are not found.
    
    DAFFODIL-2699
    
    Main.scala: Include all test names for listing even if not
    found, update return code logic to check for any tests
    failing or not found.
    
    TestCLItdml.scala: Update expected exit codes based on new
    return code logic, note that test_CLI_Tdml_Listing_negativeTest01
    now returns FAIL due to tests not found.
---
 daffodil-cli/src/main/scala/org/apache/daffodil/cli/Main.scala     | 7 +++++--
 .../test/scala/org/apache/daffodil/cli/cliTest/TestCLItdml.scala   | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/daffodil-cli/src/main/scala/org/apache/daffodil/cli/Main.scala b/daffodil-cli/src/main/scala/org/apache/daffodil/cli/Main.scala
index b30db8871..3e9477b3a 100644
--- a/daffodil-cli/src/main/scala/org/apache/daffodil/cli/Main.scala
+++ b/daffodil-cli/src/main/scala/org/apache/daffodil/cli/Main.scala
@@ -1609,7 +1609,10 @@ class Main(
                   val matches = tdmlRunner.testCases.filter(testCase =>
                     regex.pattern.matcher(testCase.tcName).matches,
                   )
-                  matches.map(testCase => (testCase.tcName, Some(testCase)))
+                  matches match {
+                    case m if !m.isEmpty => m.map(testCase => (testCase.tcName, Some(testCase)))
+                    case _ => Seq((testName, None))
+                  }
                 } else {
                   List((testName, tdmlRunner.testCases.find(_.tcName == testName)))
                 }
@@ -1729,7 +1732,7 @@ class Main(
             ),
           )
 
-          if (fail == 0) ExitCode.Success else ExitCode.TestError
+          if (fail == 0 && notfound == 0) ExitCode.Success else ExitCode.TestError
         }
       }
 
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLItdml.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLItdml.scala
index 649677ff9..5d99d9a63 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLItdml.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLItdml.scala
@@ -32,7 +32,7 @@ class TestCLItdml {
     runCLI(args"test $tdml escape_entry1 escape_entry2-11 escape_entry1-5 escape_entry4_3") {
       cli =>
         cli.expect("Total: 4, Pass: 2, Fail: 0, Not Found: 2")
-    }(ExitCode.Success)
+    }(ExitCode.TestError)
   }
 
   @Test def test_CLI_Tdml_Listing_execRegex01(): Unit = {