Skip to content

Commit 2bdb5ef

Browse files
committed
test(pipeline): give the package cross/register scope cases a cross-walk call
The cross and register scope-failure cases defined S and called s.m() inside pkg/__init__.py. The per-file LSP already resolves those calls, and the parallel driver skips the cross-file walk for a file whose call sites are all resolved, so CBM_TEST_PY_LSP_SCOPE_FAIL_STAGE=cross and =register never fired on the parallel path and both parallel cases saw no file error. For those two stages, move S into memo_def.py (imported by pkg/__init__.py) so run() holds calls only the cross walk resolves, and count that module's File node. The raw stage keeps its single-file fixture; the error assertions are unchanged. With the corrected fixture all eight package-scope pipeline cases pass; removing the CBM_PY_LSP_SCOPE_ERROR capture in pass_parallel.c turns exactly the two parallel cross/register cases RED again. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 7effa3c commit 2bdb5ef

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

‎tests/test_pipeline.c‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10962,13 +10962,24 @@ static int python_init_scope_pipeline_case(bool parallel, const char *failure_st
1096210962
FAIL("failed to create Python package fixture");
1096310963
n = snprintf(path, sizeof(path), "%s/pkg", root);
1096410964
bool written = n > 0 && (size_t)n < sizeof(path);
10965+
/* The cross and register stages run inside the cross-file walk, which the
10966+
* parallel driver skips for a file whose call sites the per-file LSP
10967+
* already resolved: those stages need a call only the cross walk resolves. */
10968+
bool cross_walk_stage = failure_stage && (strcmp(failure_stage, "cross") == 0 ||
10969+
strcmp(failure_stage, "register") == 0);
1096510970
if (written) {
1096610971
cbm_mkdir_p(path, 0755);
1096710972
written = python_module_write_fixture_file(
1096810973
root, "pkg/__init__.py",
10969-
failure_stage ? "class S:\n def m(self):\n return 1\n"
10970-
"def run():\n s = S()\n return s.m()\n"
10971-
: body);
10974+
cross_walk_stage ? "from memo_def import S\n"
10975+
"def run():\n s = S()\n return s.m()\n"
10976+
: failure_stage ? "class S:\n def m(self):\n return 1\n"
10977+
"def run():\n s = S()\n return s.m()\n"
10978+
: body);
10979+
}
10980+
if (written && cross_walk_stage) {
10981+
written = python_module_write_fixture_file(root, "memo_def.py",
10982+
"class S:\n def m(self):\n return 1\n");
1097210983
}
1097310984
if (written && !failure_stage) {
1097410985
written = python_module_write_fixture_file(root, "plain.py", body) &&
@@ -11033,7 +11044,8 @@ static int python_init_scope_pipeline_case(bool parallel, const char *failure_st
1103311044
correct = project &&
1103411045
cbm_store_find_nodes_by_label(store, project, "File", &files, &file_count) ==
1103511046
CBM_STORE_OK &&
11036-
file_count == (failure_stage ? 1 : 5) + (parallel ? 52 : 0);
11047+
file_count ==
11048+
(cross_walk_stage ? 2 : failure_stage ? 1 : 5) + (parallel ? 52 : 0);
1103711049
cbm_store_free_nodes(files, file_count);
1103811050
if (project && !failure_stage) {
1103911051
const char *modules[] = {"plain", "pkg"};

0 commit comments

Comments
 (0)