]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/recipes/25-test_req.t
Unified copyright for test recipes
[thirdparty/openssl.git] / test / recipes / 25-test_req.t
CommitLineData
596d6b7e
RS
1#! /usr/bin/env perl
2# Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
3#
4# Licensed under the OpenSSL license (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
4650de3e
RL
9
10use strict;
11use warnings;
12
13use File::Spec;
42e0ccdf 14use OpenSSL::Test qw/:DEFAULT srctop_file/;
4650de3e
RL
15
16setup("test_req");
17
18plan tests => 3;
19
42e0ccdf 20require_ok(srctop_file('test','recipes','tconversion.pl'));
4650de3e 21
42e0ccdf 22my @openssl_args = ("req", "-config", srctop_file("apps", "openssl.cnf"));
4650de3e
RL
23
24run_conversion('req conversions',
25 "testreq.pem");
26run_conversion('req conversions -- testreq2',
27 "testreq2.pem");
28
29sub run_conversion {
30 my $title = shift;
31 my $reqfile = shift;
32
33 subtest $title => sub {
34 run(app(["openssl", @openssl_args,
35 "-in", $reqfile, "-inform", "p",
36 "-noout", "-text"],
37 stderr => "req-check.err", stdout => undef));
38 open DATA, "req-check.err";
39 SKIP: {
40 plan skip_all => "skipping req conversion test for $reqfile"
85833408 41 if grep /Unknown Public Key/, map { s/\R//; } <DATA>;
4650de3e
RL
42
43 tconversion("req", "testreq.pem", @openssl_args);
44 }
45 close DATA;
46 unlink "req-check.err";
47
48 done_testing();
49 };
50}