Page MenuHomeFreeBSD

atf: Fix ATF_BUILD_* values when not using the bootstrap compiler
ClosedPublic

Authored by arichardson on Fri, Jan 29, 3:23 PM.

Details

Summary

Currently, we encode the full path and compile flags for the build
compiler in libatf. However, these values are not correct when
cross-compiling: For example, when I build on macOS, CC is set to the
host path /usr/local/Cellar/llvm/11.0.0_1/bin/clang-11. This path will
not exist on the target system.
Simplify this logic and use cc/cpp/c++ since those binaries will exist
on the target system unless the compiler was explicitly disabled.
I'm not convinced ATF needs to encode these values, but this is a
minimal fix for these tests when using a non-bootstrapped compiler.

Test Plan

I noticed this while testing an atf contrib update since one of the
tests now requires ATF_BUILD_CC.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

IMO these tests are extremely dubious and fragile. Embedding cc/c++/cpp seems most likely to work at all. I think I've proposed something like this in the past.

This revision is now accepted and ready to land.Tue, Feb 2, 6:34 PM

I agree with @brooks ; the functionality that involves compiling as part of tests is very dubious functionality that should be removed.

In D28414#637002, @ngie wrote:

I agree with @brooks ; the functionality that involves compiling as part of tests is very dubious functionality that should be removed.

I agree, I had a look at not compiling those tests but it seems like this change needs to be done inside ATF. For now this works around the problem.