1*e0c4386eSCy Schubert# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 2*e0c4386eSCy Schubert# 3*e0c4386eSCy Schubert# Licensed under the Apache License 2.0 (the "License"). You may not use 4*e0c4386eSCy Schubert# this file except in compliance with the License. You can obtain a copy 5*e0c4386eSCy Schubert# in the file LICENSE in the source distribution or at 6*e0c4386eSCy Schubert# https://www.openssl.org/source/license.html 7*e0c4386eSCy Schubert 8*e0c4386eSCy Schubertpackage OpenSSL::Test::Simple; 9*e0c4386eSCy Schubert 10*e0c4386eSCy Schubertuse strict; 11*e0c4386eSCy Schubertuse warnings; 12*e0c4386eSCy Schubert 13*e0c4386eSCy Schubertuse Exporter; 14*e0c4386eSCy Schubertuse vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); 15*e0c4386eSCy Schubert$VERSION = "0.2"; 16*e0c4386eSCy Schubert@ISA = qw(Exporter); 17*e0c4386eSCy Schubert@EXPORT = qw(simple_test); 18*e0c4386eSCy Schubert 19*e0c4386eSCy Schubert=head1 NAME 20*e0c4386eSCy Schubert 21*e0c4386eSCy SchubertOpenSSL::Test::Simple - a few very simple test functions 22*e0c4386eSCy Schubert 23*e0c4386eSCy Schubert=head1 SYNOPSIS 24*e0c4386eSCy Schubert 25*e0c4386eSCy Schubert use OpenSSL::Test::Simple; 26*e0c4386eSCy Schubert 27*e0c4386eSCy Schubert simple_test("my_test_name", "destest", "des"); 28*e0c4386eSCy Schubert 29*e0c4386eSCy Schubert=head1 DESCRIPTION 30*e0c4386eSCy Schubert 31*e0c4386eSCy SchubertSometimes, the functions in L<OpenSSL::Test> are quite tedious for some 32*e0c4386eSCy Schubertrepetitive tasks. This module provides functions to make life easier. 33*e0c4386eSCy SchubertYou could call them hacks if you wish. 34*e0c4386eSCy Schubert 35*e0c4386eSCy Schubert=cut 36*e0c4386eSCy Schubert 37*e0c4386eSCy Schubertuse OpenSSL::Test; 38*e0c4386eSCy Schubertuse OpenSSL::Test::Utils; 39*e0c4386eSCy Schubert 40*e0c4386eSCy Schubert=over 4 41*e0c4386eSCy Schubert 42*e0c4386eSCy Schubert=item B<simple_test NAME, PROGRAM, ALGORITHM> 43*e0c4386eSCy Schubert 44*e0c4386eSCy SchubertRuns a test named NAME, running the program PROGRAM with no arguments, 45*e0c4386eSCy Schubertto test the algorithm ALGORITHM. 46*e0c4386eSCy Schubert 47*e0c4386eSCy SchubertA complete recipe looks like this: 48*e0c4386eSCy Schubert 49*e0c4386eSCy Schubert use OpenSSL::Test::Simple; 50*e0c4386eSCy Schubert 51*e0c4386eSCy Schubert simple_test("test_bf", "bftest", "bf"); 52*e0c4386eSCy Schubert 53*e0c4386eSCy Schubert=back 54*e0c4386eSCy Schubert 55*e0c4386eSCy Schubert=cut 56*e0c4386eSCy Schubert 57*e0c4386eSCy Schubert# args: 58*e0c4386eSCy Schubert# name (used with setup()) 59*e0c4386eSCy Schubert# algorithm (used to check if it's at all supported) 60*e0c4386eSCy Schubert# name of binary (the program that does the actual test) 61*e0c4386eSCy Schubertsub simple_test { 62*e0c4386eSCy Schubert my ($name, $prgr, @algos) = @_; 63*e0c4386eSCy Schubert 64*e0c4386eSCy Schubert setup($name); 65*e0c4386eSCy Schubert 66*e0c4386eSCy Schubert if (scalar(disabled(@algos))) { 67*e0c4386eSCy Schubert if (scalar(@algos) == 1) { 68*e0c4386eSCy Schubert plan skip_all => $algos[0]." is not supported by this OpenSSL build"; 69*e0c4386eSCy Schubert } else { 70*e0c4386eSCy Schubert my $last = pop @algos; 71*e0c4386eSCy Schubert plan skip_all => join(", ", @algos)." and $last are not supported by this OpenSSL build"; 72*e0c4386eSCy Schubert } 73*e0c4386eSCy Schubert } 74*e0c4386eSCy Schubert 75*e0c4386eSCy Schubert plan tests => 1; 76*e0c4386eSCy Schubert 77*e0c4386eSCy Schubert ok(run(test([$prgr])), "running $prgr"); 78*e0c4386eSCy Schubert} 79*e0c4386eSCy Schubert 80*e0c4386eSCy Schubert=head1 SEE ALSO 81*e0c4386eSCy Schubert 82*e0c4386eSCy SchubertL<OpenSSL::Test> 83*e0c4386eSCy Schubert 84*e0c4386eSCy Schubert=head1 AUTHORS 85*e0c4386eSCy Schubert 86*e0c4386eSCy SchubertRichard Levitte E<lt>levitte@openssl.orgE<gt> with inspiration 87*e0c4386eSCy Schubertfrom Rich Salz E<lt>rsalz@openssl.orgE<gt>. 88*e0c4386eSCy Schubert 89*e0c4386eSCy Schubert=cut 90*e0c4386eSCy Schubert 91*e0c4386eSCy Schubert1; 92