Skip to content

tool test: TestPython - #923

Merged
xushiwei merged 1 commit into
goplus:mainfrom
xushiwei:q
Oct 5, 2026
Merged

xushiwei merged 1 commit into
goplus:mainfrom
xushiwei:q

Conversation

@xushiwei

@xushiwei xushiwei commented Oct 5, 2026

Copy link
Copy Markdown
Member

No description provided.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

This PR adds a TestPython golden-file test case (Python 3.14.8 bindings) under tool/_testc/python-3.14.8/, and refactors debug flag handling in tool/gen_test.go by moving cl.SetDebug/tool.SetDebug out of init() and into TestClang with a deferred reset.

Overall: The change is well-scoped and test-only. The SetDebug relocation is a clean isolation improvement (tests run sequentially, no t.Parallel(), so the deferred reset reliably restores state). One golden fixture appears not to compile — flagged inline.

Notes (non-blocking):

  • Debug scope change: Previously init() enabled DbgFlagAll for every test in the package. Now only TestClang runs with debug on; TestSingleC, TestPython, and the LLVM/_testcpp tests run with it off. Since debugSettings only gates log.Println diagnostics, this is a cosmetic change and looks intentional — just confirming the intent.
  • macOS-only validation: TestPython uses the full-package path (testFromDir(..., false)), which early-returns on non-darwin (only test on macOS). The committed golden files (including pyconfig.go's macOS-specific values like HAVE_KQUEUE, WITH_DYLD, X_PYTHONFRAMEWORK = "Python") are therefore only verified on macOS runners. This is consistent with the existing suite pattern, but it means the pythread.go issue below is not caught by non-darwin CI.

Comment on lines +17 to +18
X_isInitialized c1.Int
X_key pthread.Key

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Generated pythread.go references c1/pthread but imports neither

The golden file imports only the unaliased c package (import "github.com/goplus/lib/c"), and uses it correctly at PyLockStatus c.Uint. However, the X_PyTssT struct body references c1.Int and pthread.Key, neither of which is imported in this file:

type X_PyTssT struct {
	X_isInitialized c1.Int      // c1 undefined here
	X_key           pthread.Key // pthread undefined here
}

As written this file cannot compile (undefined: c1, undefined: pthread, and c imported but unused — the c.Uint use alone doesn't change that both other identifiers are undefined). The sibling cpython-pythread.go in the same package shows the intended import block: c1 "github.com/goplus/lib/c" (aliased) plus "github.com/goplus/lib/c/pthread". Since this is DO NOT EDIT generated output, the mismatch points to a generator import-collection bug for this file — the body emits aliased/qualified names (c1, pthread) while the import writer emitted a plain unaliased c. Recommend regenerating and confirming the import block matches the referenced identifiers rather than hand-editing the golden file.

@xushiwei
xushiwei merged commit 9f98b4c into goplus:main Oct 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant