From f703d6512219431fa7fe61e5ddd1a9ed32506daa Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Wed, 13 Jul 2011 18:17:36 +0200 Subject: Fix problem with logdir string and some other minor bugs OTP-9370: Fix problem with crash if logdir contains multiple dirs OTP-9155: Fix some minor remaining bugs --- lib/common_test/src/ct_logs.erl | 40 ++++++++++++++++++++-------------------- lib/common_test/src/ct_run.erl | 13 +++++++++++++ 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/lib/common_test/src/ct_logs.erl b/lib/common_test/src/ct_logs.erl index 5c4eb88c1f..761b906392 100644 --- a/lib/common_test/src/ct_logs.erl +++ b/lib/common_test/src/ct_logs.erl @@ -124,27 +124,27 @@ close(Info, StartDir) -> ok; Error -> io:format("Warning! Cleanup failed: ~p~n", [Error]) - end; + end, + make_all_suites_index(stop), + make_all_runs_index(stop); true -> - file:set_cwd("..") - end, - - make_all_suites_index(stop), - make_all_runs_index(stop), - - case ct_util:get_profile_data(browser, StartDir) of - undefined -> - ok; - BrowserData -> - case {proplists:get_value(prog, BrowserData), - proplists:get_value(args, BrowserData), - proplists:get_value(page, BrowserData)} of - {Prog,Args,Page} when is_list(Args), - is_list(Page) -> - URL = "file://" ++ ?abs(Page), - ct_util:open_url(Prog, Args, URL); - _ -> - ok + file:set_cwd(".."), + make_all_suites_index(stop), + make_all_runs_index(stop), + case ct_util:get_profile_data(browser, StartDir) of + undefined -> + ok; + BrowserData -> + case {proplists:get_value(prog, BrowserData), + proplists:get_value(args, BrowserData), + proplists:get_value(page, BrowserData)} of + {Prog,Args,Page} when is_list(Args), + is_list(Page) -> + URL = "\"file://" ++ ?abs(Page) ++ "\"", + ct_util:open_url(Prog, Args, URL); + _ -> + ok + end end end, ok. diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl index 00b5a53cf4..418e212fd1 100644 --- a/lib/common_test/src/ct_run.erl +++ b/lib/common_test/src/ct_run.erl @@ -157,6 +157,7 @@ script_start(Args) -> end, stop_trace(Tracing), timer:sleep(1000), + io:nl(), Res. script_start1(Parent, Args) -> @@ -2155,6 +2156,18 @@ get_start_opt(Key, IfExists, Args) -> get_start_opt(Key, IfExists, undefined, Args). get_start_opt(Key, IfExists, IfNotExists, Args) -> + try try_get_start_opt(Key, IfExists, IfNotExists, Args) of + Result -> + Result + catch + error:_ -> + exit({user_error,{bad_argument,Key}}) + end. + +try_get_start_opt(Key, IfExists, Args) -> + try_get_start_opt(Key, IfExists, undefined, Args). + +try_get_start_opt(Key, IfExists, IfNotExists, Args) -> case lists:keysearch(Key, 1, Args) of {value,{Key,Val}} when is_function(IfExists) -> IfExists(Val); -- cgit v1.2.3