Skip to content
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

Support testExcludeOptions to remove linker options in test phase. #307

Open
mangrer opened this issue Mar 5, 2018 · 1 comment
Open

Comments

@mangrer
Copy link

mangrer commented Mar 5, 2018

Problem Scenario:

We support deployment of artifacts across multiple platforms with multiple compilers (gcc, xlc, msvc). When a compiler/linker option from one of the previous stage is passed during default-test phase, few linkers (like gcc) are smart enough to exclude some linker options that might not be applicable for building a test executable, whereas few other compiler (e.g., xlc & msvc) still continue to link with linker options that either render an invalid unit-test executable (that can't be run) or fail to build an executable.

Example:

For msvc linker, linker options like /DLL or / DEF when continued to be passed as a flag during default-test phase, tries building an intermediate unittest.lib for test executable & fails to render a valid unit-test executable.

For xlc linker, similar linker options used for building a shared object must be discarded during test phase, those linker flags include -bnoentry, -bE, -qmkshrobj.

Solution:

The most elegant solution, we could think of cross-platform is to provide a testExcludeOptions that when passed in the linker section, would just exclude linker options (that were previously included to build a shared object) from getting passed to linker during the test-phase build.

Pull-request:

Please refer to #306, also contains automated tests (unit-tests) to validate the issue.

@GregDomjan
Copy link
Member

I recently had a similar issue with tests taking on options/defines from the main build that where not appropriate.
My workaround for a definition was to #undef in the test file.

The solution seems ok to me so far, however...
The only alternative I can think of is to use the existing configuration as a 'common' and to have additional <mainOptions> and <testOptions> style to split additional config, rather than removing config.

Needs something for 'Options' and also 'Defines' for linker and compilers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants