VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1f/util/perl/OpenSSL/Test/Simple.pm@ 83531

Last change on this file since 83531 was 83531, checked in by vboxsync, 5 years ago

setting svn:sync-process=export for openssl-1.1.1f, all files except tests

File size: 1.9 KB
Line 
1# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
2#
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
7
8package OpenSSL::Test::Simple;
9
10use strict;
11use warnings;
12
13use Exporter;
14use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
15$VERSION = "0.2";
16@ISA = qw(Exporter);
17@EXPORT = qw(simple_test);
18
19=head1 NAME
20
21OpenSSL::Test::Simple - a few very simple test functions
22
23=head1 SYNOPSIS
24
25 use OpenSSL::Test::Simple;
26
27 simple_test("my_test_name", "destest", "des");
28
29=head1 DESCRIPTION
30
31Sometimes, the functions in L<OpenSSL::Test> are quite tedious for some
32repetitive tasks. This module provides functions to make life easier.
33You could call them hacks if you wish.
34
35=cut
36
37use OpenSSL::Test;
38use OpenSSL::Test::Utils;
39
40=over 4
41
42=item B<simple_test NAME, PROGRAM, ALGORITHM>
43
44Runs a test named NAME, running the program PROGRAM with no arguments,
45to test the algorithm ALGORITHM.
46
47A complete recipe looks like this:
48
49 use OpenSSL::Test::Simple;
50
51 simple_test("test_bf", "bftest", "bf");
52
53=back
54
55=cut
56
57# args:
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)
61sub simple_test {
62 my ($name, $prgr, @algos) = @_;
63
64 setup($name);
65
66 if (scalar(disabled(@algos))) {
67 if (scalar(@algos) == 1) {
68 plan skip_all => $algos[0]." is not supported by this OpenSSL build";
69 } else {
70 my $last = pop @algos;
71 plan skip_all => join(", ", @algos)." and $last are not supported by this OpenSSL build";
72 }
73 }
74
75 plan tests => 1;
76
77 ok(run(test([$prgr])), "running $prgr");
78}
79
80=head1 SEE ALSO
81
82L<OpenSSL::Test>
83
84=head1 AUTHORS
85
86Richard Levitte E<lt>[email protected]<gt> with inspiration
87from Rich Salz E<lt>[email protected]<gt>.
88
89=cut
90
911;
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette