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

espino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry-devops-release.git


The following commit(s) were added to refs/heads/main by this push:
     new 5249d69  Enhance test result parsing for ignored tests (#7)
5249d69 is described below

commit 5249d69825ec34c2363aa3de3391ddc790786ffe
Author: Ed Espino <[email protected]>
AuthorDate: Wed Nov 27 02:09:46 2024 -0800

    Enhance test result parsing for ignored tests (#7)
    
    * Enhance test result parsing for ignored tests
    
    - Updated parse-results.pl:
      - Added support for ignored test cases.
      - Validated ignored test count matches found test names.
      - Refactored logging to include ignored test details.
    
    - Updated parse-test-results.sh:
      - Integrated support for ignored test counts and names.
      - Exported ignored test details to GitHub Actions output.
      - Improved logging for debugging purposes.
    
    - Enable debugging configuration support
    
    These changes ensure ignored test cases are correctly handled and
    reported while maintaining compatibility with existing workflows.
    
    * During parsing - Remove extraneous debug output.
---
 .../cloudberry/scripts/configure-cloudberry.sh     |  2 +
 .../cloudberry/scripts/parse-results.pl            | 88 ++++++++++++++++------
 .../cloudberry/scripts/parse-test-results.sh       | 20 +----
 3 files changed, 70 insertions(+), 40 deletions(-)

diff --git a/build_automation/cloudberry/scripts/configure-cloudberry.sh 
b/build_automation/cloudberry/scripts/configure-cloudberry.sh
index 8e5e6a5..95076d5 100755
--- a/build_automation/cloudberry/scripts/configure-cloudberry.sh
+++ b/build_automation/cloudberry/scripts/configure-cloudberry.sh
@@ -110,6 +110,8 @@ log_section_end "Environment Setup"
 log_section "Configure"
 execute_cmd ./configure --prefix=/usr/local/cloudberry-db \
             --disable-external-fts \
+            --enable-cassert \
+            --enable-debug-extensions \
             --enable-gpcloud \
             --enable-ic-proxy \
             --enable-mapreduce \
diff --git a/build_automation/cloudberry/scripts/parse-results.pl 
b/build_automation/cloudberry/scripts/parse-results.pl
index ed45e8b..d09085d 100755
--- a/build_automation/cloudberry/scripts/parse-results.pl
+++ b/build_automation/cloudberry/scripts/parse-results.pl
@@ -25,19 +25,24 @@
 #             Analyzes test log files to determine:
 #             1. Overall test status (pass/fail)
 #             2. Total number of tests run
-#             3. Number of passed and failed tests
-#             4. Names of failed tests
+#             3. Number of passed, failed, and ignored tests
+#             4. Names of failed and ignored tests
+#             5. Validates test counts for consistency
 #             Results are written to a file for shell script processing.
 #
 # Arguments:
 #   log-file    Path to test log file (required)
 #
 # Input File Format:
-#   Expects test log files containing either:
+#   Expects test log files containing one of the following summary formats:
 #   - "All X tests passed."
 #   - "Y of X tests failed."
-#   And failed test entries in format:
+#   - "X of Y tests passed, Z failed test(s) ignored."
+#   - "X of Y tests failed, Z of these failures ignored."
+#
+#   And failed or ignored test entries in format:
 #   - "test_name ... FAILED"
+#   - "test_name ... failed (ignored)"
 #
 # Output File (test_results.txt):
 #   Environment variable format:
@@ -45,7 +50,9 @@
 #   TOTAL_TESTS=<number>
 #   FAILED_TESTS=<number>
 #   PASSED_TESTS=<number>
+#   IGNORED_TESTS=<number>
 #   FAILED_TEST_NAMES=<comma-separated-list>
+#   IGNORED_TEST_NAMES=<comma-separated-list>
 #
 # Prerequisites:
 #   - Read access to input log file
@@ -53,8 +60,8 @@
 #   - Perl 5.x or higher
 #
 # Exit Codes:
-#   0 - All tests passed
-#   1 - Some tests failed (expected failure)
+#   0 - All tests passed, or only ignored failures occurred
+#   1 - Some non-ignored tests failed
 #   2 - Parse error or cannot access files
 #
 # Example Usage:
@@ -62,7 +69,7 @@
 #
 # Error Handling:
 #   - Validates input file existence and readability
-#   - Verifies failed test count matches found failures
+#   - Verifies failed and ignored test counts match found entries
 #   - Reports parsing errors with detailed messages
 #
 # --------------------------------------------------------------------
@@ -97,36 +104,52 @@ open(my $fh, '<', $file) or do {
     exit PARSE_ERROR;
 };
 
-my ($status, $total_tests, $failed_tests, $passed_tests);
+# Initialize variables
+my ($status, $total_tests, $failed_tests, $ignored_tests, $passed_tests) = 
('', 0, 0, 0, 0);
 my @failed_test_list = ();
+my @ignored_test_list = ();
 
 while (<$fh>) {
     # Match the summary lines
     if (/All (\d+) tests passed\./) {
         $status = 'passed';
         $total_tests = $1;
-        $failed_tests = 0;
         $passed_tests = $1;
     }
+    elsif (/(\d+) of (\d+) tests passed, (\d+) failed test\(s\) ignored\./) {
+        $status = 'passed';
+        $passed_tests = $1;
+        $total_tests = $2;
+        $ignored_tests = $3;
+    }
     elsif (/(\d+) of (\d+) tests failed\./) {
         $status = 'failed';
         $failed_tests = $1;
         $total_tests = $2;
         $passed_tests = $2 - $1;
     }
+    elsif (/(\d+) of (\d+) tests failed, (\d+) of these failures ignored\./) {
+        $status = 'failed';
+        $failed_tests = $1 - $3;
+        $ignored_tests = $3;
+        $total_tests = $2;
+        $passed_tests = $2 - $1;
+    }
 
     # Capture failed tests
     if (/^(?:\s+|test\s+)(\S+)\s+\.\.\.\s+FAILED\s+/) {
         push @failed_test_list, $1;
     }
-}
-close($fh);
 
-unless (defined $status) {
-    print "Error: Could not find test summary in $file\n";
-    exit PARSE_ERROR;
+    # Capture ignored tests
+    if (/^(?:\s+|test\s+)(\S+)\s+\.\.\.\s+failed \(ignored\)/) {
+        push @ignored_test_list, $1;
+    }
 }
 
+# Close the log file
+close $fh;
+
 # Validate failed test count matches found test names
 if ($status eq 'failed' && scalar(@failed_test_list) != $failed_tests) {
     print "Error: Found $failed_tests failed tests in summary but found " . 
scalar(@failed_test_list) . " failed test names\n";
@@ -137,26 +160,37 @@ if ($status eq 'failed' && scalar(@failed_test_list) != 
$failed_tests) {
     exit PARSE_ERROR;
 }
 
-# Write results to file
-open(my $out, '>', 'test_results.txt') or do {
-    print "Cannot write results: $!\n";
+# Validate ignored test count matches found test names
+if ($ignored_tests != scalar(@ignored_test_list)) {
+    print "Error: Found $ignored_tests ignored tests in summary but found " . 
scalar(@ignored_test_list) . " ignored test names\n";
+    print "Ignored test names found:\n";
+    foreach my $test (@ignored_test_list) {
+        print "  - $test\n";
+    }
     exit PARSE_ERROR;
-};
+}
 
-print $out "STATUS=$status\n";
-print $out "TOTAL_TESTS=$total_tests\n";
-print $out "FAILED_TESTS=$failed_tests\n";
-print $out "PASSED_TESTS=$passed_tests\n";
+# Write results to the results file
+open my $result_fh, '>', 'test_results.txt' or die "Cannot write to results 
file: $!\n";
+print $result_fh "STATUS=$status\n";
+print $result_fh "TOTAL_TESTS=$total_tests\n";
+print $result_fh "PASSED_TESTS=$passed_tests\n";
+print $result_fh "FAILED_TESTS=$failed_tests\n";
+print $result_fh "IGNORED_TESTS=$ignored_tests\n";
 if (@failed_test_list) {
-    print $out "FAILED_TEST_NAMES=" . join(",", @failed_test_list) . "\n";
+    print $result_fh "FAILED_TEST_NAMES=" . join(',', @failed_test_list) . 
"\n";
+}
+if (@ignored_test_list) {
+    print $result_fh "IGNORED_TEST_NAMES=" . join(',', @ignored_test_list) . 
"\n";
 }
-close($out);
+close $result_fh;
 
 # Print to stdout for logging
 print "Test Results:\n";
 print "Status: $status\n";
 print "Total Tests: $total_tests\n";
 print "Failed Tests: $failed_tests\n";
+print "Ignored Tests: $ignored_tests\n";
 print "Passed Tests: $passed_tests\n";
 if (@failed_test_list) {
     print "Failed Test Names:\n";
@@ -164,6 +198,12 @@ if (@failed_test_list) {
         print "  - $test\n";
     }
 }
+if (@ignored_test_list) {
+    print "Ignored Test Names:\n";
+    foreach my $test (@ignored_test_list) {
+        print "  - $test\n";
+    }
+}
 
 # Exit with appropriate code
 if ($status eq 'passed') {
diff --git a/build_automation/cloudberry/scripts/parse-test-results.sh 
b/build_automation/cloudberry/scripts/parse-test-results.sh
index 28ac9b9..cf63eb3 100755
--- a/build_automation/cloudberry/scripts/parse-test-results.sh
+++ b/build_automation/cloudberry/scripts/parse-test-results.sh
@@ -30,13 +30,6 @@
 #             3. Environment variable management
 #             4. Result file cleanup
 #
-# Required Environment Variables:
-#   None
-#
-# Optional Environment Variables:
-#   GITHUB_OUTPUT - GitHub Actions output file path
-#   MAKE_NAME    - Used in default log path construction
-#
 # Arguments:
 #   [log-file] - Path to test log file
 #                (defaults to build-logs/details/make-${MAKE_NAME}.log)
@@ -52,7 +45,9 @@
 #   total_tests      - Total number of tests
 #   failed_tests     - Number of failed tests
 #   passed_tests     - Number of passed tests
+#   ignored_tests    - Number of ignored tests
 #   failed_test_names - Names of failed tests (comma-separated)
+#   ignored_test_names - Names of ignored tests (comma-separated)
 #
 # Usage Examples:
 #   # Parse default log file:
@@ -103,15 +98,6 @@ fi
 
 source test_results.txt
 
-echo "Results loaded into environment variables:"
-echo "STATUS=$STATUS"
-echo "TOTAL_TESTS=$TOTAL_TESTS"
-echo "FAILED_TESTS=$FAILED_TESTS"
-echo "PASSED_TESTS=$PASSED_TESTS"
-if [ -n "${FAILED_TEST_NAMES:-}" ]; then
-    echo "FAILED_TEST_NAMES=$FAILED_TEST_NAMES"
-fi
-
 # If in GitHub Actions, set outputs
 if [ -n "${GITHUB_OUTPUT:-}" ]; then
     {
@@ -119,7 +105,9 @@ if [ -n "${GITHUB_OUTPUT:-}" ]; then
         echo "total_tests=$TOTAL_TESTS"
         echo "failed_tests=$FAILED_TESTS"
         echo "passed_tests=$PASSED_TESTS"
+        echo "ignored_tests=$IGNORED_TESTS"
         [ -n "${FAILED_TEST_NAMES:-}" ] && echo 
"failed_test_names=$FAILED_TEST_NAMES"
+        [ -n "${IGNORED_TEST_NAMES:-}" ] && echo 
"ignored_test_names=$IGNORED_TEST_NAMES"
     } >> "$GITHUB_OUTPUT"
 fi
 


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

Reply via email to