diff options
author | Micael Karlberg <[email protected]> | 2011-12-01 12:27:45 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-12-01 12:27:45 +0100 |
commit | 38bb19c5c4bdeeb4d54a62d687d9371eb7976c3f (patch) | |
tree | 230fc0054d2394885a2512017649b769b8ea26ad /lib/inets/test/inets_test_lib.erl | |
parent | 3cf5f67f3545cc82147706cc83febc242f6e469a (diff) | |
parent | 5df28c6c7d3c5948ff02ae197f1f11eff96cc68d (diff) | |
download | otp-38bb19c5c4bdeeb4d54a62d687d9371eb7976c3f.tar.gz otp-38bb19c5c4bdeeb4d54a62d687d9371eb7976c3f.tar.bz2 otp-38bb19c5c4bdeeb4d54a62d687d9371eb7976c3f.zip |
Merge branch 'bmk/inets/inets58_integration2'
Diffstat (limited to 'lib/inets/test/inets_test_lib.erl')
-rw-r--r-- | lib/inets/test/inets_test_lib.erl | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/inets/test/inets_test_lib.erl b/lib/inets/test/inets_test_lib.erl index ddb1a49394..bbed35e1f8 100644 --- a/lib/inets/test/inets_test_lib.erl +++ b/lib/inets/test/inets_test_lib.erl @@ -35,6 +35,7 @@ -export([check_body/1]). -export([millis/0, millis_diff/2, hours/1, minutes/1, seconds/1, sleep/1]). -export([oscmd/1, has_ipv6_support/1]). +-export([ensure_started/1]). -export([non_pc_tc_maybe_skip/4, os_based_skip/1, skip/3, fail/3]). -export([flush/0]). -export([start_node/1, stop_node/1]). @@ -126,6 +127,37 @@ await_stopped(Node, N) -> %% ---------------------------------------------------------------- +%% Ensure apps are started +%% This to ensure we dont attempt to run teatcases on platforms +%% where there is no working ssl app. + +ensure_started([]) -> + ok; +ensure_started([App|Apps]) -> + ensure_started(App), + ensure_started(Apps); +ensure_started(crypto = App) -> + %% We have to treat crypto in this special way because + %% only this function ensures that the NIF lib is actually + %% loaded. And only by loading that lib can we know if it + %% is even possible to run crypto. + do_ensure_started(App, fun() -> crypto:start() end); +ensure_started(App) when is_atom(App) -> + do_ensure_started(App, fun() -> application:start(App) end). + +do_ensure_started(App, Start) when is_function(Start) -> + case (catch Start()) of + ok -> + ok; + {error, {already_started, _}} -> + ok; + Error -> + throw({error, {failed_starting, App, Error}}) + end. + + + +%% ---------------------------------------------------------------- %% HTTPD starter functions %% |