Skip to content
This repository was archived by the owner on Sep 12, 2025. It is now read-only.

Commit 5249d69

Browse files
authored
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.
1 parent f6fb429 commit 5249d69

File tree

3 files changed

+70
-40
lines changed

3 files changed

+70
-40
lines changed

build_automation/cloudberry/scripts/configure-cloudberry.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ log_section_end "Environment Setup"
110110
log_section "Configure"
111111
execute_cmd ./configure --prefix=/usr/local/cloudberry-db \
112112
--disable-external-fts \
113+
--enable-cassert \
114+
--enable-debug-extensions \
113115
--enable-gpcloud \
114116
--enable-ic-proxy \
115117
--enable-mapreduce \

build_automation/cloudberry/scripts/parse-results.pl

Lines changed: 64 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,44 +25,51 @@
2525
# Analyzes test log files to determine:
2626
# 1. Overall test status (pass/fail)
2727
# 2. Total number of tests run
28-
# 3. Number of passed and failed tests
29-
# 4. Names of failed tests
28+
# 3. Number of passed, failed, and ignored tests
29+
# 4. Names of failed and ignored tests
30+
# 5. Validates test counts for consistency
3031
# Results are written to a file for shell script processing.
3132
#
3233
# Arguments:
3334
# log-file Path to test log file (required)
3435
#
3536
# Input File Format:
36-
# Expects test log files containing either:
37+
# Expects test log files containing one of the following summary formats:
3738
# - "All X tests passed."
3839
# - "Y of X tests failed."
39-
# And failed test entries in format:
40+
# - "X of Y tests passed, Z failed test(s) ignored."
41+
# - "X of Y tests failed, Z of these failures ignored."
42+
#
43+
# And failed or ignored test entries in format:
4044
# - "test_name ... FAILED"
45+
# - "test_name ... failed (ignored)"
4146
#
4247
# Output File (test_results.txt):
4348
# Environment variable format:
4449
# STATUS=passed|failed
4550
# TOTAL_TESTS=<number>
4651
# FAILED_TESTS=<number>
4752
# PASSED_TESTS=<number>
53+
# IGNORED_TESTS=<number>
4854
# FAILED_TEST_NAMES=<comma-separated-list>
55+
# IGNORED_TEST_NAMES=<comma-separated-list>
4956
#
5057
# Prerequisites:
5158
# - Read access to input log file
5259
# - Write access to current directory
5360
# - Perl 5.x or higher
5461
#
5562
# Exit Codes:
56-
# 0 - All tests passed
57-
# 1 - Some tests failed (expected failure)
63+
# 0 - All tests passed, or only ignored failures occurred
64+
# 1 - Some non-ignored tests failed
5865
# 2 - Parse error or cannot access files
5966
#
6067
# Example Usage:
6168
# ./parse_results.pl test_output.log
6269
#
6370
# Error Handling:
6471
# - Validates input file existence and readability
65-
# - Verifies failed test count matches found failures
72+
# - Verifies failed and ignored test counts match found entries
6673
# - Reports parsing errors with detailed messages
6774
#
6875
# --------------------------------------------------------------------
@@ -97,36 +104,52 @@
97104
exit PARSE_ERROR;
98105
};
99106

100-
my ($status, $total_tests, $failed_tests, $passed_tests);
107+
# Initialize variables
108+
my ($status, $total_tests, $failed_tests, $ignored_tests, $passed_tests) = ('', 0, 0, 0, 0);
101109
my @failed_test_list = ();
110+
my @ignored_test_list = ();
102111

103112
while (<$fh>) {
104113
# Match the summary lines
105114
if (/All (\d+) tests passed\./) {
106115
$status = 'passed';
107116
$total_tests = $1;
108-
$failed_tests = 0;
109117
$passed_tests = $1;
110118
}
119+
elsif (/(\d+) of (\d+) tests passed, (\d+) failed test\(s\) ignored\./) {
120+
$status = 'passed';
121+
$passed_tests = $1;
122+
$total_tests = $2;
123+
$ignored_tests = $3;
124+
}
111125
elsif (/(\d+) of (\d+) tests failed\./) {
112126
$status = 'failed';
113127
$failed_tests = $1;
114128
$total_tests = $2;
115129
$passed_tests = $2 - $1;
116130
}
131+
elsif (/(\d+) of (\d+) tests failed, (\d+) of these failures ignored\./) {
132+
$status = 'failed';
133+
$failed_tests = $1 - $3;
134+
$ignored_tests = $3;
135+
$total_tests = $2;
136+
$passed_tests = $2 - $1;
137+
}
117138

118139
# Capture failed tests
119140
if (/^(?:\s+|test\s+)(\S+)\s+\.\.\.\s+FAILED\s+/) {
120141
push @failed_test_list, $1;
121142
}
122-
}
123-
close($fh);
124143

125-
unless (defined $status) {
126-
print "Error: Could not find test summary in $file\n";
127-
exit PARSE_ERROR;
144+
# Capture ignored tests
145+
if (/^(?:\s+|test\s+)(\S+)\s+\.\.\.\s+failed \(ignored\)/) {
146+
push @ignored_test_list, $1;
147+
}
128148
}
129149

150+
# Close the log file
151+
close $fh;
152+
130153
# Validate failed test count matches found test names
131154
if ($status eq 'failed' && scalar(@failed_test_list) != $failed_tests) {
132155
print "Error: Found $failed_tests failed tests in summary but found " . scalar(@failed_test_list) . " failed test names\n";
@@ -137,33 +160,50 @@
137160
exit PARSE_ERROR;
138161
}
139162

140-
# Write results to file
141-
open(my $out, '>', 'test_results.txt') or do {
142-
print "Cannot write results: $!\n";
163+
# Validate ignored test count matches found test names
164+
if ($ignored_tests != scalar(@ignored_test_list)) {
165+
print "Error: Found $ignored_tests ignored tests in summary but found " . scalar(@ignored_test_list) . " ignored test names\n";
166+
print "Ignored test names found:\n";
167+
foreach my $test (@ignored_test_list) {
168+
print " - $test\n";
169+
}
143170
exit PARSE_ERROR;
144-
};
171+
}
145172

146-
print $out "STATUS=$status\n";
147-
print $out "TOTAL_TESTS=$total_tests\n";
148-
print $out "FAILED_TESTS=$failed_tests\n";
149-
print $out "PASSED_TESTS=$passed_tests\n";
173+
# Write results to the results file
174+
open my $result_fh, '>', 'test_results.txt' or die "Cannot write to results file: $!\n";
175+
print $result_fh "STATUS=$status\n";
176+
print $result_fh "TOTAL_TESTS=$total_tests\n";
177+
print $result_fh "PASSED_TESTS=$passed_tests\n";
178+
print $result_fh "FAILED_TESTS=$failed_tests\n";
179+
print $result_fh "IGNORED_TESTS=$ignored_tests\n";
150180
if (@failed_test_list) {
151-
print $out "FAILED_TEST_NAMES=" . join(",", @failed_test_list) . "\n";
181+
print $result_fh "FAILED_TEST_NAMES=" . join(',', @failed_test_list) . "\n";
182+
}
183+
if (@ignored_test_list) {
184+
print $result_fh "IGNORED_TEST_NAMES=" . join(',', @ignored_test_list) . "\n";
152185
}
153-
close($out);
186+
close $result_fh;
154187

155188
# Print to stdout for logging
156189
print "Test Results:\n";
157190
print "Status: $status\n";
158191
print "Total Tests: $total_tests\n";
159192
print "Failed Tests: $failed_tests\n";
193+
print "Ignored Tests: $ignored_tests\n";
160194
print "Passed Tests: $passed_tests\n";
161195
if (@failed_test_list) {
162196
print "Failed Test Names:\n";
163197
foreach my $test (@failed_test_list) {
164198
print " - $test\n";
165199
}
166200
}
201+
if (@ignored_test_list) {
202+
print "Ignored Test Names:\n";
203+
foreach my $test (@ignored_test_list) {
204+
print " - $test\n";
205+
}
206+
}
167207

168208
# Exit with appropriate code
169209
if ($status eq 'passed') {

build_automation/cloudberry/scripts/parse-test-results.sh

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@
3030
# 3. Environment variable management
3131
# 4. Result file cleanup
3232
#
33-
# Required Environment Variables:
34-
# None
35-
#
36-
# Optional Environment Variables:
37-
# GITHUB_OUTPUT - GitHub Actions output file path
38-
# MAKE_NAME - Used in default log path construction
39-
#
4033
# Arguments:
4134
# [log-file] - Path to test log file
4235
# (defaults to build-logs/details/make-${MAKE_NAME}.log)
@@ -52,7 +45,9 @@
5245
# total_tests - Total number of tests
5346
# failed_tests - Number of failed tests
5447
# passed_tests - Number of passed tests
48+
# ignored_tests - Number of ignored tests
5549
# failed_test_names - Names of failed tests (comma-separated)
50+
# ignored_test_names - Names of ignored tests (comma-separated)
5651
#
5752
# Usage Examples:
5853
# # Parse default log file:
@@ -103,23 +98,16 @@ fi
10398

10499
source test_results.txt
105100

106-
echo "Results loaded into environment variables:"
107-
echo "STATUS=$STATUS"
108-
echo "TOTAL_TESTS=$TOTAL_TESTS"
109-
echo "FAILED_TESTS=$FAILED_TESTS"
110-
echo "PASSED_TESTS=$PASSED_TESTS"
111-
if [ -n "${FAILED_TEST_NAMES:-}" ]; then
112-
echo "FAILED_TEST_NAMES=$FAILED_TEST_NAMES"
113-
fi
114-
115101
# If in GitHub Actions, set outputs
116102
if [ -n "${GITHUB_OUTPUT:-}" ]; then
117103
{
118104
echo "status=$STATUS"
119105
echo "total_tests=$TOTAL_TESTS"
120106
echo "failed_tests=$FAILED_TESTS"
121107
echo "passed_tests=$PASSED_TESTS"
108+
echo "ignored_tests=$IGNORED_TESTS"
122109
[ -n "${FAILED_TEST_NAMES:-}" ] && echo "failed_test_names=$FAILED_TEST_NAMES"
110+
[ -n "${IGNORED_TEST_NAMES:-}" ] && echo "ignored_test_names=$IGNORED_TEST_NAMES"
123111
} >> "$GITHUB_OUTPUT"
124112
fi
125113

0 commit comments

Comments
 (0)