Fix documentation of OSSL_STORE
[openssl.git] / test / generate_ssl_tests.pl
index f103e8efb500f95d5580e5e0970a570ebc70cc43..cdb35cc1500fbc5f0d5cb660afb52fa2c685d494 100644 (file)
@@ -1,7 +1,7 @@
 #! /usr/bin/env perl
-# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
 #
-# Licensed under the OpenSSL license (the "License").  You may not use
+# Licensed under the Apache License 2.0 (the "License").  You may not use
 # this file except in compliance with the License.  You can obtain a copy
 # in the file LICENSE in the source distribution or at
 # https://www.openssl.org/source/license.html
@@ -19,13 +19,15 @@ use OpenSSL::Test::Utils;
 
 # This block needs to run before 'use lib srctop_dir' directives.
 BEGIN {
-    OpenSSL::Test::setup("no_test_here");
+    OpenSSL::Test::setup("no_test_here", quiet => 1);
 }
 
-use lib srctop_dir("util");  # for with_fallback
-use lib srctop_dir("test", "ssl-tests");  # for ssltests_base
+use FindBin;
+use lib "$FindBin::Bin/../util/perl";
+use OpenSSL::fallback "$FindBin::Bin/../external/perl/MODULES.txt";
+use Text::Template 1.46;
 
-use with_fallback qw(Text::Template);
+use lib "$FindBin::Bin/ssl-tests";
 
 use vars qw/@ISA/;
 push (@ISA, qw/Text::Template/);
@@ -46,7 +48,8 @@ sub print_templates {
         if (defined $test->{"server2"}) {
             $test->{"server2"} = { (%ssltests::base_server, %{$test->{"server2"}}) };
         } else {
-            if (defined $test->{"test"}->{"ServerNameCallback"}) {
+            if ($test->{"server"}->{"extra"} &&
+                defined $test->{"server"}->{"extra"}->{"ServerNameCallback"}) {
                 # Default is the same as server.
                 $test->{"reuse_server2"} = 1;
             }
@@ -124,6 +127,11 @@ sub print_templates {
 # Shamelessly copied from Configure.
 sub read_config {
     my $fname = shift;
+    my $provider = shift;
+    local $ssltests::fips_mode = $provider eq "fips";
+    local $ssltests::no_deflt_libctx =
+        $provider eq "default" || $provider eq "fips";
+
     open(INPUT, "< $fname") or die "Can't open input file '$fname'!\n";
     local $/ = undef;
     my $content = <INPUT>;
@@ -133,8 +141,9 @@ sub read_config {
 }
 
 my $input_file = shift;
+my $provider = shift;
 # Reads the tests into ssltests::tests.
-read_config($input_file);
+read_config($input_file, $provider);
 print_templates();
 
 1;