diff options
author | Micael Karlberg <[email protected]> | 2011-11-28 19:49:24 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-11-28 19:49:24 +0100 |
commit | 5df28c6c7d3c5948ff02ae197f1f11eff96cc68d (patch) | |
tree | eac37df59766a5810027999532c443b21ccb032c /lib/inets/test/inets_test_lib.erl | |
parent | 7de36e35a3409886495a19206bcef934b86e7614 (diff) | |
parent | ef692b0461b263a2025d289c31d8f491b53311e5 (diff) | |
download | otp-5df28c6c7d3c5948ff02ae197f1f11eff96cc68d.tar.gz otp-5df28c6c7d3c5948ff02ae197f1f11eff96cc68d.tar.bz2 otp-5df28c6c7d3c5948ff02ae197f1f11eff96cc68d.zip |
Merge branch 'bmk/inets/misc_test_improvements/OTP-9757' into 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 %% |