Simplify very simple test recipes further.
Very simple test recipes easily become tedious, so they might benefit from being made as simple as possible. Therefore, OpenSSL::Test::Simple is born. It currently provides but one function, simple_test(), which takes a minimum of two parameters (test name and program to run), with the optional third, being the algorithm to be checked for before running the test itself. All recipes with that simple thing to do have been rewritten to be as minimal as possible. Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
32
test/testlib/OpenSSL/Test/Simple.pm
Normal file
32
test/testlib/OpenSSL/Test/Simple.pm
Normal file
@@ -0,0 +1,32 @@
|
||||
package OpenSSL::Test::Simple;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Exporter;
|
||||
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
|
||||
$VERSION = "0.1";
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(simple_test);
|
||||
|
||||
|
||||
use Test::More;
|
||||
use OpenSSL::Test;
|
||||
|
||||
# args:
|
||||
# name (used with setup())
|
||||
# algorithm (used to check if it's at all supported)
|
||||
# name of binary (the program that does the actual test)
|
||||
sub simple_test {
|
||||
my ($name, $prgr, $algo, @rest) = @_;
|
||||
|
||||
setup($name);
|
||||
|
||||
plan tests => 1;
|
||||
SKIP: {
|
||||
skip "$algo is not supported by this OpenSSL build, skipping this test...", 1
|
||||
if $algo && run(app(["openssl", "no-$algo"]));
|
||||
|
||||
ok(run(test([$prgr])), "running $prgr");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user