mirror of
https://github.com/openssl/openssl.git
synced 2024-12-03 23:14:37 +08:00
Suppress a spurious error from the sysdefault test
Running the sysdefault test results in spurious error output - even though the test has actually passed Fixes #24383 Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/24384)
This commit is contained in:
parent
ad3f28c5fb
commit
50153ad2bb
@ -24,7 +24,7 @@ ok(run(test(["sysdefaulttest"])), "sysdefaulttest");
|
||||
|
||||
$ENV{OPENSSL_CONF} = data_file("sysdefault-bad.cnf");
|
||||
|
||||
ok(!run(test(["sysdefaulttest"])), "sysdefaulttest");
|
||||
ok(run(test(["sysdefaulttest", "-f"])), "sysdefaulttest");
|
||||
|
||||
$ENV{OPENSSL_CONF} = data_file("sysdefault-ignore.cnf");
|
||||
|
||||
|
@ -16,19 +16,28 @@
|
||||
#include <openssl/tls1.h>
|
||||
#include "testutil.h"
|
||||
|
||||
static int expect_failure = 0;
|
||||
|
||||
static int test_func(void)
|
||||
{
|
||||
int ret = 1;
|
||||
int ret = 0;
|
||||
SSL_CTX *ctx;
|
||||
|
||||
if (!TEST_ptr(ctx = SSL_CTX_new(TLS_method())))
|
||||
return 0;
|
||||
if (!TEST_int_eq(SSL_CTX_get_min_proto_version(ctx), TLS1_2_VERSION)
|
||||
&& !TEST_int_eq(SSL_CTX_get_max_proto_version(ctx), TLS1_2_VERSION)) {
|
||||
TEST_info("min/max version setting incorrect");
|
||||
ret = 0;
|
||||
ctx = SSL_CTX_new(TLS_method());
|
||||
if (expect_failure) {
|
||||
if (!TEST_ptr_null(ctx))
|
||||
goto err;
|
||||
} else {
|
||||
if (!TEST_ptr(ctx))
|
||||
return 0;
|
||||
if (!TEST_int_eq(SSL_CTX_get_min_proto_version(ctx), TLS1_2_VERSION)
|
||||
&& !TEST_int_eq(SSL_CTX_get_max_proto_version(ctx), TLS1_2_VERSION)) {
|
||||
TEST_info("min/max version setting incorrect");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
ret = 1;
|
||||
err:
|
||||
SSL_CTX_free(ctx);
|
||||
return ret;
|
||||
}
|
||||
@ -41,8 +50,39 @@ int global_init(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
typedef enum OPTION_choice {
|
||||
OPT_ERR = -1,
|
||||
OPT_EOF = 0,
|
||||
OPT_FAIL,
|
||||
OPT_TEST_ENUM
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS *test_get_options(void)
|
||||
{
|
||||
static const OPTIONS test_options[] = {
|
||||
OPT_TEST_OPTIONS_DEFAULT_USAGE,
|
||||
{ "f", OPT_FAIL, '-', "A failure is expected" },
|
||||
{ NULL }
|
||||
};
|
||||
return test_options;
|
||||
}
|
||||
|
||||
int setup_tests(void)
|
||||
{
|
||||
OPTION_CHOICE o;
|
||||
|
||||
while ((o = opt_next()) != OPT_EOF) {
|
||||
switch (o) {
|
||||
case OPT_FAIL:
|
||||
expect_failure = 1;
|
||||
break;
|
||||
case OPT_TEST_CASES:
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ADD_TEST(test_func);
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user