tsee / extutils-cppguess

Guess the C++ compiler for Perl modules
6 stars 9 forks source link

tests fail when cc is not in the path #30

Open shawnlaffan opened 5 months ago

shawnlaffan commented 5 months ago

(Edit) This is on Windows but seems to affect other systems. The matrix in cpan testers gives an overview.

http://matrix.cpantesters.org/?dist=ExtUtils-CppGuess+0.27

Commit 5e47504 added some mocked results and an override for ExtUtils::CppGuess::_capture but it seems not to trap all the variations.

The final test config at https://github.com/tsee/extutils-cppguess/blob/bfbed5863eede3e47ab45faf0e0662c6f245aab8/t/002_icpp.t#L135-L144 is causing an untrapped error at https://github.com/tsee/extutils-cppguess/blob/bfbed5863eede3e47ab45faf0e0662c6f245aab8/t/002_icpp.t#L158

I've not been able to track down the root cause but it seems related to the checks at https://github.com/tsee/extutils-cppguess/blob/bfbed5863eede3e47ab45faf0e0662c6f245aab8/lib/ExtUtils/CppGuess.pm#L288-L300

mohawk2 commented 4 months ago

As noted on https://github.com/shawnlaffan/perl-alien-proj/pull/9 - what do you think this module should do when it can't find a C++ compiler?

Separately, are you saying this non-finding is wrong? Where is the C++ compiler installed that this module should have looked?

shawnlaffan commented 4 months ago

These are tested using Strawberry Perl, which has g++ in its path.

The issue here is that the tests are mocking c++ compiler output but not mocking the search for the cc compiler when the is_gcc flag is true. There is no cc compiler on the system and so the test fails.

shawnlaffan commented 6 days ago

Looping back to this.

The issue here is that the mocking used in the test is incomplete. The test failure is a false negative wrt the module working or not, i.e. it correctly detects the g++ that comes with Strawberry Perl.

The simplest thing to do is to skip this test case when run under Strawberry Perl. This can be detected using $Config{myuname} =~ /strawberry/.