[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Wed Mar 30 16:44:29 UTC 2016


The branch master has been updated
       via  3eefcea116b8143e99fbd9681ef8e364113c2d23 (commit)
       via  fbd361eaf84446e8d6860ab2b7ecf9d04585f2ef (commit)
       via  7d9b2d53a2ebef2414f7b79b1ba8a81f50bd9be9 (commit)
       via  b8fcd4f079121179f1511fbed5150209c798ce4d (commit)
      from  d2ec189fdd6d734c21d4067340cc96a0c4ce0595 (commit)


- Log -----------------------------------------------------------------
commit 3eefcea116b8143e99fbd9681ef8e364113c2d23
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Mar 29 19:43:33 2016 +0200

    When verbosity is requested, OpenSSL::Test::run() displays the command
    
    It displays the command's exit code as well.
    
    Reviewed-by: Emilia Käsper <emilia at openssl.org>

commit fbd361eaf84446e8d6860ab2b7ecf9d04585f2ef
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Mar 29 19:41:20 2016 +0200

    Have OpenSsl..Test::app() and friends look for file in source as well
    
    If the command file that app(), test(), perlapp(9 and perltest() are
    looking for doesn't exist in the build tree, look for it in the source
    tree as well.
    
    Reviewed-by: Emilia Käsper <emilia at openssl.org>

commit 7d9b2d53a2ebef2414f7b79b1ba8a81f50bd9be9
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Mar 29 19:38:30 2016 +0200

    Since OpenSSL::Test redirects stderr to /dev/null, don't do so in 80-test_ca.t
    
    Since OpenSSL::Test only redirects stderr to /dev/null when being run
    through non-verbose test harness, this change allows the stderr output
    to be displayed when verbosity is requested.
    
    Reviewed-by: Emilia Käsper <emilia at openssl.org>

commit b8fcd4f079121179f1511fbed5150209c798ce4d
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Mar 29 19:36:55 2016 +0200

    Add the option 'interpreter_args' to perlapps() and perltest()
    
    The intention with that option is to allow extra flags to the perl
    interpreter itself.
    
    Reviewed-by: Emilia Käsper <emilia at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 test/recipes/80-test_ca.t    |  8 +++----
 test/testlib/OpenSSL/Test.pm | 57 ++++++++++++++++++++++++++++++++++----------
 2 files changed, 49 insertions(+), 16 deletions(-)

diff --git a/test/recipes/80-test_ca.t b/test/recipes/80-test_ca.t
index 017c3db..983f8ce 100644
--- a/test/recipes/80-test_ca.t
+++ b/test/recipes/80-test_ca.t
@@ -19,20 +19,20 @@ plan tests => 4;
  SKIP: {
      $ENV{OPENSSL_CONFIG} = "-config ".srctop_file("test", "CAss.cnf");
      skip "failed creating CA structure", 3
-	 if !ok(run(perlapp(["CA.pl","-newca"], stdin => undef, stderr => undef)),
+	 if !ok(run(perlapp(["CA.pl","-newca"], stdin => undef)),
 		'creating CA structure');
 
      $ENV{OPENSSL_CONFIG} = "-config ".srctop_file("test", "Uss.cnf");
      skip "failed creating new certificate request", 2
-	 if !ok(run(perlapp(["CA.pl","-newreq"], stderr => undef)),
+	 if !ok(run(perlapp(["CA.pl","-newreq"])),
 		'creating CA structure');
 
      $ENV{OPENSSL_CONFIG} = "-config ".$std_openssl_cnf;
      skip "failed to sign certificate request", 1
-	 if !is(yes(cmdstr(perlapp(["CA.pl", "-sign"], stderr => undef))), 0,
+	 if !is(yes(cmdstr(perlapp(["CA.pl", "-sign"]))), 0,
 		'signing certificate request');
 
-     ok(run(perlapp(["CA.pl", "-verify", "newcert.pem"], stderr => undef)),
+     ok(run(perlapp(["CA.pl", "-verify", "newcert.pem"])),
 	'verifying new certificate');
 }
 
diff --git a/test/testlib/OpenSSL/Test.pm b/test/testlib/OpenSSL/Test.pm
index 2b0c050..c2b9f5c 100644
--- a/test/testlib/OpenSSL/Test.pm
+++ b/test/testlib/OpenSSL/Test.pm
@@ -244,7 +244,23 @@ string PATH, I<or>, if the value is C<undef>, C</dev/null> or similar.
 =item B<perltest ARRAYREF, OPTS>
 
 Both these functions function the same way as B<app> and B<test>, except
-that they expect the command to be a perl script.
+that they expect the command to be a perl script.  Also, they support one
+more option:
+
+=over 4
+
+=item B<interpreter_args =E<gt> ARRAYref>
+
+The array reference is a set of arguments for perl rather than the script.
+Take care so that none of them can be seen as a script!  Flags and their
+eventual arguments only!
+
+=back
+
+An example:
+
+  ok(run(perlapp(["foo.pl", "arg1"],
+                 interpreter_args => [ "-I", srctop_dir("test") ])));
 
 =back
 
@@ -338,6 +354,9 @@ sub run {
 	$r = $hooks{exit_checker}->($e);
     }
 
+    print STDERR "$prefix$cmd => $e\n"
+        if !$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE};
+
     # At this point, $? stops being interesting, and unfortunately,
     # there are Test::More versions that get picky if we leave it
     # non-zero.
@@ -626,9 +645,11 @@ failures will result in a C<BAIL_OUT> at the end of its run.
 sub __env {
     $directories{SRCTOP}  = $ENV{SRCTOP} || $ENV{TOP};
     $directories{BLDTOP}  = $ENV{BLDTOP} || $ENV{TOP};
-    $directories{APPS}    = $ENV{BIN_D}  || __bldtop_dir("apps");
-    $directories{TEST}    = $ENV{TEST_D} || __bldtop_dir("test");
-    $directories{RESULTS} = $ENV{RESULT_D} || $directories{TEST};
+    $directories{BLDAPPS} = $ENV{BIN_D}  || __bldtop_dir("apps");
+    $directories{SRCAPPS} =                 __srctop_dir("apps");
+    $directories{BLDTEST} = $ENV{TEST_D} || __bldtop_dir("test");
+    $directories{SRCTEST} =                 __srctop_dir("test");
+    $directories{RESULTS} = $ENV{RESULT_D} || $directories{BLDTEST};
 
     $end_with_bailout	  = $ENV{STOPTEST} ? 1 : 0;
 };
@@ -663,28 +684,36 @@ sub __test_file {
     BAIL_OUT("Must run setup() first") if (! $test_name);
 
     my $f = pop;
-    return catfile($directories{TEST}, at _,$f);
+    $f = catfile($directories{BLDTEST}, at _,$f);
+    $f = catfile($directories{SRCTEST}, at _,$f) unless -x $f;
+    return $f;
 }
 
 sub __perltest_file {
     BAIL_OUT("Must run setup() first") if (! $test_name);
 
     my $f = pop;
-    return ($^X, catfile($directories{TEST}, at _,$f));
+    $f = catfile($directories{BLDTEST}, at _,$f);
+    $f = catfile($directories{SRCTEST}, at _,$f) unless -f $f;
+    return ($^X, $f);
 }
 
 sub __apps_file {
     BAIL_OUT("Must run setup() first") if (! $test_name);
 
     my $f = pop;
-    return catfile($directories{APPS}, at _,$f);
+    $f = catfile($directories{BLDAPPS}, at _,$f);
+    $f = catfile($directories{SRCAPPS}, at _,$f) unless -x $f;
+    return $f;
 }
 
 sub __perlapps_file {
     BAIL_OUT("Must run setup() first") if (! $test_name);
 
     my $f = pop;
-    return ($^X, catfile($directories{APPS}, at _,$f));
+    $f = catfile($directories{BLDAPPS}, at _,$f);
+    $f = catfile($directories{SRCAPPS}, at _,$f) unless -f $f;
+    return ($^X, $f);
 }
 
 sub __results_file {
@@ -741,9 +770,11 @@ sub __cwd {
 
     if ($debug) {
 	print STDERR "DEBUG: __cwd(), directories and files:\n";
-	print STDERR "  \$directories{TEST}    = \"$directories{TEST}\"\n";
+	print STDERR "  \$directories{BLDTEST} = \"$directories{BLDTEST}\"\n";
+	print STDERR "  \$directories{SRCTEST} = \"$directories{SRCTEST}\"\n";
 	print STDERR "  \$directories{RESULTS} = \"$directories{RESULTS}\"\n";
-	print STDERR "  \$directories{APPS}    = \"$directories{APPS}\"\n";
+	print STDERR "  \$directories{BLDAPPS} = \"$directories{BLDAPPS}\"\n";
+	print STDERR "  \$directories{SRCAPPS} = \"$directories{SRCAPPS}\"\n";
 	print STDERR "  \$directories{SRCTOP}  = \"$directories{SRCTOP}\"\n";
 	print STDERR "  \$directories{BLDTOP}  = \"$directories{BLDTOP}\"\n";
 	print STDERR "\n";
@@ -801,6 +832,7 @@ sub __build_cmd {
     my $path_builder = shift;
     # Make a copy to not destroy the caller's array
     my @cmdarray = ( @{$_[0]} ); shift;
+    my %opts = @_;
 
     # We do a little dance, as $path_builder might return a list of
     # more than one.  If so, only the first is to be considered a
@@ -820,8 +852,9 @@ sub __build_cmd {
 	}
     }
     my @args = (@prog, @cmdarray);
-
-    my %opts = @_;
+    if (defined($opts{interpreter_args})) {
+        unshift @args, @{$opts{interpreter_args}};
+    }
 
     return () if !$cmd;
 


More information about the openssl-commits mailing list