Chunk 12 of CMP contribution to OpenSSL: CLI-based high-level tests
[openssl.git] / test / recipes / 15-test_ecparam.t
1 #! /usr/bin/env perl
2 # Copyright 2017-2020 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 File::Spec;
14 use OpenSSL::Glob;
15 use OpenSSL::Test qw/:DEFAULT data_file/;
16 use OpenSSL::Test::Utils;
17
18 setup("test_ecparam");
19
20 plan skip_all => "EC isn't supported in this build"
21     if disabled("ec") || disabled("ec2m");
22
23 my @valid = glob(data_file("valid", "*.pem"));
24 my @invalid = glob(data_file("invalid", "*.pem"));
25
26 my $num_tests = scalar @valid + scalar @invalid;
27 plan tests => 3 * $num_tests;
28
29  SKIP: {
30     skip "Skipping EC tests", 2 * $num_tests
31         if disabled('deprecated-3.0');
32
33     foreach (@valid) {
34         ok(run(app([qw{openssl ecparam -noout -check -in}, $_])));
35     }
36
37     foreach (@valid) {
38         ok(run(app([qw{openssl ecparam -noout -check_named -in}, $_])));
39     }
40
41     foreach (@invalid) {
42         ok(!run(app([qw{openssl ecparam -noout -check -in}, $_])));
43     }
44
45     foreach (@invalid) {
46         ok(!run(app([qw{openssl ecparam -noout -check_named -in}, $_])));
47     }
48 }
49
50 foreach (@valid) {
51     ok(run(app([qw{openssl pkeyparam -noout -check -in}, $_])));
52 }
53
54 foreach (@invalid) {
55     ok(!run(app([qw{openssl pkeyparam -noout -check -in}, $_])));
56 }