Change test recipes to use disabled()

Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Dr. Stephen Henson 2015-09-19 22:19:14 +01:00
parent 0d297b42b5
commit 340166a9da
6 changed files with 26 additions and 20 deletions

View File

@ -5,6 +5,7 @@ use warnings;
use File::Spec; use File::Spec;
use OpenSSL::Test qw/:DEFAULT top_file/; use OpenSSL::Test qw/:DEFAULT top_file/;
use OpenSSL::Test::Utils;
setup("test_dsa"); setup("test_dsa");
@ -17,7 +18,7 @@ ok(run(test(["dsatest", "-app2_1"])), "running dsatest -app2_1");
SKIP: { SKIP: {
skip "Skipping dsa conversion test", 3 skip "Skipping dsa conversion test", 3
if run(app(["openssl","no-dsa"], stdout => undef)); if disabled("dsa");
subtest 'dsa conversions -- private key' => sub { subtest 'dsa conversions -- private key' => sub {
tconversion("dsa", top_file("test","testdsa.pem")); tconversion("dsa", top_file("test","testdsa.pem"));

View File

@ -5,6 +5,7 @@ use warnings;
use File::Spec; use File::Spec;
use OpenSSL::Test qw/:DEFAULT top_file/; use OpenSSL::Test qw/:DEFAULT top_file/;
use OpenSSL::Test::Utils;
setup("test_ec"); setup("test_ec");
@ -16,7 +17,7 @@ ok(run(test(["ectest"])), "running ectest");
SKIP: { SKIP: {
skip "Skipping ec conversion test", 3 skip "Skipping ec conversion test", 3
if run(app(["openssl","no-ec"], stdout => undef)); if disabled("ec");
subtest 'ec conversions -- private key' => sub { subtest 'ec conversions -- private key' => sub {
tconversion("ec", top_file("test","testec-p256.pem")); tconversion("ec", top_file("test","testec-p256.pem"));

View File

@ -5,6 +5,7 @@ use warnings;
use File::Spec; use File::Spec;
use OpenSSL::Test qw/:DEFAULT top_file/; use OpenSSL::Test qw/:DEFAULT top_file/;
use OpenSSL::Test::Utils;
setup("test_rsa"); setup("test_rsa");
@ -16,7 +17,7 @@ ok(run(test(["rsa_test"])), "running rsatest");
SKIP: { SKIP: {
skip "Skipping rsa conversion test", 3 skip "Skipping rsa conversion test", 3
if run(app(["openssl","no-rsa"], stdout => undef)); if disabled("rsa");
subtest 'rsa conversions -- private key' => sub { subtest 'rsa conversions -- private key' => sub {
tconversion("rsa", top_file("test","testrsa.pem")); tconversion("rsa", top_file("test","testrsa.pem"));

View File

@ -5,6 +5,7 @@ use warnings;
use File::Spec; use File::Spec;
use OpenSSL::Test qw/:DEFAULT top_file/; use OpenSSL::Test qw/:DEFAULT top_file/;
use OpenSSL::Test::Utils;
setup("test_gen"); setup("test_gen");
@ -21,7 +22,7 @@ close RND;
subtest "generating certificate requests" => sub { subtest "generating certificate requests" => sub {
my @req_new; my @req_new;
if (run(app(["openssl", "no-rsa"], stdout => undef))) { if (disabled("rsa")) {
@req_new = ("-newkey", "dsa:".top_file("apps", "dsa512.pem")); @req_new = ("-newkey", "dsa:".top_file("apps", "dsa512.pem"));
} else { } else {
@req_new = ("-new"); @req_new = ("-new");

View File

@ -7,14 +7,13 @@ use POSIX;
use File::Spec::Functions qw/catfile/; use File::Spec::Functions qw/catfile/;
use File::Compare qw/compare_text/; use File::Compare qw/compare_text/;
use OpenSSL::Test qw/:DEFAULT top_dir top_file/; use OpenSSL::Test qw/:DEFAULT top_dir top_file/;
use OpenSSL::Test::Utils;
setup("test_cms"); setup("test_cms");
my $smdir = top_dir("test", "smime-certs"); my $smdir = top_dir("test", "smime-certs");
my $smcont = top_file("test", "smcont.txt"); my $smcont = top_file("test", "smcont.txt");
my $no_ec = run(app(["openssl", "no-ec"], stdout => undef)); my ($no_ec, $no_ec2m, $no_zlib) = disabled qw/ec ec2m zlib/;
my $no_ec2m = run(app(["openssl", "no-ec2m"], stdout => undef));
my $no_ecdh = run(app(["openssl", "no-ecdh"], stdout => undef));
plan tests => 4; plan tests => 4;
@ -442,8 +441,7 @@ subtest "CMS <=> CMS consistency tests, modified key parameters\n" => sub {
SKIP: { SKIP: {
skip("Zlib not supported: compression tests skipped", skip("Zlib not supported: compression tests skipped",
scalar @smime_cms_comp_tests) scalar @smime_cms_comp_tests)
unless grep /ZLIB/, run(app(["openssl", "version", "-f"]), if $no_zlib;
capture => 1);
foreach (@smime_cms_comp_tests) { foreach (@smime_cms_comp_tests) {
SKIP: { SKIP: {
@ -469,7 +467,7 @@ sub check_availability {
return "$tnam: skipped, EC disabled\n" return "$tnam: skipped, EC disabled\n"
if ($no_ec && $tnam =~ /ECDH/); if ($no_ec && $tnam =~ /ECDH/);
return "$tnam: skipped, ECDH disabled\n" return "$tnam: skipped, ECDH disabled\n"
if ($no_ecdh && $tnam =~ /ECDH/); if ($no_ec && $tnam =~ /ECDH/);
return "$tnam: skipped, EC2M disabled\n" return "$tnam: skipped, EC2M disabled\n"
if ($no_ec2m && $tnam =~ /K-283/); if ($no_ec2m && $tnam =~ /K-283/);
return ""; return "";

View File

@ -7,9 +7,13 @@ use POSIX;
use File::Spec; use File::Spec;
use File::Copy; use File::Copy;
use OpenSSL::Test qw/:DEFAULT with top_file cmdstr/; use OpenSSL::Test qw/:DEFAULT with top_file cmdstr/;
use OpenSSL::Test::Utils;
setup("test_ssl"); 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 $digest = "-sha1";
my @reqcmd = ("openssl", "req"); my @reqcmd = ("openssl", "req");
my @x509cmd = ("openssl", "x509", $digest); my @x509cmd = ("openssl", "x509", $digest);
@ -94,7 +98,7 @@ sub testss {
my @req_dsa = ("-newkey", my @req_dsa = ("-newkey",
"dsa:".File::Spec->catfile("..", "apps", "dsa1024.pem"));; "dsa:".File::Spec->catfile("..", "apps", "dsa1024.pem"));;
my @req_new; my @req_new;
if (run(app(["openssl", "no-rsa"], stdout => undef))) { if ($no_rsa) {
@req_new = @req_dsa; @req_new = @req_dsa;
} else { } else {
@req_new = ("-new"); @req_new = ("-new");
@ -161,7 +165,7 @@ sub testss {
skip 'failure', 7 unless skip 'failure', 7 unless
subtest 'DSA certificate creation' => sub { subtest 'DSA certificate creation' => sub {
plan skip_all => "skipping DSA certificate creation" plan skip_all => "skipping DSA certificate creation"
if run(app(["openssl", "no-dsa"], stdout => undef)); if $no_dsa;
plan tests => 4; plan tests => 4;
@ -200,7 +204,7 @@ sub testss {
skip 'failure', 6 unless skip 'failure', 6 unless
subtest 'ECDSA/ECDH certificate creation' => sub { subtest 'ECDSA/ECDH certificate creation' => sub {
plan skip_all => "skipping ECDSA/ECDH certificate creation" plan skip_all => "skipping ECDSA/ECDH certificate creation"
if run(app(["openssl", "no-ec"], stdout => undef)); if $no_ec;
plan tests => 5; plan tests => 5;
@ -385,18 +389,18 @@ sub testssl {
my @exkeys = (); my @exkeys = ();
my $ciphers = "-EXP:-PSK:-SRP:-kDH:-kECDHe"; my $ciphers = "-EXP:-PSK:-SRP:-kDH:-kECDHe";
if (run(app(["openssl", "no-dhparam"], stdout => undef))) { if ($no_dh) {
note "skipping DHE tests\n"; note "skipping DHE tests\n";
$ciphers .= ":-kDHE"; $ciphers .= ":-kDHE";
} }
if (run(app(["openssl", "no-dsa"], stdout => undef))) { if ($no_dsa) {
note "skipping DSA tests\n"; note "skipping DSA tests\n";
$ciphers .= ":-aDSA"; $ciphers .= ":-aDSA";
} else { } else {
push @exkeys, "-s_cert", "certD.ss", "-s_key", "keyD.ss"; 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"; note "skipping EC tests\n";
$ciphers .= ":!aECDSA:!kECDH"; $ciphers .= ":!aECDSA:!kECDH";
} else { } else {
@ -442,7 +446,7 @@ sub testssl {
{ {
SKIP: { SKIP: {
skip "skipping anonymous DH tests", 1 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])), ok(run(test([@ssltest, "-v", "-bio_pair", "-tls1", "-cipher", "ADH", "-dhe1024dsa", "-num", "10", "-f", "-time", @extra])),
'test tlsv1 with 1024bit anonymous DH, multiple handshakes'); 'test tlsv1 with 1024bit anonymous DH, multiple handshakes');
@ -452,13 +456,13 @@ sub testssl {
{ {
SKIP: { SKIP: {
skip "skipping RSA tests", 2 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])), 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'); 'test tlsv1 with 1024bit RSA, no (EC)DHE, multiple handshakes');
skip "skipping RSA+DHE tests", 1 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])), 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'); 'test tlsv1 with 1024bit RSA, 1024bit DHE, multiple handshakes');
@ -524,7 +528,7 @@ sub testssl {
{ {
SKIP: { SKIP: {
skip "skipping SRP tests", 4 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"])), ok(run(test([@ssltest, "-tls1", "-cipher", "SRP", "-srpuser", "test", "-srppass", "abc123"])),
'test tls1 with SRP'); 'test tls1 with SRP');