Skip to content

Commit 9200167

Browse files
luisleo526claude
andcommitted
The receipt-skip row reads CTest's summary, not one CMake's wording
CTest spells its closing summary two ways. CMake 3.28 -- ubuntu-24.04's apt cmake, which the kernel-only CI job runs -- always prints the failed count: "100% tests passed, 0 tests failed out of 4". CMake 4.x drops the clause when nothing failed: "100% tests passed out of 4". The row matched the second literally, so it passed on the local macOS host (cmake 4.4.0) and failed on every Linux runner. expectation corrected: the literal '100% tests passed out of 4' -> ci_verify.ctest_rows() counts, because that string is the CMake >= 4 wording only. ctest_rows is the parser the CI test floor already reads this same line with, and it accepts both wordings; reusing it keeps one reader of the line instead of a second copy of the regex. CTestSummarySpelling pins both wordings as verbatim fixtures of the same four rows -- one captured on cmake 3.28.3, one on cmake 4.4.0 -- so either host covers the reader for both, without a Linux host. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1 parent 9392273 commit 9200167

1 file changed

Lines changed: 54 additions & 1 deletion

File tree

‎scripts/test_abi_receipt_skips.py‎

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import unittest
2020

2121
import check_abi_receipt_skips as skips
22+
from ci_verify import ctest_rows
2223
from prepare_settlement_cpp_abi_base import PROVIDERS
2324

2425
# The ctest the CTest row passes with --ctest (CMAKE_CTEST_COMMAND), else PATH's.
@@ -73,6 +74,9 @@ def test_a_missing_receipt_fails_a_row_registered_to_require_it(self):
7374
class AgainstRealCTest(unittest.TestCase):
7475
"""Rows written to a CTestTestfile.cmake and listed by the real ctest."""
7576

77+
# The gated rows build_tree registers, in the order ctest lists them.
78+
GATED = ('test_gated_pair', 'test_gated_settlement', 'test_gated_budget')
79+
7680
@classmethod
7781
def setUpClass(cls):
7882
if not CTEST:
@@ -124,7 +128,17 @@ def test_ctest_passes_a_run_in_which_gated_rows_skipped_and_the_check_names_them
124128
build = self.build_tree(export_compile_commands=True)
125129
run = subprocess.run([CTEST, '--test-dir', str(build)], capture_output=True, text=True)
126130
self.assertEqual(run.returncode, 0, run.stdout)
127-
self.assertIn('100% tests passed out of 4', run.stdout)
131+
# The summary wording is CMake's, not this tree's: 3.28 always spells
132+
# the failed count, 4.x drops the clause when nothing failed (see
133+
# CTestSummarySpelling below). Read the counts with ci_verify's parser,
134+
# the one the CI floor reads the same line with, rather than matching
135+
# one host's wording.
136+
# expectation corrected: literal '100% tests passed out of 4' ->
137+
# ctest_rows() counts, because that string is the CMake >= 4 wording
138+
# only and ubuntu-24.04 CI runs CMake 3.28.
139+
rows = ctest_rows(run.stdout.encode())
140+
self.assertEqual((rows.total, rows.ran), (4, 1), run.stdout)
141+
self.assertEqual(rows.skipped, self.GATED, run.stdout)
128142
self.assertIn('test_gated_pair (Skipped)', run.stdout)
129143
code, out = self.check(build)
130144
self.assertEqual(code, 1, out)
@@ -176,6 +190,45 @@ def test_a_directory_that_is_no_build_tree_is_refused(self):
176190
self.assertIn('not a configured CMake build tree', err.getvalue())
177191

178192

193+
class CTestSummarySpelling(unittest.TestCase):
194+
"""Both wordings CTest prints for the summary the row above reads.
195+
196+
Verbatim runs of the four rows build_tree registers, three of them
197+
skipped, on the two CMake generations in use: 3.28.3 is ubuntu-24.04's
198+
apt cmake, which the kernel-only CI job runs; 4.4.0 is the local macOS
199+
one. Only the summary line differs, and a row that matched one of them
200+
literally passed on that host alone -- so the fixtures keep both readable
201+
from either host.
202+
"""
203+
204+
ROWS = ('Test project BUILD\n'
205+
' Start 1: test_plain_python_row\n'
206+
'1/4 Test #1: test_plain_python_row ............ Passed 0.01 sec\n'
207+
' Start 2: test_gated_pair\n'
208+
'2/4 Test #2: test_gated_pair ..................***Skipped 0.01 sec\n'
209+
' Start 3: test_gated_settlement\n'
210+
'3/4 Test #3: test_gated_settlement ............***Skipped 0.01 sec\n'
211+
' Start 4: test_gated_budget\n'
212+
'4/4 Test #4: test_gated_budget ................***Skipped 0.01 sec\n')
213+
DID_NOT_RUN = ('\nTotal Test time (real) = 0.04 sec\n'
214+
'\nThe following tests did not run:\n'
215+
'\t 2 - test_gated_pair (Skipped)\n'
216+
'\t 3 - test_gated_settlement (Skipped)\n'
217+
'\t 4 - test_gated_budget (Skipped)\n')
218+
SUMMARIES = {
219+
'cmake 3.28.3 (ubuntu-24.04)': '\n100% tests passed, 0 tests failed out of 4\n',
220+
'cmake 4.4.0 (macOS)': '\n100% tests passed out of 4\n',
221+
}
222+
223+
def test_either_wording_reads_as_four_rows_of_which_the_three_gated_skipped(self):
224+
for spelling, summary in self.SUMMARIES.items():
225+
with self.subTest(spelling):
226+
rows = ctest_rows((self.ROWS + summary + self.DID_NOT_RUN).encode())
227+
self.assertEqual((rows.total, rows.ran), (4, 1))
228+
self.assertEqual(rows.skipped, AgainstRealCTest.GATED)
229+
self.assertEqual((rows.not_run, rows.disabled), ((), ()))
230+
231+
179232
class Preparation(unittest.TestCase):
180233
"""--prepare: the six providers, in ci_verify's order, never over an existing one."""
181234

0 commit comments

Comments
 (0)