-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Implement support for passing a .env file to corerun to easily set environment variables for stress testing. #58222
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
Conversation
…vironment variables for stress testing.
|
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsIntroduce support into corerun for providing a "dotenv" file based on the format supported by python-dotenv that corerun will use to set environment variables before loading CoreCLR. This can be used to set various different stress modes by just editing a text file with a single format instead of having to edit a script which you then have to run. The file can be provided to corerun with the TODO:
|
|
Also, another fun feature that comes with this: GCStress can now be enabled when testing with WinDbgNext without having to use child process debugging through a batch file! |
1b5d0f3 to
4f0a38e
Compare
dotenv is a specific format that allows extra stuff, which typically is not allowed in the shell. e.g. spaces before/after |
|
It's meant to support the same level of dotenv support that the python-dotenv project provides (trimming spaces around the equals, comments, quoting and multi-line support, etc). I've seen various different rules for the format between python, nodejs, Ruby, etc. implementations, so I picked one to use as my base. |
|
Skimming through those tests, the only case that I don't already test (and doesn't work) is |
AaronRobinsonMSFT
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also update the doc on corerun usage - https://github.com/dotnet/runtime/blob/57bfe474518ab5b7cfe6bf7424a79ce3af9d6657/docs/workflow/testing/using-corerun.md
| return { buffer.get() }; | ||
| } | ||
| string_t get_exe_path() | ||
| inline void setenv(const char_t* var, string_t value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of string_t value, why not const char_t* value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used string_t here for parity with pal::getenv which returns a string_t.
Nice. It includes variable expansion https://pypi.org/project/python-dotenv/#variable-expansion as well? |
|
Yep it has variable expansion too! It first looks in env vars previously specified in the file. If it's not found there, then it looks in the environment. If it's not defined anywhere, it substitutes with an empty string. |
|
cc: @elinor-fung |
|
Only test failure is the xunit test harness collection issue. |
AaronRobinsonMSFT
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
|
Hello @jkoritzinsky! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Introduce support into corerun for providing a "dotenv" file based on the format supported by python-dotenv that corerun will use to set environment variables before loading CoreCLR.
This can be used to set various different stress modes by just editing a text file with a single format instead of having to edit a script which you then have to run.
The file can be provided to corerun with the
-eor--envflags.For example, diagnosing #57915 took setting and regularly changing 5+ environment variables, which was error prone.
TODO: