Skip to content

Commit 55cc25a

Browse files
luisleo526claude
andcommitted
Merge main into the memory-cache branch
Brings in the configure-time check that a test carrying the fast label must be listed in PINEFORGE_PR_FAST_TESTS. The merge applied without conflicts and changes no file of the cache work. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2 parents a279666 + 28286fb commit 55cc25a

7 files changed

Lines changed: 75 additions & 1 deletion

‎scripts/check_cr150_cmake_d.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@
2929
set_property(TEST ${_pf_fast_test} APPEND PROPERTY LABELS fast)
3030
endif()
3131
endforeach()
32+
get_directory_property(_pf_registered_tests TESTS)
33+
foreach(_pf_registered_test IN LISTS _pf_registered_tests)
34+
get_test_property(${_pf_registered_test} LABELS _pf_registered_test_labels)
35+
if("fast" IN_LIST _pf_registered_test_labels AND NOT _pf_registered_test IN_LIST PINEFORGE_PR_FAST_TESTS)
36+
message(FATAL_ERROR
37+
"test labeled fast is not in PINEFORGE_PR_FAST_TESTS, so pineforge_pr_smoke never builds it: ${_pf_registered_test}")
38+
endif()
39+
endforeach()
3240
if(PINEFORGE_BUILD_SOURCE_LAYER)
3341
add_custom_target(pineforge_pr_smoke DEPENDS ${PINEFORGE_PR_FAST_TESTS})
3442
endif()
@@ -76,6 +84,14 @@
7684
set_property(TEST ${_pf_fast_test} APPEND PROPERTY LABELS fast)
7785
endif()
7886
endforeach()
87+
get_directory_property(_pf_registered_tests TESTS)
88+
foreach(_pf_registered_test IN LISTS _pf_registered_tests)
89+
get_test_property(${_pf_registered_test} LABELS _pf_registered_test_labels)
90+
if("fast" IN_LIST _pf_registered_test_labels AND NOT _pf_registered_test IN_LIST PINEFORGE_PR_FAST_TESTS)
91+
message(FATAL_ERROR
92+
"test labeled fast is not in PINEFORGE_PR_FAST_TESTS, so pineforge_pr_smoke never builds it: ${_pf_registered_test}")
93+
endif()
94+
endforeach()
7995
if(PINEFORGE_BUILD_SOURCE_LAYER)
8096
add_custom_target(pineforge_pr_smoke DEPENDS ${PINEFORGE_PR_FAST_TESTS})
8197
endif()

‎scripts/check_two_world_registration.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,17 @@ def run(self, start: int = 0, end: int | None = None) -> None:
10381038
# the same NOTFOUND binding as get_target_property below.
10391039
self.vars[values[-1]] = ['NOTFOUND']
10401040
index += 1
1041+
elif head == 'get_directory_property':
1042+
values = split_values(arguments(statement))
1043+
# The tests registered so far are the one directory property
1044+
# this walk knows; any other property is not modelled, so the
1045+
# sweep exits 2 rather than binding a guess.
1046+
if len(values) != 2 or values[1] != 'TESTS':
1047+
raise Unreadable(
1048+
f'{self.path}:{line}: unmodelled get_directory_property '
1049+
f'{" ".join(values[1:])}')
1050+
self.vars[values[0]] = sorted(self.rows)
1051+
index += 1
10411052
elif head in ('get_target_property',):
10421053
values = split_values(arguments(statement))
10431054
self.vars[values[1]] = ['NOTFOUND']

‎scripts/ci_preflight.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,14 @@ def post_build_name(count: int) -> str:
546546
set_property(TEST ${_pf_fast_test} APPEND PROPERTY LABELS fast)
547547
endif()
548548
endforeach()
549+
get_directory_property(_pf_registered_tests TESTS)
550+
foreach(_pf_registered_test IN LISTS _pf_registered_tests)
551+
get_test_property(${_pf_registered_test} LABELS _pf_registered_test_labels)
552+
if("fast" IN_LIST _pf_registered_test_labels AND NOT _pf_registered_test IN_LIST PINEFORGE_PR_FAST_TESTS)
553+
message(FATAL_ERROR
554+
"test labeled fast is not in PINEFORGE_PR_FAST_TESTS, so pineforge_pr_smoke never builds it: ${_pf_registered_test}")
555+
endif()
556+
endforeach()
549557
if(PINEFORGE_BUILD_SOURCE_LAYER)
550558
add_custom_target(pineforge_pr_smoke DEPENDS ${PINEFORGE_PR_FAST_TESTS})
551559
endif()

‎scripts/test_two_world_registration.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,36 @@ def test_a_reached_fatal_error_exits_2(self):
556556
result.stdout + result.stderr)
557557
self.assertIn(TREES_DIR, result.stdout + result.stderr)
558558

559+
# control 12b: get_directory_property(TESTS) reads the rows registered so
560+
# far; a row registered after the read is not in the list
561+
def test_get_directory_property_tests_lists_the_registered_rows(self):
562+
baseline = self.row_count(TREES_DIR)
563+
self.tree.append(TREES_DIR, '''
564+
add_test(NAME e2e_two_world_dirprop_probe COMMAND ${CMAKE_COMMAND} -E echo ok)
565+
set(_e2e_two_world_probe e2e_two_world_dirprop_probe)
566+
get_directory_property(_e2e_two_world_all TESTS)
567+
if(${_e2e_two_world_probe} IN_LIST _e2e_two_world_all)
568+
add_test(NAME e2e_two_world_dirprop_seen COMMAND ${CMAKE_COMMAND} -E echo ok)
569+
endif()
570+
add_test(NAME e2e_two_world_dirprop_late COMMAND ${CMAKE_COMMAND} -E echo ok)
571+
set(_e2e_two_world_late e2e_two_world_dirprop_late)
572+
if(${_e2e_two_world_late} IN_LIST _e2e_two_world_all)
573+
add_test(NAME e2e_two_world_dirprop_late_seen COMMAND ${CMAKE_COMMAND} -E echo ok)
574+
endif()
575+
''')
576+
# probe, seen and late register; late_seen must not
577+
self.assertEqual(baseline + 3, self.row_count(TREES_DIR))
578+
579+
# control 12c: any other directory property is not modelled (exit 2)
580+
def test_an_unmodelled_directory_property_exits_2(self):
581+
self.tree.append(TREES_DIR, '''
582+
get_directory_property(_e2e_two_world_dirs INCLUDE_DIRECTORIES)
583+
''')
584+
result = self.run_check('--cmakelists', TREES_DIR, '--profile', 'release')
585+
self.assertEqual(2, result.returncode, result.stdout + result.stderr)
586+
self.assertIn('unmodelled get_directory_property INCLUDE_DIRECTORIES',
587+
result.stdout + result.stderr)
588+
559589
# control 13: a two-pattern glob; the registered row appears only when
560590
# BOTH patterns are matched (one file each, in two directories)
561591
def test_a_two_pattern_glob_matches_both_patterns(self):

‎tests/CMakeLists.txt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8062,6 +8062,14 @@ foreach(_pf_fast_test IN LISTS PINEFORGE_PR_FAST_TESTS)
80628062
set_property(TEST ${_pf_fast_test} APPEND PROPERTY LABELS fast)
80638063
endif()
80648064
endforeach()
8065+
get_directory_property(_pf_registered_tests TESTS)
8066+
foreach(_pf_registered_test IN LISTS _pf_registered_tests)
8067+
get_test_property(${_pf_registered_test} LABELS _pf_registered_test_labels)
8068+
if("fast" IN_LIST _pf_registered_test_labels AND NOT _pf_registered_test IN_LIST PINEFORGE_PR_FAST_TESTS)
8069+
message(FATAL_ERROR
8070+
"test labeled fast is not in PINEFORGE_PR_FAST_TESTS, so pineforge_pr_smoke never builds it: ${_pf_registered_test}")
8071+
endif()
8072+
endforeach()
80658073
if(PINEFORGE_BUILD_SOURCE_LAYER)
80668074
add_custom_target(pineforge_pr_smoke DEPENDS ${PINEFORGE_PR_FAST_TESTS})
80678075
endif()

‎tests/cr150.d/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Each CR-150 lane has one file named `<lane>.cmake` holding that lane's `list(APPEND TEST_SOURCES ...)` and `pineforge_add_unit_test(...)` lines in the same one-line-per-item form; files are included in sorted name order by the shared include loop at the end of the plain registrations in `tests/CMakeLists.txt`, and a lane must never edit another lane's file.
22
`set_tests_properties(...)` may name only tests registered by the same lane's file or fence; tests from the main file or another lane are not owned by that lane. Only the property keys `LABELS`, `SKIP_RETURN_CODE`, `RUN_SERIAL`, and `DEPENDS` are allowed (`TIMEOUT` is rejected: this repository declares no time limits, owner rule #827); `set_target_properties(...)` is forbidden. In lane files and fences, `SKIP_RETURN_CODE` must be the literal `77`, the receipt-gated skip sentinel tracked by `scripts/check_abi_receipt_skips.py`; every other skip return code is rejected.
3+
A test may carry the label `fast` only through `PINEFORGE_PR_FAST_TESTS`, and configure fails otherwise.
34

45
After the include loop, only zero or more `# --- CR-150 <lane> begin ---` / `# --- CR-150 <lane> end ---` blocks may appear before the canonical fast-row registration block; each block must be matched, nonnested, unique, and named with the exact stem of an existing `tests/cr150.d/<lane>.cmake` file.
56
Lane files and appended blocks go above the fast-row registration block, which must stay the last CMake code in `tests/CMakeLists.txt`. The sole unfenced exception is that terminal PR-fast validation block for `PINEFORGE_PR_FAST_TESTS` and its `pineforge_pr_smoke` target: no lane file or fence may follow it.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
list(APPEND TEST_SOURCES test_command_scratch_cache_slot_table)
22
pineforge_add_unit_test(test_command_scratch_cache_slot_table)
3-
set_tests_properties(test_command_scratch_cache_slot_table PROPERTIES LABELS "fast;scratch")
3+
set_tests_properties(test_command_scratch_cache_slot_table PROPERTIES LABELS "scratch")

0 commit comments

Comments
 (0)