openssl / openssl

TLS/SSL and crypto library
https://www.openssl.org
Apache License 2.0
26.12k stars 10.19k forks source link

3.0.0-alpha4 run_tests.pl bombs if TAP::Harness or TAP::Parser not available #12352

Open rainerjung opened 4 years ago

rainerjung commented 4 years ago

Though an eval construct is used, the new run_tests.pl bombs without TAP::Parser or TAP::Harness:

Can't locate TAP/Parser.pm in @INC (@INC contains: /path/to/bld/openssl300/test/../util/perl /path/to/local/perl/lib/perl5 /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .) at /path/to/local/perl/lib/perl5/parent.pm line 20. BEGIN failed--compilation aborted at /path/to/bld/openssl300/test/run_tests.pl line 131.

and

Can't locate TAP/Harness.pm in @INC (@INC contains: /path/to/bld/openssl300/test/../util/perl /path/to/local/perl/lib/perl5 /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .) at /path/to/local/perl/lib/perl5/parent.pm line 20. BEGIN failed--compilation aborted at /path/to/bld/openssl300/test/run_tests.pl line 215.

In OpenSSL 1.1.1 the script has an effective workaround to fall back to Test::Harness, if TAP::Harness is not available. That code has substantially changed, bit it seems it should still fall back but doesn't.

If this new requirement is intended, it should be documented in NOTES.PERL.

Observed on SuSE Linux Enterprise Server 11 (SLES11).

rainerjung commented 4 years ago

I used the following patch to fix this:

--- test/run_tests.pl 2020-07-02 14:45:19.000000000 +0200
+++ test/run_tests.pl   2020-07-07 13:43:57.710565760 +0200
@@ -128,7 +128,8 @@

 $eres = eval {
     package TAP::Parser::OpenSSL;
-    use parent 'TAP::Parser';
+    use parent -norequire, 'TAP::Parser';
+    require TAP::Parser;

     sub new {
         my $class = shift;
@@ -212,7 +213,8 @@
     }

     package TAP::Harness::OpenSSL;
-    use parent 'TAP::Harness';
+    use parent -norequire, 'TAP::Harness';
+    require TAP::Harness;

     package main;

It may look strange, but the docs for parent.pm show, that without the "-norequire" it puts the require statement in a BGIN block which probably runs before the eval, to the loading is no longer encapsulated by the eval. Without the additional require line, the loading doesn't happen at all, so the availability testing fails. Combining the "-norequire" and an explicit "require" worked for me. Tested only on the platform that showed the original problem (SLES 11).

mattcaswell commented 4 years ago

@levitte

levitte commented 4 years ago

@rainerjung, that looks perfect. Are you willing to make that a PR?

rainerjung commented 4 years ago

Yes of course, but because it is IMHO a trivial change, I wouldn't mind you simply picking it up. No need for credits or similar.

nhorman commented 6 months ago

Marking as inactive to be closed at the end of 3.4 dev, barring further input