mirror of
https://github.com/openssl/openssl.git
synced 2024-11-21 01:15:20 +08:00
test: fix thread test config file problem
Force the thread test to use the configuration file via a command line arg. Use the test library support for libctx creation. Fixes #15243 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15256)
This commit is contained in:
parent
7f24110a00
commit
9a633a1c97
@ -20,13 +20,15 @@ use lib srctop_dir('Configurations');
|
||||
use lib bldtop_dir('.');
|
||||
|
||||
my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
|
||||
my $config_path = abs_path(srctop_file("test", $no_fips ? "default.cnf"
|
||||
: "default-and-fips.cnf"));
|
||||
|
||||
plan tests => 1;
|
||||
|
||||
if ($no_fips) {
|
||||
$ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "default.cnf"));
|
||||
ok(run(test(["threadstest", data_dir()])), "running test_threads");
|
||||
ok(run(test(["threadstest", "-config", $config_path, data_dir()])),
|
||||
"running test_threads");
|
||||
} else {
|
||||
$ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "default-and-fips.cnf"));
|
||||
ok(run(test(["threadstest", "-fips", data_dir()])), "running test_threads");
|
||||
ok(run(test(["threadstest", "-fips", "-config", $config_path, data_dir()])),
|
||||
"running test_threads with FIPS");
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
static int do_fips = 0;
|
||||
static char *privkey;
|
||||
static char *config_file = NULL;
|
||||
|
||||
#if !defined(OPENSSL_THREADS) || defined(CRYPTO_TDEBUG)
|
||||
|
||||
@ -450,9 +451,10 @@ static int test_multi(int idx)
|
||||
#endif
|
||||
|
||||
multi_success = 1;
|
||||
multi_libctx = OSSL_LIB_CTX_new();
|
||||
if (!TEST_ptr(multi_libctx))
|
||||
goto err;
|
||||
if (!TEST_true(test_get_libctx(&multi_libctx, NULL, config_file,
|
||||
NULL, NULL)))
|
||||
return 0;
|
||||
|
||||
prov = OSSL_PROVIDER_load(multi_libctx, (idx == 1) ? "fips" : "default");
|
||||
if (!TEST_ptr(prov))
|
||||
goto err;
|
||||
@ -583,7 +585,7 @@ static int test_multi_default(void)
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1,
|
||||
OPT_EOF = 0,
|
||||
OPT_FIPS,
|
||||
OPT_FIPS, OPT_CONFIG_FILE,
|
||||
OPT_TEST_ENUM
|
||||
} OPTION_CHOICE;
|
||||
|
||||
@ -592,6 +594,8 @@ const OPTIONS *test_get_options(void)
|
||||
static const OPTIONS options[] = {
|
||||
OPT_TEST_OPTIONS_DEFAULT_USAGE,
|
||||
{ "fips", OPT_FIPS, '-', "Test the FIPS provider" },
|
||||
{ "config", OPT_CONFIG_FILE, '<',
|
||||
"The configuration file to use for the libctx" },
|
||||
{ NULL }
|
||||
};
|
||||
return options;
|
||||
@ -607,6 +611,9 @@ int setup_tests(void)
|
||||
case OPT_FIPS:
|
||||
do_fips = 1;
|
||||
break;
|
||||
case OPT_CONFIG_FILE:
|
||||
config_file = opt_arg();
|
||||
break;
|
||||
case OPT_TEST_CASES:
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user