diff options
author | Richard Levitte <levitte@openssl.org> | 2018-03-26 11:00:05 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2018-03-31 16:36:49 +0200 |
commit | cde87deafa7486f26bdf954867a6d72ca4ea06e7 (patch) | |
tree | 4eb56ed77427de61ccf06c6592a5c9897d141660 /util | |
parent | df5caeff335877b25a02c40a84935c7c4584e396 (diff) |
Refuse to run test_cipherlist unless shared library matches build
test/cipherlist_test.c is an internal consistency check, and therefore
requires that the shared library it runs against matches what it was
built for. test/recipes/test_cipherlist.t is made to refuse running
unless library version and build version match.
This adds a helper program test/versions.c, that simply displays the
library and the build version.
Partially fixes #5751
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5753)
Diffstat (limited to 'util')
-rw-r--r-- | util/perl/OpenSSL/Test.pm | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/util/perl/OpenSSL/Test.pm b/util/perl/OpenSSL/Test.pm index 5de7b58e8b..a6be487895 100644 --- a/util/perl/OpenSSL/Test.pm +++ b/util/perl/OpenSSL/Test.pm @@ -21,7 +21,8 @@ $VERSION = "0.8"; @EXPORT_OK = (@Test::More::EXPORT_OK, qw(bldtop_dir bldtop_file srctop_dir srctop_file data_file - pipe with cmdstr quotify)); + pipe with cmdstr quotify + openssl_versions)); =head1 NAME @@ -695,6 +696,32 @@ sub quotify { return map { $arg_formatter->($_) } @_; } +=over 4 + +=item B<openssl_versions> + +Returns a list of two numbers, the first representing the build version, +the second representing the library version. See opensslv.h for more +information on those numbers. + += back + +=cut + +my @versions = (); +sub openssl_versions { + unless (@versions) { + my %lines = + map { s/\R$//; + /^(.*): (0x[[:xdigit:]]{8})$/; + die "Weird line: $_" unless defined $1; + $1 => hex($2) } + run(test(['versions']), capture => 1); + @versions = ( $lines{'Build version'}, $lines{'Library version'} ); + } + return @versions; +} + ###################################################################### # private functions. These are never exported. |