linux-test-project / lcov

LCOV
GNU General Public License v2.0
909 stars 240 forks source link

tests: use $CC and $CXX, not hard-coded gcc/g++ #313

Closed tari closed 3 months ago

tari commented 3 months ago

Cross-compiling may need to use a different compiler, so don't hard code references to plain gcc and instead determine the compiler to use from the environment and default to gcc if unspecified.

When building for ChromeOS for example, invoking plain gcc or g++ is turned into a fatal error as a safety measure to ensure that everything which should be cross-compiled actually is; ignoring CC and CXX in the environment causes the tests to break make install, since the test scripts run unprefixed gcc to probe the compiler version in use even when run as part of make clean invocations during make install.

henry2cox commented 3 months ago

Thanks for the contribution. Something I meant to do for quite some time - and never got around to. (Really: what I wanted to do is to make the tests a bit more generic - so the they would run with llvm...a project for another day.)

I haven't tried your fix yet - but I think that it slightly breaks my most common usage:

Do you mind to update your change slightly, to set CC/CXX if one isn't already defined in the environment? I think that will address both of our concerns. Not sure if anyone apart from me does this, or cares. (It is fair for you to object in that I could just run CXX=g++ ./msgtest.sh -v)

Henry

tari commented 3 months ago

That's reasonable. I had actually done it that way initially, but decided it would be a little simpler to set the variables in the makefile only. If you like being able to run the scripts directly though, that's enough reason to set them in each script- I've made that change now.

henry2cox commented 3 months ago

Looks good - thanks! Yeah...I run things manually very, very frequently - almost always, because I broke something and am trying to debug it. Henry