Skip to content

Clear CFLAGS and CXXFLAGS before tests #472

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, 2020

Conversation

robinkrahl
Copy link
Contributor

@robinkrahl robinkrahl commented Jan 27, 2020

Some test cases check that a compiler flag is not present. But cc::Build loads additional flags from the CFLAGS and CXXFLAGS environment variables. If these are set, they might interfere with the test cases.

Therefore this patch clears the CFLAGS and CXXFLAGS environment variables before running a test case that requires an absent flag.


This caused test failures in the Debian CI (example log). To reproduce the problem, run:

CFLAGS="-g -O2" CXXFLAGS="-stdlib=foo" cargo test

Some test cases check that a compiler flag is not present.  But
cc::Build loads additional flags from the CFLAGS and CXXFLAGS
environment variables.  If these are set, they might interfere with the
test cases.

Therefore we clear the CFLAGS and CXXFLAGS environment variables before
running a test that requires an absent flag.
@alexcrichton alexcrichton merged commit b3efc44 into rust-lang:master Jan 27, 2020
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