Consolidate the locations where we have our internal perl modules
authorRichard Levitte <levitte@openssl.org>
Tue, 1 Aug 2017 20:10:39 +0000 (22:10 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 15 Aug 2017 09:30:47 +0000 (11:30 +0200)
Instead of having perl modules under test/testlib, util and util/perl,
consolidate them all to be inside util/perl.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4069)

22 files changed:
Configure
test/generate_ssl_tests.pl
test/recipes/80-test_ssl_new.t
test/recipes/tconversion.pl
test/run_tests.pl
util/dofile.pl
util/perl/OpenSSL/Test.pm [moved from test/testlib/OpenSSL/Test.pm with 100% similarity]
util/perl/OpenSSL/Test/Simple.pm [moved from test/testlib/OpenSSL/Test/Simple.pm with 100% similarity]
util/perl/OpenSSL/Test/Utils.pm [moved from test/testlib/OpenSSL/Test/Utils.pm with 100% similarity]
util/perl/TLSProxy/Certificate.pm [moved from util/TLSProxy/Certificate.pm with 100% similarity]
util/perl/TLSProxy/CertificateVerify.pm [moved from util/TLSProxy/CertificateVerify.pm with 100% similarity]
util/perl/TLSProxy/ClientHello.pm [moved from util/TLSProxy/ClientHello.pm with 100% similarity]
util/perl/TLSProxy/EncryptedExtensions.pm [moved from util/TLSProxy/EncryptedExtensions.pm with 100% similarity]
util/perl/TLSProxy/HelloRetryRequest.pm [moved from util/TLSProxy/HelloRetryRequest.pm with 100% similarity]
util/perl/TLSProxy/Message.pm [moved from util/TLSProxy/Message.pm with 100% similarity]
util/perl/TLSProxy/NewSessionTicket.pm [moved from util/TLSProxy/NewSessionTicket.pm with 100% similarity]
util/perl/TLSProxy/Proxy.pm [moved from util/TLSProxy/Proxy.pm with 100% similarity]
util/perl/TLSProxy/Record.pm [moved from util/TLSProxy/Record.pm with 100% similarity]
util/perl/TLSProxy/ServerHello.pm [moved from util/TLSProxy/ServerHello.pm with 100% similarity]
util/perl/TLSProxy/ServerKeyExchange.pm [moved from util/TLSProxy/ServerKeyExchange.pm with 100% similarity]
util/perl/checkhandshake.pm [moved from test/testlib/checkhandshake.pm with 100% similarity]
util/perl/with_fallback.pm [moved from util/with_fallback.pm with 83% similarity]

index 61b86c49219bd691f80a3b600f396ce12050d5a6..ada1472b247abff3e421a7b73ac6febd4e43977b 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -12,6 +12,8 @@
 use 5.10.0;
 use strict;
 use Config;
+use FindBin;
+use lib "$FindBin::Bin/util/perl";
 use File::Basename;
 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
 use File::Path qw/mkpath/;
@@ -1384,7 +1386,6 @@ my %unified_info = ();
 
 my $buildinfo_debug = defined($ENV{CONFIGURE_DEBUG_BUILDINFO});
 if ($builder eq "unified") {
-    use lib catdir(dirname(__FILE__),"util");
     use with_fallback qw(Text::Template);
 
     sub cleandir {
@@ -1512,8 +1513,10 @@ if ($builder eq "unified") {
         my %generate = ();
 
         push @{$config{build_infos}}, catfile(abs2rel($sourced, $blddir), $f);
-        my $template = Text::Template->new(TYPE => 'FILE',
-                                           SOURCE => catfile($sourced, $f));
+        my $template =
+            Text::Template->new(TYPE => 'FILE',
+                                SOURCE => catfile($sourced, $f),
+                                PREPEND => qq{use lib "$FindBin::Bin/util/perl";});
         die "Something went wrong with $sourced/$f: $!\n" unless $template;
         my @text =
             split /^/m,
index fd785b7bc687bc1c8ff987fec8669db54c14cadf..47a328c80dd2e5822291a0db4ac6785919d5dd5b 100644 (file)
@@ -22,7 +22,7 @@ BEGIN {
     OpenSSL::Test::setup("no_test_here");
 }
 
-use lib srctop_dir("util");  # for with_fallback
+use lib srctop_dir("util", "perl");  # for with_fallback
 use lib srctop_dir("test", "ssl-tests");  # for ssltests_base
 
 use with_fallback qw(Text::Template);
index de351903a5b575f193ed8d9882a41a49756b4e13..f86e50988e2e07209dcf3b8a733152a0ac2732e3 100644 (file)
@@ -120,7 +120,7 @@ sub test_conf {
 
       skip 'failure', 2 unless
         ok(run(perltest(["generate_ssl_tests.pl", $input_file],
-                        interpreter_args => [ "-I", srctop_dir("test", "testlib")],
+                        interpreter_args => [ "-I", srctop_dir("util", "perl")],
                         stdout => $tmp_file)),
            "Getting output from generate_ssl_tests.pl.");
 
index 1a308e20b87735fad088c98ef49e729644d0efff..fb0b766ce7ded1367d31a8af698f54637b45a576 100644 (file)
@@ -12,7 +12,6 @@ use warnings;
 
 use File::Compare qw/compare_text/;
 use File::Copy;
-use lib 'testlib';
 use OpenSSL::Test qw/:DEFAULT/;
 
 my %conversionforms = (
index 1695729e817090300c80287ca06582214df1cca0..1171eec2f75ed1280018b5ffa057174a95946990 100644 (file)
@@ -25,12 +25,11 @@ my $TAP_Harness = can_load(modules => { 'TAP::Harness' => undef })
 my $srctop = $ENV{SRCTOP} || $ENV{TOP};
 my $bldtop = $ENV{BLDTOP} || $ENV{TOP};
 my $recipesdir = catdir($srctop, "test", "recipes");
-my $testlib = catdir($srctop, "test", "testlib");
-my $utillib = catdir($srctop, "util");
+my $libdir = rel2abs(catdir($srctop, "util", "perl"));
 
 my %tapargs =
     ( verbosity => $ENV{VERBOSE} || $ENV{V} || $ENV{HARNESS_VERBOSE} ? 1 : 0,
-      lib       => [ $testlib, $utillib ],
+      lib       => [ $libdir ],
       switches  => '-w',
       merge     => 1
     );
index 0d05574667e463758f91f0da42ca63d58356027b..36827e350ae5c6226b09a032d03e1a32ff2ad660 100644 (file)
@@ -14,6 +14,7 @@
 use strict;
 use warnings;
 
+use FindBin;
 use Getopt::Std;
 
 # We actually expect to get the following hash tables from configdata:
@@ -38,7 +39,7 @@ package OpenSSL::Template;
 # a fallback in case it's not installed on the system
 use File::Basename;
 use File::Spec::Functions;
-use lib catdir(dirname(__FILE__));
+use lib "$FindBin::Bin/perl";
 use with_fallback qw(Text::Template);
 
 #use parent qw/Text::Template/;
@@ -175,7 +176,10 @@ my $text =
 # Load the full template (combination of files) into Text::Template
 # and fill it up with our data.  Output goes directly to STDOUT
 
-my $template = OpenSSL::Template->new(TYPE => 'STRING', SOURCE => $text );
+my $template =
+    OpenSSL::Template->new(TYPE => 'STRING',
+                           SOURCE => $text,
+                           PREPEND => qq{use lib "$FindBin::Bin/perl";});
 
 sub output_reset_on {
     $template->output_reset_on();
similarity index 83%
rename from util/with_fallback.pm
rename to util/perl/with_fallback.pm
index b6deb2092e967439524fcfb6a5519db31e91c9d8..2af1d5fbd50d08fd5c77f9fb2308cb2f835a214e 100644 (file)
@@ -13,7 +13,8 @@ sub import {
     foreach (@_) {
        eval "require $_";
        if ($@) {
-           unshift @INC, catdir(dirname(__FILE__), "..", "external", "perl");
+           unshift @INC, catdir(dirname(__FILE__),
+                                 "..", "..", "external", "perl");
            my $transfer = "transfer::$_";
            eval "require $transfer";
            shift @INC;