diff options
author | Richard Levitte <levitte@openssl.org> | 2015-08-13 19:38:59 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2015-09-07 16:10:58 +0200 |
commit | 25be5f44b81e1c45e15e689ba55713e455dfe624 (patch) | |
tree | 0d05388153f54bbe1331872baf3bc1effaa40ac8 /test | |
parent | 53520ebe8757fea7d2e9ffe3d0c610dd6b9b9cc6 (diff) | |
download | openssl-25be5f44b81e1c45e15e689ba55713e455dfe624.zip openssl-25be5f44b81e1c45e15e689ba55713e455dfe624.tar.gz openssl-25be5f44b81e1c45e15e689ba55713e455dfe624.tar.bz2 |
Adapt the libssl test harness testing scripts to new testing framework
This involves adding $TOP/util as perl library in test/run_tests.pl.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'test')
-rwxr-xr-x | test/recipes/70-test_sslextension.t (renamed from test/sslextensiontest.pl) | 20 | ||||
-rwxr-xr-x | test/recipes/70-test_sslskewith0p.t (renamed from test/sslskewith0ptest.pl) | 20 | ||||
-rwxr-xr-x | test/recipes/70-test_sslvertol.t (renamed from test/sslvertoltest.pl) | 22 | ||||
-rw-r--r-- | test/run_tests.pl | 4 |
4 files changed, 52 insertions, 14 deletions
diff --git a/test/sslextensiontest.pl b/test/recipes/70-test_sslextension.t index 802bac1..4aa3f61 100755 --- a/test/sslextensiontest.pl +++ b/test/recipes/70-test_sslextension.t @@ -53,18 +53,30 @@ # Hudson (tjh@cryptsoft.com). use strict; +use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/; use TLSProxy::Proxy; +my $test_name = "test_sslextension"; +setup($test_name); + +plan skip_all => "$test_name can only be performed with OpenSSL configured shared" + unless (map { chomp; s/^SHARED_LIBS=\s*//; $_ } + grep { /^SHARED_LIBS=/ } + do { local @ARGV = ( top_file("Makefile") ); <> })[0] ne ""; + +$ENV{OPENSSL_ENGINES} = top_dir("engines"); +$ENV{OPENSSL_ia32cap} = '~0x200000200000000'; my $proxy = TLSProxy::Proxy->new( \&extension_filter, - @ARGV + cmdstr(app(["openssl"])), + top_file("apps", "server.pem") ); +plan tests => 1; + #Test 1: Sending a zero length extension block should pass $proxy->start(); -TLSProxy::Message->success or die "FAILED: Zero extension length test\n"; - -print "SUCCESS: Extension test\n"; +ok(TLSProxy::Message->success, "Zero extension length test"); sub extension_filter { diff --git a/test/sslskewith0ptest.pl b/test/recipes/70-test_sslskewith0p.t index 63f8398..d8d74b3 100755 --- a/test/sslskewith0ptest.pl +++ b/test/recipes/70-test_sslskewith0p.t @@ -53,21 +53,33 @@ # Hudson (tjh@cryptsoft.com). use strict; +use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/; use TLSProxy::Proxy; +my $test_name = "test_sslskewith0p"; +setup($test_name); + +plan skip_all => "$test_name can only be performed with OpenSSL configured shared" + unless (map { chomp; s/^SHARED_LIBS=\s*//; $_ } + grep { /^SHARED_LIBS=/ } + do { local @ARGV = ( top_file("Makefile") ); <> })[0] ne ""; + +$ENV{OPENSSL_ENGINES} = top_dir("engines"); +$ENV{OPENSSL_ia32cap} = '~0x200000200000000'; my $proxy = TLSProxy::Proxy->new( \&ske_0_p_filter, - @ARGV + cmdstr(app(["openssl"])), + top_file("apps", "server.pem") ); +plan tests => 1; + #We must use an anon DHE cipher for this test $proxy->cipherc('ADH-AES128-SHA:@SECLEVEL=0'); $proxy->ciphers('ADH-AES128-SHA:@SECLEVEL=0'); $proxy->start(); -TLSProxy::Message->fail or die "FAILED: ServerKeyExchange with 0 p\n"; - -print "SUCCESS: ServerKeyExchange with 0 p\n"; +ok(TLSProxy::Message->fail, "ServerKeyExchange with 0 p"); sub ske_0_p_filter { diff --git a/test/sslvertoltest.pl b/test/recipes/70-test_sslvertol.t index 1828a7d..9717f80 100755 --- a/test/sslvertoltest.pl +++ b/test/recipes/70-test_sslvertol.t @@ -53,24 +53,36 @@ # Hudson (tjh@cryptsoft.com). use strict; +use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/; use TLSProxy::Proxy; +my $test_name = "test_sslextension"; +setup($test_name); + +plan skip_all => "$test_name can only be performed with OpenSSL configured shared" + unless (map { chomp; s/^SHARED_LIBS=\s*//; $_ } + grep { /^SHARED_LIBS=/ } + do { local @ARGV = ( top_file("Makefile") ); <> })[0] ne ""; + +$ENV{OPENSSL_ENGINES} = top_dir("engines"); +$ENV{OPENSSL_ia32cap} = '~0x200000200000000'; my $proxy = TLSProxy::Proxy->new( \&vers_tolerance_filter, - @ARGV + cmdstr(app(["openssl"])), + top_file("apps", "server.pem") ); +plan tests => 2; + #Test 1: Asking for TLS1.3 should pass my $client_version = TLSProxy::Record::VERS_TLS_1_3; $proxy->start(); -TLSProxy::Message->success or die "FAILED: Version tolerance test\n"; +ok(TLSProxy::Message->success(), "Version tolerance test, TLS 1.3"); #Test 2: Testing something below SSLv3 should fail $client_version = TLSProxy::Record::VERS_SSL_3_0 - 1; $proxy->restart(); -TLSProxy::Message->success and die "FAILED: Version tolerance test\n"; - -print "SUCCESS: Version tolerance test\n"; +ok(TLSProxy::Message->fail(), "Version tolerance test, SSL < 3.0"); sub vers_tolerance_filter { diff --git a/test/run_tests.pl b/test/run_tests.pl index 746b0d1..7e61282 100644 --- a/test/run_tests.pl +++ b/test/run_tests.pl @@ -10,15 +10,17 @@ use Test::Harness qw/runtests $switches/; my $top = $ENV{TOP}; my $recipesdir = catdir($top, "test", "recipes"); my $testlib = catdir($top, "test", "testlib"); +my $utillib = catdir($top, "util"); # It seems that $switches is getting interpretted with 'eval' or something # like that, and that we need to take care of backslashes or they will # disappear along the way. $testlib =~ s|\\|\\\\|g if $^O eq "MSWin32"; +$utillib =~ s|\\|\\\\|g if $^O eq "MSWin32"; # Test::Harness provides the variable $switches to give it # switches to be used when it calls our recipes. -$switches = "-w \"-I$testlib\""; +$switches = "-w \"-I$testlib\" \"-I$utillib\""; my @tests = ( "alltests" ); if (@ARGV) { |