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>
This commit is contained in:
parent
53520ebe87
commit
25be5f44b8
@ -53,18 +53,30 @@
|
|||||||
# Hudson (tjh@cryptsoft.com).
|
# Hudson (tjh@cryptsoft.com).
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/;
|
||||||
use TLSProxy::Proxy;
|
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(
|
my $proxy = TLSProxy::Proxy->new(
|
||||||
\&extension_filter,
|
\&extension_filter,
|
||||||
@ARGV
|
cmdstr(app(["openssl"])),
|
||||||
|
top_file("apps", "server.pem")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
plan tests => 1;
|
||||||
|
|
||||||
#Test 1: Sending a zero length extension block should pass
|
#Test 1: Sending a zero length extension block should pass
|
||||||
$proxy->start();
|
$proxy->start();
|
||||||
TLSProxy::Message->success or die "FAILED: Zero extension length test\n";
|
ok(TLSProxy::Message->success, "Zero extension length test");
|
||||||
|
|
||||||
print "SUCCESS: Extension test\n";
|
|
||||||
|
|
||||||
sub extension_filter
|
sub extension_filter
|
||||||
{
|
{
|
@ -53,21 +53,33 @@
|
|||||||
# Hudson (tjh@cryptsoft.com).
|
# Hudson (tjh@cryptsoft.com).
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/;
|
||||||
use TLSProxy::Proxy;
|
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(
|
my $proxy = TLSProxy::Proxy->new(
|
||||||
\&ske_0_p_filter,
|
\&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
|
#We must use an anon DHE cipher for this test
|
||||||
$proxy->cipherc('ADH-AES128-SHA:@SECLEVEL=0');
|
$proxy->cipherc('ADH-AES128-SHA:@SECLEVEL=0');
|
||||||
$proxy->ciphers('ADH-AES128-SHA:@SECLEVEL=0');
|
$proxy->ciphers('ADH-AES128-SHA:@SECLEVEL=0');
|
||||||
|
|
||||||
$proxy->start();
|
$proxy->start();
|
||||||
TLSProxy::Message->fail or die "FAILED: ServerKeyExchange with 0 p\n";
|
ok(TLSProxy::Message->fail, "ServerKeyExchange with 0 p");
|
||||||
|
|
||||||
print "SUCCESS: ServerKeyExchange with 0 p\n";
|
|
||||||
|
|
||||||
sub ske_0_p_filter
|
sub ske_0_p_filter
|
||||||
{
|
{
|
@ -53,24 +53,36 @@
|
|||||||
# Hudson (tjh@cryptsoft.com).
|
# Hudson (tjh@cryptsoft.com).
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/;
|
||||||
use TLSProxy::Proxy;
|
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(
|
my $proxy = TLSProxy::Proxy->new(
|
||||||
\&vers_tolerance_filter,
|
\&vers_tolerance_filter,
|
||||||
@ARGV
|
cmdstr(app(["openssl"])),
|
||||||
|
top_file("apps", "server.pem")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
plan tests => 2;
|
||||||
|
|
||||||
#Test 1: Asking for TLS1.3 should pass
|
#Test 1: Asking for TLS1.3 should pass
|
||||||
my $client_version = TLSProxy::Record::VERS_TLS_1_3;
|
my $client_version = TLSProxy::Record::VERS_TLS_1_3;
|
||||||
$proxy->start();
|
$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
|
#Test 2: Testing something below SSLv3 should fail
|
||||||
$client_version = TLSProxy::Record::VERS_SSL_3_0 - 1;
|
$client_version = TLSProxy::Record::VERS_SSL_3_0 - 1;
|
||||||
$proxy->restart();
|
$proxy->restart();
|
||||||
TLSProxy::Message->success and die "FAILED: Version tolerance test\n";
|
ok(TLSProxy::Message->fail(), "Version tolerance test, SSL < 3.0");
|
||||||
|
|
||||||
print "SUCCESS: Version tolerance test\n";
|
|
||||||
|
|
||||||
sub vers_tolerance_filter
|
sub vers_tolerance_filter
|
||||||
{
|
{
|
@ -10,15 +10,17 @@ use Test::Harness qw/runtests $switches/;
|
|||||||
my $top = $ENV{TOP};
|
my $top = $ENV{TOP};
|
||||||
my $recipesdir = catdir($top, "test", "recipes");
|
my $recipesdir = catdir($top, "test", "recipes");
|
||||||
my $testlib = catdir($top, "test", "testlib");
|
my $testlib = catdir($top, "test", "testlib");
|
||||||
|
my $utillib = catdir($top, "util");
|
||||||
|
|
||||||
# It seems that $switches is getting interpretted with 'eval' or something
|
# 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
|
# like that, and that we need to take care of backslashes or they will
|
||||||
# disappear along the way.
|
# disappear along the way.
|
||||||
$testlib =~ s|\\|\\\\|g if $^O eq "MSWin32";
|
$testlib =~ s|\\|\\\\|g if $^O eq "MSWin32";
|
||||||
|
$utillib =~ s|\\|\\\\|g if $^O eq "MSWin32";
|
||||||
|
|
||||||
# Test::Harness provides the variable $switches to give it
|
# Test::Harness provides the variable $switches to give it
|
||||||
# switches to be used when it calls our recipes.
|
# switches to be used when it calls our recipes.
|
||||||
$switches = "-w \"-I$testlib\"";
|
$switches = "-w \"-I$testlib\" \"-I$utillib\"";
|
||||||
|
|
||||||
my @tests = ( "alltests" );
|
my @tests = ( "alltests" );
|
||||||
if (@ARGV) {
|
if (@ARGV) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user