[openssl] master update
Richard Levitte
levitte at openssl.org
Thu Feb 27 07:51:27 UTC 2020
The branch master has been updated
via 30a4cda5e0c67b4e77da4f21b7c5f27991d3367a (commit)
via c3845ceba84aab9ddeb43f043549238fd10de63b (commit)
via 285e2991af23974761b9497f1e2a3396aa4bc440 (commit)
from f33ca114c1f8a1ea07948fec6e175806d69274ef (commit)
- Log -----------------------------------------------------------------
commit 30a4cda5e0c67b4e77da4f21b7c5f27991d3367a
Author: Richard Levitte <levitte at openssl.org>
Date: Tue Feb 18 08:25:06 2020 +0100
Replace util/shlib_wrap.sh with util/wrap.pl in diverse docs
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/11110)
commit c3845ceba84aab9ddeb43f043549238fd10de63b
Author: Richard Levitte <levitte at openssl.org>
Date: Mon Feb 17 15:20:57 2020 +0100
Build file templates: don't set OPENSSL_{ENGINES,MODULES}
Since we've now switched to use util/wrap.pl to wrap uninstalled
programs everywhere, there's no need to set the environment variables
OPENSSL_ENGINES and OPENSSL_MODULES globally for the tests.
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/11110)
commit 285e2991af23974761b9497f1e2a3396aa4bc440
Author: Richard Levitte <levitte at openssl.org>
Date: Mon Feb 17 15:05:04 2020 +0100
TEST: add util/wrap.pl and use it
util/wrap.pl is a script that defines the environment variables
OPENSSL_ENGINES and OPENSSL_MODULES, then calls the command line
that's given as its arguments.
On a POSIX platform, the command line call is done via
util/shlib_wrap.sh to ensure that the shared library paths are
correct. For other platforms, util/wrap.pl currently assumes that
similar things are already in place through other means.
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/11110)
-----------------------------------------------------------------------
Summary of changes:
Configurations/descrip.mms.tmpl | 19 +++++++++++-----
Configurations/unix-Makefile.tmpl | 8 +++----
Configurations/windows-makefile.tmpl | 14 ++++++++----
INSTALL.md | 2 +-
NOTES.VALGRIND | 12 +++++-----
test/README.ssltest.md | 2 +-
util/perl/OpenSSL/Test.pm | 30 ++++++++++++++++++++-----
util/wrap.pl | 43 ++++++++++++++++++++++++++++++++++++
8 files changed, 101 insertions(+), 29 deletions(-)
create mode 100755 util/wrap.pl
diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl
index 5b2936dea0..bf22e40dc4 100644
--- a/Configurations/descrip.mms.tmpl
+++ b/Configurations/descrip.mms.tmpl
@@ -351,6 +351,9 @@ CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags2.$cppflags1) =~ s|"|""|g;
# given with /INCLUDE is a fantasy, unfortunately.
NODEBUG=@
.FIRST :
+ $(NODEBUG) sourcetop = F$PARSE("$(SRCDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
+ $(NODEBUG) DEFINE ossl_sourceroot 'sourcetop'
+ $(NODEBUG) !
$(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
$(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
$(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
@@ -401,7 +404,7 @@ NODEBUG=@
# The main targets ###################################################
-{- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
+{- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep copy-utils
{- dependmagic('build_libs'); -} : build_libs_nodep
{- dependmagic('build_modules'); -} : build_modules_nodep
{- dependmagic('build_programs'); -} : build_programs_nodep
@@ -429,16 +432,12 @@ build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs
all : build_sw build_docs
test : tests
-{- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep
+{- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep copy-utils
@ ! {- output_off() if $disabled{tests}; "" -}
DEFINE SRCTOP {- sourcedir() -}
DEFINE BLDTOP {- builddir() -}
- DEFINE OPENSSL_ENGINES {- builddir("engines") -}
- DEFINE OPENSSL_MODULES {- builddir("providers") -}
IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
$(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
- DEASSIGN OPENSSL_MODULES
- DEASSIGN OPENSSL_ENGINES
DEASSIGN BLDTOP
DEASSIGN SRCTOP
@ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
@@ -684,6 +683,14 @@ check_INSTALLTOP :
# Helper targets #####################################################
+copy-utils : [.util]wrap.pl
+
+[.util]wrap.pl : configdata.pm
+ @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
+ CREATE/DIR/LOG [.util]
+ @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
+ COPY/LOG ossl_sourceroot:[util]wrap.pl [.util]
+
# Developer targets ##################################################
debug_logicals :
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index 51ba10f62a..ac24687609 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -468,8 +468,6 @@ test: tests
BLDTOP=$(BLDDIR) \
PERL="$(PERL)" \
EXE_EXT={- platform->binext() -} \
- OPENSSL_ENGINES=`cd $(BLDDIR)/engines 2>/dev/null && pwd` \
- OPENSSL_MODULES=`cd $(BLDDIR)/providers 2>/dev/null && pwd` \
$(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) )
@ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
@echo "Tests are not supported with your chosen Configure options"
@@ -1080,12 +1078,12 @@ tar:
# Helper targets #####################################################
-link-utils: $(BLDDIR)/util/opensslwrap.sh
+link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl
-$(BLDDIR)/util/opensslwrap.sh: configdata.pm
+$(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl: configdata.pm
@if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
mkdir -p "$(BLDDIR)/util"; \
- ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
+ ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \
fi
FORCE:
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index afc386daec..859d3a6324 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -357,7 +357,7 @@ PROCESSOR= {- $config{processor} -}
# The main targets ###################################################
-{- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep
+{- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep copy-utils
{- dependmagic('build_libs'); -}: build_libs_nodep
{- dependmagic('build_modules'); -}: build_modules_nodep
{- dependmagic('build_programs'); -}: build_programs_nodep
@@ -385,13 +385,11 @@ build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
all: build_sw build_docs
test: tests
-{- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep
+{- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep copy-utils
@{- output_off() if $disabled{tests}; "" -}
set SRCTOP=$(SRCDIR)
set BLDTOP=$(BLDDIR)
set PERL=$(PERL)
- set OPENSSL_ENGINES=$(MAKEDIR)\engines
- set OPENSSL_MODULES=$(MAKEDIR)\providers
"$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)
@{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
@$(ECHO) "Tests are not supported with your chosen Configure options"
@@ -544,6 +542,14 @@ install_html_docs: build_html_docs
uninstall_html_docs:
+# Helper targets #####################################################
+
+copy-utils: $(BLDDIR)\util\wrap.pl
+
+$(BLDDIR)\util\wrap.pl: configdata.pm
+ @if NOT EXIST "$(BLDDIR)\util" mkdir "$(BLDDIR)\util"
+ @if NOT "$(SRCDIR)"=="$(BLDDIR)" copy "$(SRCDIR)\util\$(@F)" "$(BLDDIR)\util"
+
# Building targets ###################################################
configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
diff --git a/INSTALL.md b/INSTALL.md
index 01726a16ab..8eefeb306d 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -1545,7 +1545,7 @@ Run all tests in test groups 80 to 99 except for tests in group 90:
To stochastically verify that the algorithm that produces uniformly distributed
random numbers is operating correctly (with a false positive rate of 0.01%):
- $ ./util/shlib_wrap.sh test/bntest -stochastic
+ $ ./util/wrap.sh test/bntest -stochastic
Troubleshooting
===============
diff --git a/NOTES.VALGRIND b/NOTES.VALGRIND
index f128927c1a..afbb71e4ae 100644
--- a/NOTES.VALGRIND
+++ b/NOTES.VALGRIND
@@ -28,11 +28,11 @@ Test behavior can be modified by adjusting environment variables.
EXE_SHELL
This variable is used to specify the shell used to execute OpenSSL test
-programs. The default program (util/shlib_wrap.sh) initializes the
-environment to allow programs to find shared libraries. The variable can
-be modified to specify a different executable environment.
+programs. The default wrapper (util/wrap.pl) initializes the environment
+to allow programs to find shared libraries. The variable can be modified
+to specify a different executable environment.
- EXE_SHELL="`/bin/pwd`/util/shlib_wrap.sh valgrind --error-exitcode=1 --leak-check=full -q"
+ EXE_SHELL="`/bin/pwd`/util/wrap.pl valgrind --error-exitcode=1 --leak-check=full -q"
This will start up Valgrind with the default checker (memcheck).
The --error-exitcode=1 option specifies that Valgrind should exit with an
@@ -62,9 +62,9 @@ INSTALL file in the root of the OpenSSL source tree.
Example command line:
- make test EXE_SHELL="`/bin/pwd`/util/shlib_wrap.sh valgrind --error-exitcode=1 --leak-check=full -q" OPENSSL_ia32cap=":0"
+ make test EXE_SHELL="`/bin/pwd`/util/wrap.pl valgrind --error-exitcode=1 --leak-check=full -q" OPENSSL_ia32cap=":0"
If an error occurs, you can then run the specific test via the TESTS
variable with the VERBOSE option to gather additional information.
- make test VERBOSE=1 TESTS=test_test EXE_SHELL="`/bin/pwd`/util/shlib_wrap.sh valgrind --error-exitcode=1 --leak-check=full -q" OPENSSL_ia32cap=":0"
+ make test VERBOSE=1 TESTS=test_test EXE_SHELL="`/bin/pwd`/util/wrap.pl valgrind --error-exitcode=1 --leak-check=full -q" OPENSSL_ia32cap=":0"
diff --git a/test/README.ssltest.md b/test/README.ssltest.md
index 3b4bb564f1..30360f7652 100644
--- a/test/README.ssltest.md
+++ b/test/README.ssltest.md
@@ -281,7 +281,7 @@ or for shared builds
```
$ CTLOG_FILE=test/ct/log_list.conf TEST_CERTS_DIR=test/certs \
- util/shlib_wrap.sh test/ssl_test test/ssl-tests/01-simple.conf
+ util/wrap.pl test/ssl_test test/ssl-tests/01-simple.conf
```
Note that the test expectations sometimes depend on the Configure settings. For
diff --git a/util/perl/OpenSSL/Test.pm b/util/perl/OpenSSL/Test.pm
index 4297106392..bb39854a4d 100644
--- a/util/perl/OpenSSL/Test.pm
+++ b/util/perl/OpenSSL/Test.pm
@@ -1178,13 +1178,31 @@ sub __wrap_cmd {
my $cmd = shift;
my $exe_shell = shift;
- my @prefix = ( __bldtop_file("util", "shlib_wrap.sh") );
+ my @prefix = ();
- if(defined($exe_shell)) {
- @prefix = ( $exe_shell );
- } elsif ($^O eq "VMS" || $^O eq "MSWin32") {
- # VMS and Windows don't use any wrapper script for the moment
- @prefix = ();
+ if (defined($exe_shell)) {
+ # If $exe_shell is defined, trust it
+ @prefix = ( $exe_shell );
+ } else {
+ # Otherwise, use the standard wrapper
+ my $std_wrapper = __bldtop_file("util", "wrap.pl");
+
+ if ($^O eq "VMS") {
+ # On VMS, running random executables without having a command
+ # symbol means running them with the MCR command. This is an
+ # old PDP-11 command that stuck around. So we get a command
+ # running perl running the script.
+ @prefix = ( "MCR", $^X, $std_wrapper );
+ } elsif ($^O eq "MSWin32") {
+ # In the Windows case, we run perl explicitly. We might not
+ # need it, but that depends on if the user has associated the
+ # '.pl' extension with a perl interpreter, so better be safe.
+ @prefix = ( $^X, $std_wrapper );
+ } else {
+ # Otherwise, we assume Unix semantics, and trust that the #!
+ # line activates perl for us.
+ @prefix = ( $std_wrapper );
+ }
}
return (@prefix, $cmd);
diff --git a/util/wrap.pl b/util/wrap.pl
new file mode 100755
index 0000000000..1c3b4e7c29
--- /dev/null
+++ b/util/wrap.pl
@@ -0,0 +1,43 @@
+#! /usr/bin/env perl
+
+use strict;
+use warnings;
+
+use File::Basename;
+use File::Spec::Functions;
+
+my $there = canonpath(catdir(dirname($0), updir()));
+my $std_engines = catdir($there, 'engines');
+my $std_providers = catdir($there, 'providers');
+my $unix_shlib_wrap = catfile($there, 'util/shlib_wrap.sh');
+
+$ENV{OPENSSL_ENGINES} = $std_engines
+ if ($ENV{OPENSSL_ENGINES} // '') eq '' && -d $std_engines;
+$ENV{OPENSSL_MODULES} = $std_providers
+ if ($ENV{OPENSSL_MODULES} // '') eq '' && -d $std_providers;
+
+my $use_system = 0;
+my @cmd;
+
+if (($ENV{EXE_SHELL} // '') ne '') {
+ # We don't know what $ENV{EXE_SHELL} contains, so we must use the one
+ # string form to ensure that exec invokes a shell as needed.
+ @cmd = ( join(' ', $ENV{EXE_SHELL}, @ARGV) );
+} elsif (-x $unix_shlib_wrap) {
+ @cmd = ( $unix_shlib_wrap, @ARGV );
+} else {
+ # Hope for the best
+ @cmd = ( @ARGV );
+}
+
+# The exec() statement on MSWin32 doesn't seem to give back the exit code
+# from the call, so we resort to using system() instead.
+my $waitcode = system @cmd;
+
+# According to documentation, -1 means that system() couldn't run the command,
+# otherwise, the value is similar to the Unix wait() status value
+# (exitcode << 8 | signalcode)
+die "wrap.pl: Failed to execute '", join(' ', @cmd), "': $!\n"
+ if $waitcode == -1;
+exit($? & 255) if ($? & 255) != 0;
+exit($? >> 8);
More information about the openssl-commits
mailing list