aboutsummaryrefslogtreecommitdiff
path: root/test/testlib
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2015-04-21 19:29:01 +0200
committerRichard Levitte <levitte@openssl.org>2015-09-07 16:10:58 +0200
commit93de4f58ef8be2cb764343cb3102d41c81f11593 (patch)
tree24240fe186ce101496f758d80e22a7bb03879129 /test/testlib
parentd11b43fdd30f084c19136359d0e3e4a06631abf9 (diff)
downloadopenssl-93de4f58ef8be2cb764343cb3102d41c81f11593.zip
openssl-93de4f58ef8be2cb764343cb3102d41c81f11593.tar.gz
openssl-93de4f58ef8be2cb764343cb3102d41c81f11593.tar.bz2
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>
Diffstat (limited to 'test/testlib')
-rw-r--r--test/testlib/OpenSSL/Test/Simple.pm32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/testlib/OpenSSL/Test/Simple.pm b/test/testlib/OpenSSL/Test/Simple.pm
new file mode 100644
index 0000000..94f6cf9
--- /dev/null
+++ b/test/testlib/OpenSSL/Test/Simple.pm
@@ -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");
+ }
+}