1 # Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
3 # Licensed under the OpenSSL license (the "License"). You may not use
4 # this file except in compliance with the License. You can obtain a copy
5 # in the file LICENSE in the source distribution or at
6 # https://www.openssl.org/source/license.html
8 package OpenSSL::Test::Simple;
14 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
17 @EXPORT = qw(simple_test);
21 OpenSSL::Test::Simple - a few very simple test functions
25 use OpenSSL::Test::Simple;
27 simple_test("my_test_name", "destest", "des");
31 Sometimes, the functions in L<OpenSSL::Test> are quite tedious for some
32 repetitive tasks. This module provides functions to make life easier.
33 You could call them hacks if you wish.
38 use OpenSSL::Test::Utils;
42 =item B<simple_test NAME, PROGRAM, ALGORITHM>
44 Runs a test named NAME, running the program PROGRAM with no arguments,
45 to test the algorithm ALGORITHM.
47 A complete recipe looks like this:
49 use OpenSSL::Test::Simple;
51 simple_test("test_bf", "bftest", "bf");
58 # name (used with setup())
59 # algorithm (used to check if it's at all supported)
60 # name of binary (the program that does the actual test)
62 my ($name, $prgr, @algos) = @_;
66 if (scalar(disabled(@algos))) {
67 if (scalar(@algos) == 1) {
68 plan skip_all => $algos[0]." is not supported by this OpenSSL build";
70 my $last = pop @algos;
71 plan skip_all => join(", ", @algos)." and $last are not supported by this OpenSSL build";
77 ok(run(test([$prgr])), "running $prgr");
86 Richard Levitte E<lt>levitte@openssl.orgE<gt> with inspiration
87 from Rich Salz E<lt>rsalz@openssl.orgE<gt>.