File 0087-inets-Do-not-test-https-ftps-if-crypto-can-not-start.patch of Package erlang

From 8ebf838c8391c5b373f82acdfa3b60245cab2de7 Mon Sep 17 00:00:00 2001
From: Ingela Anderton Andin <ingela@erlang.org>
Date: Fri, 31 Mar 2017 17:31:10 +0200
Subject: [PATCH] inets: Do not test https/ftps if crypto can not start

---
 lib/inets/test/ftp_SUITE.erl   | 19 ++++++++++++++++---
 lib/inets/test/httpc_SUITE.erl | 22 +++++++++-------------
 lib/inets/test/httpd_SUITE.erl | 18 ++++++++++++++++--
 3 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/lib/inets/test/ftp_SUITE.erl b/lib/inets/test/ftp_SUITE.erl
index e2dec0c42..0f1fa96c6 100644
--- a/lib/inets/test/ftp_SUITE.erl
+++ b/lib/inets/test/ftp_SUITE.erl
@@ -191,9 +191,22 @@ end_per_suite(Config) ->
     ok.
 
 %%--------------------------------------------------------------------
-init_per_group(_Group, Config) -> Config.
-    
-end_per_group(_Group, Config) -> Config.
+init_per_group(Group, Config) when Group == ftps_active,
+                                   Group == ftps_passive ->
+    catch crypto:stop(),
+    try crypto:start() of
+        ok ->
+            Config
+    catch
+        _:_ ->
+            {skip, "Crypto did not start"}
+    end;
+
+init_per_group(_Group, Config) -> 
+    Config.
+
+end_per_group(_Group, Config) -> 
+    Config.
 
 %%--------------------------------------------------------------------
 init_per_testcase(Case, Config0) ->
diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl
index 8aea38037..67aa78aa0 100644
--- a/lib/inets/test/httpc_SUITE.erl
+++ b/lib/inets/test/httpc_SUITE.erl
@@ -163,21 +163,17 @@ init_per_group(misc = Group, Config) ->
     ok = httpc:set_options([{ipfamily, Inet}]),
     Config;
 
+
 init_per_group(Group, Config0) when Group =:= sim_https; Group =:= https->
-    ct:timetrap({seconds, 30}),
-    start_apps(Group),
-    StartSsl = try ssl:start()
+    catch crypto:stop(),
+    try crypto:start() of
+        ok ->
+            ct:timetrap({seconds, 30}),
+            start_apps(Group),
+            do_init_per_group(Group, Config0)
     catch
-	Error:Reason ->
-	    {skip, lists:flatten(io_lib:format("Failed to start apps for https Error=~p Reason=~p", [Error, Reason]))}
-    end,
-    case StartSsl of
-	{error, {already_started, _}} ->
-	    do_init_per_group(Group, Config0);
-	ok ->
-	    do_init_per_group(Group, Config0);
-	_ ->
-	    StartSsl
+        _:_ ->
+            {skip, "Crypto did not start"}
     end;
 
 init_per_group(Group, Config0) ->
diff --git a/lib/inets/test/httpd_SUITE.erl b/lib/inets/test/httpd_SUITE.erl
index aae4ce525..44b1e09cb 100644
--- a/lib/inets/test/httpd_SUITE.erl
+++ b/lib/inets/test/httpd_SUITE.erl
@@ -197,7 +197,14 @@ init_per_group(Group, Config0) when Group == https_basic;
 				    Group == https_security;
 				    Group == https_reload
 				    ->
-    init_ssl(Group, Config0);
+    catch crypto:stop(),
+    try crypto:start() of
+        ok ->
+            init_ssl(Group, Config0)
+    catch
+        _:_ ->
+            {skip, "Crypto did not start"}
+    end; 
 init_per_group(Group, Config0)  when  Group == http_basic;
 				      Group == http_limit;
 				      Group == http_custom;
@@ -232,7 +239,14 @@ init_per_group(https_htaccess = Group, Config) ->
     Path = proplists:get_value(doc_root, Config),
     catch remove_htaccess(Path),
     create_htaccess_data(Path, proplists:get_value(address, Config)),
-    init_ssl(Group, Config); 
+    catch crypto:stop(),
+    try crypto:start() of
+        ok ->
+            init_ssl(Group, Config)
+    catch
+        _:_ ->
+            {skip, "Crypto did not start"}
+    end; 
 init_per_group(auth_api, Config) -> 
     [{auth_prefix, ""} | Config];
 init_per_group(auth_api_dets, Config) -> 
-- 
2.12.2

openSUSE Build Service is sponsored by