[openssl-commits] [openssl] master update
Dr. Stephen Henson
steve at openssl.org
Sat Sep 19 23:06:44 UTC 2015
The branch master has been updated
via 54180592d7259382bd6ed1198cdbcb0b3be50749 (commit)
via 01d524fa039ebc2e59212bd1211a8c6058657fc4 (commit)
via 340166a9da47305e30eb8a0be09e4d4491233269 (commit)
via 0d297b42b5902ab207eb066caa1f5d39714959e8 (commit)
from f5349f8ca5b019f66b792be429b22dda6b822e44 (commit)
- Log -----------------------------------------------------------------
commit 54180592d7259382bd6ed1198cdbcb0b3be50749
Author: Dr. Stephen Henson <steve at openssl.org>
Date: Sat Sep 19 23:50:02 2015 +0100
typo
Reviewed-by: Richard Levitte <levitte at openssl.org>
commit 01d524fa039ebc2e59212bd1211a8c6058657fc4
Author: Dr. Stephen Henson <steve at openssl.org>
Date: Sat Sep 19 23:49:26 2015 +0100
Update Simple.pm to use disabled()
Reviewed-by: Richard Levitte <levitte at openssl.org>
commit 340166a9da47305e30eb8a0be09e4d4491233269
Author: Dr. Stephen Henson <steve at openssl.org>
Date: Sat Sep 19 22:19:14 2015 +0100
Change test recipes to use disabled()
Reviewed-by: Richard Levitte <levitte at openssl.org>
commit 0d297b42b5902ab207eb066caa1f5d39714959e8
Author: Dr. Stephen Henson <steve at openssl.org>
Date: Sat Sep 19 17:10:34 2015 +0100
Add Utils.pm
Add Utils.pm for test utilities. This currently just contains one function:
disabled which checks if a feature is disabled based on the output of
openssl list -disabled
Reviewed-by: Richard Levitte <levitte at openssl.org>
-----------------------------------------------------------------------
Summary of changes:
test/recipes/15-test_dsa.t | 3 +-
test/recipes/15-test_ec.t | 3 +-
test/recipes/15-test_rsa.t | 3 +-
test/recipes/25-test_gen.t | 3 +-
test/recipes/80-test_cms.t | 10 ++---
test/recipes/80-test_ssl.t | 24 ++++++-----
test/testlib/OpenSSL/Test/Simple.pm | 5 ++-
test/testlib/OpenSSL/Test/Utils.pm | 84 +++++++++++++++++++++++++++++++++++++
8 files changed, 113 insertions(+), 22 deletions(-)
create mode 100644 test/testlib/OpenSSL/Test/Utils.pm
diff --git a/test/recipes/15-test_dsa.t b/test/recipes/15-test_dsa.t
index e338b0b..5a1917d 100644
--- a/test/recipes/15-test_dsa.t
+++ b/test/recipes/15-test_dsa.t
@@ -5,6 +5,7 @@ use warnings;
use File::Spec;
use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test::Utils;
setup("test_dsa");
@@ -17,7 +18,7 @@ ok(run(test(["dsatest", "-app2_1"])), "running dsatest -app2_1");
SKIP: {
skip "Skipping dsa conversion test", 3
- if run(app(["openssl","no-dsa"], stdout => undef));
+ if disabled("dsa");
subtest 'dsa conversions -- private key' => sub {
tconversion("dsa", top_file("test","testdsa.pem"));
diff --git a/test/recipes/15-test_ec.t b/test/recipes/15-test_ec.t
index bbda19a..4701dc8 100644
--- a/test/recipes/15-test_ec.t
+++ b/test/recipes/15-test_ec.t
@@ -5,6 +5,7 @@ use warnings;
use File::Spec;
use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test::Utils;
setup("test_ec");
@@ -16,7 +17,7 @@ ok(run(test(["ectest"])), "running ectest");
SKIP: {
skip "Skipping ec conversion test", 3
- if run(app(["openssl","no-ec"], stdout => undef));
+ if disabled("ec");
subtest 'ec conversions -- private key' => sub {
tconversion("ec", top_file("test","testec-p256.pem"));
diff --git a/test/recipes/15-test_rsa.t b/test/recipes/15-test_rsa.t
index 2eaeb0d..6418ff7 100644
--- a/test/recipes/15-test_rsa.t
+++ b/test/recipes/15-test_rsa.t
@@ -5,6 +5,7 @@ use warnings;
use File::Spec;
use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test::Utils;
setup("test_rsa");
@@ -16,7 +17,7 @@ ok(run(test(["rsa_test"])), "running rsatest");
SKIP: {
skip "Skipping rsa conversion test", 3
- if run(app(["openssl","no-rsa"], stdout => undef));
+ if disabled("rsa");
subtest 'rsa conversions -- private key' => sub {
tconversion("rsa", top_file("test","testrsa.pem"));
diff --git a/test/recipes/25-test_gen.t b/test/recipes/25-test_gen.t
index 9427bde..dc8ca6a 100644
--- a/test/recipes/25-test_gen.t
+++ b/test/recipes/25-test_gen.t
@@ -5,6 +5,7 @@ use warnings;
use File::Spec;
use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test::Utils;
setup("test_gen");
@@ -21,7 +22,7 @@ close RND;
subtest "generating certificate requests" => sub {
my @req_new;
- if (run(app(["openssl", "no-rsa"], stdout => undef))) {
+ if (disabled("rsa")) {
@req_new = ("-newkey", "dsa:".top_file("apps", "dsa512.pem"));
} else {
@req_new = ("-new");
diff --git a/test/recipes/80-test_cms.t b/test/recipes/80-test_cms.t
index 29a08b9..079a4b2 100644
--- a/test/recipes/80-test_cms.t
+++ b/test/recipes/80-test_cms.t
@@ -7,14 +7,13 @@ use POSIX;
use File::Spec::Functions qw/catfile/;
use File::Compare qw/compare_text/;
use OpenSSL::Test qw/:DEFAULT top_dir top_file/;
+use OpenSSL::Test::Utils;
setup("test_cms");
my $smdir = top_dir("test", "smime-certs");
my $smcont = top_file("test", "smcont.txt");
-my $no_ec = run(app(["openssl", "no-ec"], stdout => undef));
-my $no_ec2m = run(app(["openssl", "no-ec2m"], stdout => undef));
-my $no_ecdh = run(app(["openssl", "no-ecdh"], stdout => undef));
+my ($no_ec, $no_ec2m, $no_zlib) = disabled qw/ec ec2m zlib/;
plan tests => 4;
@@ -442,8 +441,7 @@ subtest "CMS <=> CMS consistency tests, modified key parameters\n" => sub {
SKIP: {
skip("Zlib not supported: compression tests skipped",
scalar @smime_cms_comp_tests)
- unless grep /ZLIB/, run(app(["openssl", "version", "-f"]),
- capture => 1);
+ if $no_zlib;
foreach (@smime_cms_comp_tests) {
SKIP: {
@@ -469,7 +467,7 @@ sub check_availability {
return "$tnam: skipped, EC disabled\n"
if ($no_ec && $tnam =~ /ECDH/);
return "$tnam: skipped, ECDH disabled\n"
- if ($no_ecdh && $tnam =~ /ECDH/);
+ if ($no_ec && $tnam =~ /ECDH/);
return "$tnam: skipped, EC2M disabled\n"
if ($no_ec2m && $tnam =~ /K-283/);
return "";
diff --git a/test/recipes/80-test_ssl.t b/test/recipes/80-test_ssl.t
index 409e68f..f84425d 100644
--- a/test/recipes/80-test_ssl.t
+++ b/test/recipes/80-test_ssl.t
@@ -7,9 +7,13 @@ use POSIX;
use File::Spec;
use File::Copy;
use OpenSSL::Test qw/:DEFAULT with top_file cmdstr/;
+use OpenSSL::Test::Utils;
setup("test_ssl");
+my ($no_rsa, $no_dsa, $no_dh, $no_ec, $no_srp, $no_psk) =
+ disabled qw/rsa dsa dh ec srp psk/;
+
my $digest = "-sha1";
my @reqcmd = ("openssl", "req");
my @x509cmd = ("openssl", "x509", $digest);
@@ -94,7 +98,7 @@ sub testss {
my @req_dsa = ("-newkey",
"dsa:".File::Spec->catfile("..", "apps", "dsa1024.pem"));;
my @req_new;
- if (run(app(["openssl", "no-rsa"], stdout => undef))) {
+ if ($no_rsa) {
@req_new = @req_dsa;
} else {
@req_new = ("-new");
@@ -161,7 +165,7 @@ sub testss {
skip 'failure', 7 unless
subtest 'DSA certificate creation' => sub {
plan skip_all => "skipping DSA certificate creation"
- if run(app(["openssl", "no-dsa"], stdout => undef));
+ if $no_dsa;
plan tests => 4;
@@ -200,7 +204,7 @@ sub testss {
skip 'failure', 6 unless
subtest 'ECDSA/ECDH certificate creation' => sub {
plan skip_all => "skipping ECDSA/ECDH certificate creation"
- if run(app(["openssl", "no-ec"], stdout => undef));
+ if $no_ec;
plan tests => 5;
@@ -385,18 +389,18 @@ sub testssl {
my @exkeys = ();
my $ciphers = "-EXP:-PSK:-SRP:-kDH:-kECDHe";
- if (run(app(["openssl", "no-dhparam"], stdout => undef))) {
+ if ($no_dh) {
note "skipping DHE tests\n";
$ciphers .= ":-kDHE";
}
- if (run(app(["openssl", "no-dsa"], stdout => undef))) {
+ if ($no_dsa) {
note "skipping DSA tests\n";
$ciphers .= ":-aDSA";
} else {
push @exkeys, "-s_cert", "certD.ss", "-s_key", "keyD.ss";
}
- if (run(app(["openssl", "no-ec"], stdout => undef))) {
+ if ($no_ec) {
note "skipping EC tests\n";
$ciphers .= ":!aECDSA:!kECDH";
} else {
@@ -442,7 +446,7 @@ sub testssl {
{
SKIP: {
skip "skipping anonymous DH tests", 1
- if (run(app(["openssl", "no-dhparam"], stdout => undef)));
+ if ($no_dh);
ok(run(test([@ssltest, "-v", "-bio_pair", "-tls1", "-cipher", "ADH", "-dhe1024dsa", "-num", "10", "-f", "-time", @extra])),
'test tlsv1 with 1024bit anonymous DH, multiple handshakes');
@@ -452,13 +456,13 @@ sub testssl {
{
SKIP: {
skip "skipping RSA tests", 2
- if (run(app(["openssl", "no-rsa"], stdout => undef)));
+ if $no_rsa;
ok(run(test(["ssltest", "-v", "-bio_pair", "-tls1", "-s_cert", top_file("apps","server2.pem"), "-no_dhe", "-no_ecdhe", "-num", "10", "-f", "-time", @extra])),
'test tlsv1 with 1024bit RSA, no (EC)DHE, multiple handshakes');
skip "skipping RSA+DHE tests", 1
- if (run(app(["openssl", "no-dhparam"], stdout => undef)));
+ if $no_dh;
ok(run(test(["ssltest", "-v", "-bio_pair", "-tls1", "-s_cert", top_file("apps","server2.pem"), "-dhe1024dsa", "-num", "10", "-f", "-time", @extra])),
'test tlsv1 with 1024bit RSA, 1024bit DHE, multiple handshakes');
@@ -524,7 +528,7 @@ sub testssl {
{
SKIP: {
skip "skipping SRP tests", 4
- if run(app(["openssl", "no-srp"], stdout => undef));
+ if $no_srp;
ok(run(test([@ssltest, "-tls1", "-cipher", "SRP", "-srpuser", "test", "-srppass", "abc123"])),
'test tls1 with SRP');
diff --git a/test/testlib/OpenSSL/Test/Simple.pm b/test/testlib/OpenSSL/Test/Simple.pm
index 874a156..0637e3d 100644
--- a/test/testlib/OpenSSL/Test/Simple.pm
+++ b/test/testlib/OpenSSL/Test/Simple.pm
@@ -28,6 +28,7 @@ You could call them hacks if you wish.
=cut
use OpenSSL::Test;
+use OpenSSL::Test::Utils;
=over 4
@@ -58,7 +59,7 @@ sub simple_test {
plan tests => 1;
SKIP: {
skip "$algo is not supported by this OpenSSL build, skipping this test...", 1
- if $algo && run(app(["openssl", "no-$algo"]));
+ if $algo && disabled($algo);
ok(run(test([$prgr])), "running $prgr");
}
@@ -71,7 +72,7 @@ L<OpenSSL::Test>
=head1 AUTHORS
Richard Levitte E<lt>levitte at openssl.orgE<gt> with inspiration
-from Rich Salz E<lt>rsalz at openssl.org<gt>.
+from Rich Salz E<lt>rsalz at openssl.orgE<gt>.
=cut
diff --git a/test/testlib/OpenSSL/Test/Utils.pm b/test/testlib/OpenSSL/Test/Utils.pm
new file mode 100644
index 0000000..fc9b533
--- /dev/null
+++ b/test/testlib/OpenSSL/Test/Utils.pm
@@ -0,0 +1,84 @@
+package OpenSSL::Test::Utils;
+
+use strict;
+use warnings;
+
+use Exporter;
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+$VERSION = "0.1";
+ at ISA = qw(Exporter);
+ at EXPORT = qw(disabled);
+
+=head1 NAME
+
+OpenSSL::Test::Utils - test utility functions
+
+=head1 SYNOPSIS
+
+ use OpenSSL::Test::Utils;
+
+ disabled("dh");
+
+=head1 DESCRIPTION
+
+This module provides utility functions for the testing framework.
+
+=cut
+
+use OpenSSL::Test;
+
+=over 4
+
+=item B<disabled ARRAY>
+
+In a scalar context returns 1 if any of the features in ARRAY is disabled.
+
+In an array context returns an array with each element set to 1 if the
+corresponding feature is disabled and 0 otherwise.
+
+=back
+
+=cut
+
+our %disabled;
+my $disabled_set = 0;
+
+sub check_disabled {
+#print STDERR "Running check_disabled\n";
+ foreach (run(app(["openssl", "list", "-disabled"]), capture => 1)) {
+ chomp;
+ next if /:/; # skip header
+ $disabled{lc $_} = 1;
+ }
+ $disabled_set = 1;
+}
+
+# args:
+# list of features to check
+sub disabled {
+ check_disabled() unless $disabled_set;
+ if (wantarray) {
+ my @ret;
+ foreach (@_) {
+ push @ret, exists $disabled{lc $_} ? 1 : 0;
+ }
+ return @ret;
+ }
+ foreach (@_) {
+ return 1 if exists $disabled{lc $_};
+ }
+ return 0;
+}
+
+=head1 SEE ALSO
+
+L<OpenSSL::Test>
+
+=head1 AUTHORS
+
+Stephen Henson E<lt>steve at openssl.orgE<gt> with inspiration
+from Richard Levitte E<lt>levitte at openssl.orgE<gt>
+
+=cut
+
+1;
More information about the openssl-commits
mailing list