]>
git.ipfire.org Git - thirdparty/openssl.git/blob - test/generate_ssl_tests.pl
4 ## SSL testcase generator
10 use File
::Spec
::Functions
;
12 use OpenSSL
::Test qw
/srctop_dir srctop_file/;
13 use OpenSSL
::Test
::Utils
;
15 # This block needs to run before 'use lib srctop_dir' directives.
17 OpenSSL
::Test
::setup
("no_test_here");
20 use lib srctop_dir
("util"); # for with_fallback
21 use lib srctop_dir
("test", "ssl-tests"); # for ssltests_base
23 use with_fallback
qw(Text::Template);
26 push (@ISA, qw
/Text::Template/);
31 my $source = srctop_file
("test", "ssl_test.tmpl");
32 my $template = Text
::Template
->new(TYPE
=> 'FILE', SOURCE
=> $source);
34 print "# Generated with generate_ssl_tests.pl\n\n";
36 my $num = scalar @ssltests::tests
;
38 # Add the implicit base configuration.
39 foreach my $test (@ssltests::tests
) {
40 $test->{"server"} = { (%ssltests::base_server
, %{$test->{"server"}}) };
41 $test->{"client"} = { (%ssltests::base_client
, %{$test->{"client"}}) };
44 # ssl_test expects to find a
48 # directive in the file. It'll then look for configuration directives
49 # for n tests, that each look like this:
51 # test-n = test-section
54 # (SSL modules for client and server configuration go here.)
57 # (Test configuration goes here.)
58 print "num_tests = $num\n\n";
60 # The conf module locations must come before everything else, because
63 # test-n = test-section
65 # and you can't mix and match them with sections.
68 foreach my $test (@ssltests::tests
) {
69 my $testname = "${idx}-" . $test->{'name'};
70 print "test-$idx = $testname\n";
76 foreach my $test (@ssltests::tests
) {
77 my $testname = "${idx}-" . $test->{'name'};
78 my $text = $template->fill_in(
79 HASH
=> [{ idx
=> $idx, testname
=> $testname } , $test],
80 DELIMITERS
=> [ "{-", "-}" ]);
81 print "# ===========================================================\n\n";
87 # Shamelessly copied from Configure.
90 open(INPUT
, "< $fname")
91 or die "Can't open input file '$fname'!\n";
93 my $content = <INPUT
>;
99 my $input_file = shift;
100 # Reads the tests into ssltests::tests.
101 read_config
($input_file);