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

Build native_binary/test src in correct configuration #341

Merged
merged 2 commits into from Apr 5, 2022

Conversation

GMNGeoffrey
Copy link
Contributor

This attribute is incorrectly being built in the host configuration when
(like any test) it will run in the target configuration. This means that
cross compilation will be broken and options that differ between host
and target (e.g. NDEBUG) will not be as set by the user.

I confirmed that without this fix, a test binary with assert(false)
passes when run under native_test.

Additionally, the use of allow_single_file precludes rules that return
multiple files in their DefaultInfo (like py_binary). Instead, we can
use allow_files and access via ctx.executable.

@GMNGeoffrey
Copy link
Contributor Author

@c-parsons could you PTAL

@GMNGeoffrey
Copy link
Contributor Author

@c-parsons could you PTAL

Ah apologies I think this ping (and similar on my other PRs) was perhaps misdirected. You're identified as the best reviewer internally, but I think that's just because you imported changes from others. I would still appreciate review (or at least acknowledgement) from someone on these. These issues are blocking other things I'm working on

This attribute is incorrectly being built in the host configuration when
(like any test) it will run in the target configuration. This means that
cross compilation will be broken and options that differ between host
and target (e.g. `NDEBUG`) will not be as set by the user.

I confirmed that without this fix, a test binary with `assert(false)`
passes when run under `native_test`.

Additionally, the use of `allow_single_file` precludes rules that return
multiple files in their DefaultInfo (like `py_binary`). Instead, we can
use `allow_files` and access via `ctx.executable`.
@GMNGeoffrey GMNGeoffrey changed the title Fix native_binary/test src attribute Build native_binary/test src in correct configuration Mar 29, 2022
Copy link
Collaborator

@tetromino tetromino left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@tetromino tetromino merged commit 6abad3d into bazelbuild:main Apr 5, 2022
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.

None yet

2 participants