blob: 5312c205a09287720ddf4d8a39ee00a161f32aa1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
package OpenSSL::Test::Utils;
use strict;
use warnings;
use Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = "0.1";
@ISA = qw(Exporter);
@EXPORT = qw(disabled);
=head1 NAME
OpenSSL::Test::Utils - test utility functions
=head1 SYNOPSIS
use OpenSSL::Test::Utils;
disabled("dh");
=head1 DESCRIPTION
This module provides utility functions for the testing framework.
=cut
use OpenSSL::Test;
=over 4
=item B<disabled ARRAY>
In a scalar context returns 1 if any of the features in ARRAY is disabled.
In an array context returns an array with each element set to 1 if the
corresponding feature is disabled and 0 otherwise.
=back
=cut
our %disabled;
my $disabled_set = 0;
sub check_disabled {
#print STDERR "Running check_disabled\n";
foreach (run(app(["openssl", "list", "-disabled"]), capture => 1)) {
s/\R//; # chomp;
next if /:/; # skip header
$disabled{lc $_} = 1;
}
$disabled_set = 1;
}
# args:
# list of features to check
sub disabled {
check_disabled() unless $disabled_set;
if (wantarray) {
my @ret;
foreach (@_) {
push @ret, exists $disabled{lc $_} ? 1 : 0;
}
return @ret;
}
foreach (@_) {
return 1 if exists $disabled{lc $_};
}
return 0;
}
=head1 SEE ALSO
L<OpenSSL::Test>
=head1 AUTHORS
Stephen Henson E<lt>steve@openssl.orgE<gt> with inspiration
from Richard Levitte E<lt>levitte@openssl.orgE<gt>
=cut
1;
|