Skip to content

Commit

Permalink
display an error if a test app fails to load
Browse files Browse the repository at this point in the history
  • Loading branch information
beerriot committed Feb 25, 2011
1 parent 3acc34d commit b42ad28
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions test/test_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ stop_riak() ->

load_and_start_apps([]) -> ok;
load_and_start_apps([App|Tail]) ->
application:load(App),
application:start(App),
ensure_loaded(App),
ensure_started(App),
load_and_start_apps(Tail).

ensure_loaded(App) ->
case application:load(App) of
ok ->
ok;
{error,{already_loaded,App}} ->
ok;
Error ->
throw({"failed to load", App, Error})
end.

ensure_started(App) ->
case application:start(App) of
ok ->
ok;
{error,{already_started,App}} ->
ok;
Error ->
throw({"failed to start", App, Error})
end.

0 comments on commit b42ad28

Please sign in to comment.