testing: set OPENSSL_MODULES to the providers directory by default
[openssl.git] / test / recipes / 30-test_evp.t
1 #! /usr/bin/env perl
2 # Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
3 #
4 # Licensed under the Apache License 2.0 (the "License").  You may not use
5 # this file except in compliance with the License.  You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
8
9
10 use strict;
11 use warnings;
12
13 use OpenSSL::Test qw(:DEFAULT data_file bldtop_dir srctop_file);
14 use OpenSSL::Test::Utils;
15
16 setup("test_evp");
17
18 # Default config depends on if the legacy module is built or not
19 my $defaultcnf = disabled('legacy') ? 'default.cnf' : 'default-and-legacy.cnf';
20
21 my @configs = ( $defaultcnf );
22 # Only add the FIPS config if the FIPS module has been built
23 push @configs, 'fips.cnf' unless disabled('fips');
24
25 my @files = qw( evpciph.txt evpdigest.txt );
26 my @defltfiles = qw( evpencod.txt evpkdf.txt evppkey_kdf.txt evpmac.txt
27     evppbe.txt evppkey.txt evppkey_ecc.txt evpcase.txt evpaessiv.txt
28     evpccmcavs.txt );
29
30 plan tests => (scalar(@configs) * scalar(@files)) + scalar(@defltfiles);
31
32 foreach (@configs) {
33     $ENV{OPENSSL_CONF} = srctop_file("test", $_);
34
35     foreach my $f ( @files ) {
36         ok(run(test(["evp_test", data_file("$f")])),
37            "running evp_test $f");
38     }
39 }
40
41 #TODO(3.0): As more operations are converted to providers we can move more of
42 #           these tests to the loop above
43
44 $ENV{OPENSSL_CONF} = srctop_file("test", $defaultcnf);
45
46 foreach my $f ( @defltfiles ) {
47     ok(run(test(["evp_test", data_file("$f")])),
48        "running evp_test $f");
49 }