2016-04-22 19:21:51 +08:00
|
|
|
#! /usr/bin/env perl
|
2022-05-03 18:52:38 +08:00
|
|
|
# Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
|
2016-04-22 19:21:51 +08:00
|
|
|
#
|
2018-12-06 20:05:25 +08:00
|
|
|
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-04-22 19:21:51 +08:00
|
|
|
# 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
|
|
|
|
|
2015-10-26 00:43:55 +08:00
|
|
|
|
|
|
|
use OpenSSL::Test::Simple;
|
2021-01-26 21:30:06 +08:00
|
|
|
use OpenSSL::Test qw/:DEFAULT srctop_file srctop_dir bldtop_dir bldtop_file data_dir/;
|
2020-12-10 23:39:58 +08:00
|
|
|
use OpenSSL::Test::Utils;
|
|
|
|
use Cwd qw(abs_path);
|
2015-10-26 00:43:55 +08:00
|
|
|
|
2020-12-10 23:39:58 +08:00
|
|
|
BEGIN {
|
|
|
|
setup("test_threads");
|
|
|
|
}
|
|
|
|
|
|
|
|
use lib srctop_dir('Configurations');
|
|
|
|
use lib bldtop_dir('.');
|
|
|
|
|
|
|
|
my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
|
2021-05-13 08:34:42 +08:00
|
|
|
my $config_path = abs_path(srctop_file("test", $no_fips ? "default.cnf"
|
|
|
|
: "default-and-fips.cnf"));
|
2020-12-10 23:39:58 +08:00
|
|
|
|
2022-11-16 23:09:55 +08:00
|
|
|
plan tests => 3;
|
2020-12-10 23:39:58 +08:00
|
|
|
|
|
|
|
if ($no_fips) {
|
2021-05-13 08:34:42 +08:00
|
|
|
ok(run(test(["threadstest", "-config", $config_path, data_dir()])),
|
|
|
|
"running test_threads");
|
2020-12-10 23:39:58 +08:00
|
|
|
} else {
|
2021-05-13 08:34:42 +08:00
|
|
|
ok(run(test(["threadstest", "-fips", "-config", $config_path, data_dir()])),
|
|
|
|
"running test_threads with FIPS");
|
2020-12-10 23:39:58 +08:00
|
|
|
}
|
2021-05-14 13:41:14 +08:00
|
|
|
|
2022-11-16 23:09:55 +08:00
|
|
|
ok(run(test(["threadpool_test"])), "running threadpool_test");
|
|
|
|
|
2021-05-14 13:41:14 +08:00
|
|
|
# Merge the configuration files into one filtering the contents so the failure
|
2022-01-03 07:00:27 +08:00
|
|
|
# condition is reproducible. A working FIPS configuration without the install
|
2021-05-14 13:41:14 +08:00
|
|
|
# status is required.
|
|
|
|
|
|
|
|
open CFGBASE, '<', $config_path;
|
2021-05-24 20:25:28 +08:00
|
|
|
open CFGINC, '<', bldtop_file('/test/fipsmodule.cnf');
|
2021-05-14 13:41:14 +08:00
|
|
|
open CFGOUT, '>', 'thread.cnf';
|
|
|
|
|
|
|
|
while (<CFGBASE>) {
|
|
|
|
print CFGOUT unless m/^[.]include/;
|
|
|
|
}
|
|
|
|
close CFGBASE;
|
|
|
|
print CFGOUT "\n\n";
|
|
|
|
while (<CFGINC>) {
|
|
|
|
print CFGOUT unless m/^install-status/;
|
|
|
|
}
|
|
|
|
close CFGINC;
|
|
|
|
close CFGOUT;
|
|
|
|
|
|
|
|
$ENV{OPENSSL_CONF} = 'thread.cnf';
|
2022-11-16 23:09:55 +08:00
|
|
|
ok(run(test(["threadstest_fips"])), "running threadstest_fips");
|