Browse Source

Check for the SSL version for SNI instead of Makefile

Loïc Hoguin 8 years ago
parent
commit
237f9e7053
2 changed files with 17 additions and 16 deletions
  1. 2 9
      Makefile
  2. 15 7
      test/acceptor_SUITE.erl

+ 2 - 9
Makefile

@@ -8,19 +8,12 @@ COMPILE_FIRST = ranch_transport
 CT_OPTS += -pa test -ct_hooks ranch_ct_hook []
 CT_OPTS += -pa test -ct_hooks ranch_ct_hook []
 PLT_APPS = crypto public_key ssl
 PLT_APPS = crypto public_key ssl
 
 
-CI_OTP_NO_SNI = \
+CI_OTP ?= \
 	OTP_R16B OTP_R16B01 OTP_R16B02 OTP_R16B03-1 \
 	OTP_R16B OTP_R16B01 OTP_R16B02 OTP_R16B03-1 \
-	OTP-17.1.2 OTP-17.2.2 OTP-17.3.4 OTP-17.4.1 OTP-17.5.6.6
-CI_OTP ?= $(CI_OTP_NO_SNI) \
+	OTP-17.1.2 OTP-17.2.2 OTP-17.3.4 OTP-17.4.1 OTP-17.5.6.6 \
 	OTP-18.0.3 OTP-18.1.5 OTP-18.2.4.1 OTP-18.3.4.4 \
 	OTP-18.0.3 OTP-18.1.5 OTP-18.2.4.1 OTP-18.3.4.4 \
 	OTP-19.0.7 OTP-19.1.5
 	OTP-19.0.7 OTP-19.1.5
 
 
-ifdef CI_OTP_RELEASE
-ifneq ($(filter $(CI_OTP_RELEASE),$(CI_OTP_NO_SNI)),)
-TEST_ERLC_OPTS += -DTEST_NO_SNI=1
-endif
-endif
-
 # Dependencies.
 # Dependencies.
 
 
 TEST_DEPS = ct_helper
 TEST_DEPS = ct_helper

+ 15 - 7
test/acceptor_SUITE.erl

@@ -134,14 +134,15 @@ ssl_echo(_) ->
 	{'EXIT', _} = begin catch ranch:get_port(Name) end,
 	{'EXIT', _} = begin catch ranch:get_port(Name) end,
 	ok.
 	ok.
 
 
--ifdef(TEST_NO_SNI).
 ssl_sni_echo(_) ->
 ssl_sni_echo(_) ->
-	{skip, "No SNI support."}.
+	case application:get_key(ssl, vsn) of
+		{ok, Vsn} when Vsn >= "7.0" ->
+			do_ssl_sni_echo();
+		_ ->
+			{skip, "No SNI support."}
+	end.
 
 
-ssl_sni_fail(_) ->
-	{skip, "No SNI support."}.
--else.
-ssl_sni_echo(_) ->
+do_ssl_sni_echo() ->
 	doc("Ensure that SNI works with SSL transport."),
 	doc("Ensure that SNI works with SSL transport."),
 	Name = name(),
 	Name = name(),
 	Opts = ct_helper:get_certs_from_ets(),
 	Opts = ct_helper:get_certs_from_ets(),
@@ -157,6 +158,14 @@ ssl_sni_echo(_) ->
 	ok.
 	ok.
 
 
 ssl_sni_fail(_) ->
 ssl_sni_fail(_) ->
+	case application:get_key(ssl, vsn) of
+		{ok, Vsn} when Vsn >= "7.0" ->
+			do_ssl_sni_fail();
+		_ ->
+			{skip, "No SNI support."}
+	end.
+
+do_ssl_sni_fail() ->
 	doc("Ensure that connection fails when host is not in SNI list."),
 	doc("Ensure that connection fails when host is not in SNI list."),
 	Name = name(),
 	Name = name(),
 	Opts = ct_helper:get_certs_from_ets(),
 	Opts = ct_helper:get_certs_from_ets(),
@@ -167,7 +176,6 @@ ssl_sni_fail(_) ->
 	%% Make sure the listener stopped.
 	%% Make sure the listener stopped.
 	{'EXIT', _} = begin catch ranch:get_port(Name) end,
 	{'EXIT', _} = begin catch ranch:get_port(Name) end,
 	ok.
 	ok.
--endif.
 
 
 %% tcp.
 %% tcp.