Skip to content

Support // Env in the python test runner #58179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
joyeecheung opened this issue May 5, 2025 · 0 comments
Open

Support // Env in the python test runner #58179

joyeecheung opened this issue May 5, 2025 · 0 comments
Labels
test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory.

Comments

@joyeecheung
Copy link
Member

joyeecheung commented May 5, 2025

Something I found very useful in V8's test runner (our Python test runner is a fork of a very old version of this) is the support of the // Environment variables comment (similar to the // Flags comment, this instructs the test runner to pass a particular flag when running the test)

// Environment Variables: LC_ALL=de

The way it's implemented in V8 can be found in e.g. here

ENV_PATTERN = re.compile(r"//\s+Environment Variables:(.*)")

We can probably just port similar logic to our fork in e.g. here

flags_match = FLAGS_PATTERN.search(source)

It would be handy to leave more logs in flaky tests via the use of // Env: NODE_DEBUG=foo or // Env: NODE_DEBUG_NATIVE=foo - trying to set the flag in the entire test job or the entire test suite would be uncanny since many tests also check that stdout/stderr is empty, and we probably only want to do this for selected flaky tests that don't care about stdout/stderr so that they leave more traces in the CI logs. This would also help simplifying many tests that only spawn child processes to customize the environment varaibles.

@joyeecheung joyeecheung added test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory. labels May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

No branches or pull requests

1 participant