Skip to content

[test] Allow setting extra environment for running tests. #35619

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

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

drodriguez
Copy link
Contributor

In some situations, in order to set the correct environment during some
tests, extra environment has to be provided to the LLVM Lit invocations.
It seems that the preferred way is using cmake -E env to be
cross-platform.

The environment can be set using a cached variable so it can be set from
CMake cache files, or passing parameters to the CMake configuration
step.

/cc @rmaz

In some situations, in order to set the correct environment during some
tests, extra environment has to be provided to the LLVM Lit invocations.
It seems that the preferred way is using `cmake -E env` to be
cross-platform.

The environment can be set using a cached variable so it can be set from
CMake cache files, or passing parameters to the CMake configuration
step.
@drodriguez drodriguez requested a review from gmittert January 27, 2021 18:14
@drodriguez
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@gmittert gmittert left a comment

Choose a reason for hiding this comment

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

Changes look reasonable to me. What kind of tests need this additional environment?

@drodriguez
Copy link
Contributor Author

@swift-ci please test Windows platform

@drodriguez
Copy link
Contributor Author

More background for the changes:

The Python tests require importing six. Normally one will have this installed on the system Python, or inside a virtualenv. Other environments that try to keep builds isolated will not allow installing dependencies in the system Python, or provide virtualenv. However, using PYTHONPATH to point to a local copy of six is enough for the tests.

Additionally the build system tests require cmake to be available in the path. Some environments do not have it in the path (one can invoke CMake with a full path). Adding cmake to the PATH temporarily for tests is possible this way, without adding it to more parts of the build.

@gmittert gmittert merged commit 80322a5 into swiftlang:main Jan 27, 2021
@drodriguez drodriguez deleted the swift-lit-environment branch January 27, 2021 22:59
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.

2 participants