From 481be8b29d75570cf2b60f86f2e4ead79ceea2bb Mon Sep 17 00:00:00 2001 From: Magnus Henoch Date: Fri, 9 Sep 2016 18:11:02 +0100 Subject: Skip FIPS tests if we cannot enable FIPS mode Even if Erlang/OTP has been built with --enable-fips, it's possible that the OpenSSL library we're linked to doesn't support FIPS mode. In that case, it will fail to enable it at run time. Let's handle that in crypto_SUITE, by skipping the tests instead of failing. --- lib/crypto/test/blowfish_SUITE.erl | 10 +++++++--- lib/crypto/test/crypto_SUITE.erl | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'lib/crypto/test') diff --git a/lib/crypto/test/blowfish_SUITE.erl b/lib/crypto/test/blowfish_SUITE.erl index c45aae6916..a78f8fe39a 100644 --- a/lib/crypto/test/blowfish_SUITE.erl +++ b/lib/crypto/test/blowfish_SUITE.erl @@ -119,9 +119,13 @@ init_per_group(fips, Config) -> enabled -> Config; not_enabled -> - true = crypto:enable_fips_mode(true), - enabled = crypto:info_fips(), - Config; + case crypto:enable_fips_mode(true) of + true -> + enabled = crypto:info_fips(), + Config; + false -> + {skip, "Failed to enable FIPS mode"} + end; not_supported -> {skip, "FIPS mode not supported"} end; diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl index ec8c157d37..02b25ce62f 100644 --- a/lib/crypto/test/crypto_SUITE.erl +++ b/lib/crypto/test/crypto_SUITE.erl @@ -197,9 +197,13 @@ init_per_group(fips, Config) -> enabled -> FIPSConfig; not_enabled -> - true = crypto:enable_fips_mode(true), - enabled = crypto:info_fips(), - FIPSConfig; + case crypto:enable_fips_mode(true) of + true -> + enabled = crypto:info_fips(), + FIPSConfig; + false -> + {skip, "Failed to enable FIPS mode"} + end; not_supported -> {skip, "FIPS mode not supported"} end; -- cgit v1.2.3