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

Make use of internal/testenv where appropriate #375

Open
chrisccoulson opened this issue Jan 29, 2025 · 0 comments
Open

Make use of internal/testenv where appropriate #375

chrisccoulson opened this issue Jan 29, 2025 · 0 comments

Comments

@chrisccoulson
Copy link
Collaborator

PR #328 introduced a small package internal/testenv which is small enough to
be embedded in production code and exports a single function IsTestBinary in
order to prevent access to unit-test only features in production code. The package
requires explicit linker flags to make the function to return true, else it always
returns false.

There may be other places in secboot which would benefit from its use, eg,
internal/bootscope exports a function that should only be used in unit tests,
and currently requires a hack to enable it - it requires the unit test code to set
an exported variable which is named in a way to make it clear that it's not for
use in production code.

There are probably other places where it's use is appropriate, but I haven't done
a full audit of the code yet.

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

No branches or pull requests

1 participant