[openssl-commits] [openssl] OpenSSL_1_1_0-stable update
Richard Levitte
levitte at openssl.org
Mon Feb 13 04:07:07 UTC 2017
The branch OpenSSL_1_1_0-stable has been updated
via b67a37b84674881226bb96709239a7e5945bc480 (commit)
from 1d2a18ec34fb9f2fbdaa1a28e89f1eff1654a45f (commit)
- Log -----------------------------------------------------------------
commit b67a37b84674881226bb96709239a7e5945bc480
Author: Richard Levitte <levitte at openssl.org>
Date: Fri Feb 10 22:50:24 2017 +0100
test_rehash does nothing, have it do something
test/recipes/40-test_rehash.t uses test files from certs/demo, which
doesn't exist any longer. Have it use PEM files from test/ instead.
Because rehash wants only one certificate or CRL per file, we must
also filter those PEM files to produce test files with a single object
each.
Reviewed-by: Rich Salz <rsalz at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2594)
(cherry picked from commit 4bbd8a5daaa810c487f684971c0339a1d7c15da9)
-----------------------------------------------------------------------
Summary of changes:
test/recipes/40-test_rehash.t | 41 ++++++++++++++++++++++++++++++++---------
1 file changed, 32 insertions(+), 9 deletions(-)
diff --git a/test/recipes/40-test_rehash.t b/test/recipes/40-test_rehash.t
index fa05ca0..f902c23 100644
--- a/test/recipes/40-test_rehash.t
+++ b/test/recipes/40-test_rehash.t
@@ -14,7 +14,7 @@ use File::Spec::Functions;
use File::Copy;
use File::Basename;
use if $^O ne "VMS", 'File::Glob' => qw/glob/;
-use OpenSSL::Test qw/:DEFAULT bldtop_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_rehash");
@@ -58,16 +58,39 @@ indir "rehash.$$" => sub {
}, create => 1, cleanup => 1;
sub prepare {
- my @sourcefiles =
- sort map { glob(bldtop_file('certs', 'demo', "*.$_")) } ('pem',
- 'crt',
- 'cer',
- 'crl');
+ my @pemsourcefiles = sort glob(srctop_file('test', "*.pem"));
my @destfiles = ();
- foreach (@sourcefiles) {
- copy($_, curdir());
- push @destfiles, catfile(curdir(), basename($_));
+
+ die "There are no source files\n" if scalar @pemsourcefiles == 0;
+
+ my $cnt = 0;
+ foreach (@pemsourcefiles) {
+ my $basename = basename($_, ".pem");
+ my $writing = 0;
+
+ open PEM, $_ or die "Can't read $_: $!\n";
+ while (my $line = <PEM>) {
+ if ($line =~ m{^-----BEGIN (?:CERTIFICATE|X509 CRL)-----}) {
+ die "New start in a PEM blob?\n" if $writing;
+ $cnt++;
+ my $destfile =
+ catfile(curdir(),
+ $basename . sprintf("-%02d", $cnt) . ".pem");
+ push @destfiles, $destfile;
+ open OUT, '>', $destfile
+ or die "Can't write $destfile\n";
+ $writing = 1;
+ }
+ print OUT $line if $writing;
+ if ($line =~ m|^-----END |) {
+ close OUT if $writing;
+ $writing = 0;
+ }
+ }
+ die "No end marker in $basename\n" if $writing;
}
+ die "No test PEM files produced\n" if $cnt == 0;
+
foreach (@_) {
die "Internal error, argument is not CODE"
unless (ref($_) eq 'CODE');
More information about the openssl-commits
mailing list