Skip to content

Commit 929f77d

Browse files
committed
Fix PostgresNode.pm for TAP tests on CBDB
Two fixes: - Use TestLib::slurp_file instead of PostgreSQL::Test::Utils::slurp_file in adjust_conf(). PostgresNode.pm only imports TestLib, not PostgreSQL::Test::Utils, so the latter is undefined and causes t/101_restore_point_and_startup_pause to fail. - Replace cp with install -m 644 in enable_archiving() archive_command. coreutils 8.32 (Rocky 8, Ubuntu 22.04) uses copy_file_range() in cp which crashes on Docker overlayfs. install does not use copy_file_range(), avoiding the crash. Also add ic-recovery test suite to rocky8 and deb CI pipelines.
1 parent e561d2d commit 929f77d

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

.github/workflows/build-cloudberry-rocky8.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@ jobs:
339339
},
340340
{"test":"ic-cbdb-parallel",
341341
"make_configs":["src/test/regress:installcheck-cbdb-parallel"]
342+
},
343+
{"test":"ic-recovery",
344+
"make_configs":["src/test/recovery:installcheck"],
345+
"enable_core_check":false
342346
}
343347
]
344348
}'

devops/build/automation/cloudberry/scripts/parse-results.pl

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
my @ignored_test_list = ();
111111

112112
while (<$fh>) {
113-
# Match the summary lines
113+
# Match the summary lines (pg_regress format)
114114
if (/All (\d+) tests passed\./) {
115115
$status = 'passed';
116116
$total_tests = $1;
@@ -132,8 +132,22 @@
132132
$status = 'failed';
133133
$failed_tests = $1 - $3;
134134
$ignored_tests = $3;
135-
$total_tests = $2;
136-
$passed_tests = $2 - $1;
135+
136+
# TAP/prove summary format: "Files=N, Tests=N, ..."
137+
} elsif (/^Files=\d+, Tests=(\d+),/) {
138+
$total_tests = $1;
139+
140+
# TAP/prove result: "Result: PASS" or "Result: FAIL"
141+
} elsif (/^Result: PASS/) {
142+
$status = 'passed';
143+
$passed_tests = $total_tests;
144+
$failed_tests = 0;
145+
} elsif (/^Result: FAIL/) {
146+
$status = 'failed';
147+
148+
# TAP individual test failure: " t/xxx.pl (Wstat: ...)"
149+
} elsif (/^\s+(t\/\S+\.pl)\s+\(Wstat:/) {
150+
push @failed_test_list, $1;
137151
}
138152

139153
# Capture failed tests
@@ -150,8 +164,15 @@
150164
# Close the log file
151165
close $fh;
152166

153-
# Validate failed test count matches found test names
154-
if ($status eq 'failed' && scalar(@failed_test_list) != $failed_tests) {
167+
# For TAP format, derive failed/passed counts from collected test names
168+
if ($status eq 'failed' && $failed_tests == 0 && scalar(@failed_test_list) > 0) {
169+
$failed_tests = scalar(@failed_test_list);
170+
$passed_tests = $total_tests - $failed_tests if $total_tests > 0;
171+
}
172+
173+
# Validate failed test count matches found test names (pg_regress format only)
174+
if ($status eq 'failed' && $failed_tests > 0 && scalar(@failed_test_list) > 0
175+
&& scalar(@failed_test_list) != $failed_tests) {
155176
print "Error: Found $failed_tests failed tests in summary but found " . scalar(@failed_test_list) . " failed test names\n";
156177
print "Failed test names found:\n";
157178
foreach my $test (@failed_test_list) {

src/test/perl/PostgresNode.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ sub adjust_conf
632632

633633
my $conffile = $self->data_dir . '/' . $filename;
634634

635-
my $contents = PostgreSQL::Test::Utils::slurp_file($conffile);
635+
my $contents = TestLib::slurp_file($conffile);
636636
my @lines = split(/\n/, $contents);
637637
my @result;
638638
my $eq = $skip_equals ? '' : '= ';
@@ -1220,7 +1220,7 @@ sub enable_archiving
12201220
my $copy_command =
12211221
$TestLib::windows_os
12221222
? qq{copy "%p" "$path\\\\%f"}
1223-
: qq{cp "%p" "$path/%f"};
1223+
: qq{install -m 644 "%p" "$path/%f"};
12241224

12251225
# Enable archive_mode and archive_command on node
12261226
$self->append_conf(

0 commit comments

Comments
 (0)