aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2016-03-02 09:39:33 +0100
committerSiri Hansen <[email protected]>2016-03-02 09:39:33 +0100
commitd0a4ed3dbc5e6bd92253ced1ed31720fae1e9411 (patch)
tree309a8b7d453beb691e914ee7788202a819bb5bb8
parente1489c448b7486cdcfec6a89fea238d88e6ce2f3 (diff)
parent51349126632b3ce589f217abe5dcfb7b1e47faa1 (diff)
downloadotp-d0a4ed3dbc5e6bd92253ced1ed31720fae1e9411.tar.gz
otp-d0a4ed3dbc5e6bd92253ced1ed31720fae1e9411.tar.bz2
otp-d0a4ed3dbc5e6bd92253ced1ed31720fae1e9411.zip
Merge branch 'siri/crashdump-dir/OTP-13388' into maint
* siri/crashdump-dir/OTP-13388: Set dir for slave node's erl_crash.dump
-rw-r--r--lib/common_test/src/ct_framework.erl7
-rw-r--r--lib/observer/test/crashdump_viewer_SUITE.erl19
-rw-r--r--lib/test_server/src/test_server.erl2
-rw-r--r--lib/test_server/src/test_server_internal.hrl1
-rw-r--r--lib/test_server/src/test_server_node.erl13
-rw-r--r--lib/test_server/src/test_server_sup.erl3
6 files changed, 18 insertions, 27 deletions
diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl
index f792269c41..8fb7a03bb0 100644
--- a/lib/common_test/src/ct_framework.erl
+++ b/lib/common_test/src/ct_framework.erl
@@ -28,7 +28,7 @@
-export([init_tc/3, end_tc/3, end_tc/4, get_suite/2, get_all_cases/1]).
-export([report/2, warn/1, error_notification/4]).
--export([get_logopts/0, format_comment/1, get_html_wrapper/4]).
+-export([get_log_dir/0, get_logopts/0, format_comment/1, get_html_wrapper/4]).
-export([error_in_suite/1, init_per_suite/1, end_per_suite/1,
init_per_group/2, end_per_group/2]).
@@ -1480,3 +1480,8 @@ get_html_wrapper(TestName, PrintLabel, Cwd, TableCols) ->
get_html_wrapper(TestName, PrintLabel, Cwd, TableCols, Encoding) ->
ct_logs:get_ts_html_wrapper(TestName, PrintLabel, Cwd, TableCols, Encoding).
+
+%%%-----------------------------------------------------------------
+%%% @spec get_log_dir() -> {ok,LogDir}
+get_log_dir() ->
+ ct_logs:get_log_dir(true).
diff --git a/lib/observer/test/crashdump_viewer_SUITE.erl b/lib/observer/test/crashdump_viewer_SUITE.erl
index 84af440245..eae4ee01b9 100644
--- a/lib/observer/test/crashdump_viewer_SUITE.erl
+++ b/lib/observer/test/crashdump_viewer_SUITE.erl
@@ -564,22 +564,11 @@ dump_with_strange_module_name(DataDir,Rel,DumpName) ->
CD.
dump(Node,DataDir,Rel,DumpName) ->
+ Crashdump = filename:join(DataDir, dump_prefix(Rel)++DumpName),
+ rpc:call(Node,os,putenv,["ERL_CRASH_DUMP",Crashdump]),
rpc:call(Node,erlang,halt,[DumpName]),
- Crashdump0 = filename:join(filename:dirname(code:which(?t)),
- "erl_crash_dump.n1"),
- Crashdump1 = filename:join(DataDir, dump_prefix(Rel)++DumpName),
- ok = rename(Crashdump0,Crashdump1),
- Crashdump1.
-
-rename(From,To) ->
- ok = check_complete(From),
- case file:rename(From,To) of
- {error,exdev} ->
- {ok,_} = file:copy(From,To),
- ok = file:delete(From);
- ok ->
- ok
- end.
+ ok = check_complete(Crashdump),
+ Crashdump.
check_complete(File) ->
check_complete1(File,10).
diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl
index 73803030a3..671674c617 100644
--- a/lib/test_server/src/test_server.erl
+++ b/lib/test_server/src/test_server.erl
@@ -63,13 +63,11 @@
init_target_info() ->
[$.|Emu] = code:objfile_extension(),
{_, OTPRel} = init:script_id(),
- TestServerDir = filename:absname(filename:dirname(code:which(?MODULE))),
#target_info{os_family=test_server_sup:get_os_family(),
os_type=os:type(),
version=erlang:system_info(version),
system_version=erlang:system_info(system_version),
root_dir=code:root_dir(),
- test_server_dir=TestServerDir,
emulator=Emu,
otp_release=OTPRel,
username=test_server_sup:get_username(),
diff --git a/lib/test_server/src/test_server_internal.hrl b/lib/test_server/src/test_server_internal.hrl
index 578f359010..1ec2d83417 100644
--- a/lib/test_server/src/test_server_internal.hrl
+++ b/lib/test_server/src/test_server_internal.hrl
@@ -30,7 +30,6 @@
version, % string()
system_version, % string()
root_dir, % string()
- test_server_dir, % string()
emulator, % string()
otp_release, % string()
username, % string()
diff --git a/lib/test_server/src/test_server_node.erl b/lib/test_server/src/test_server_node.erl
index 70cc2625d4..37f8941d24 100644
--- a/lib/test_server/src/test_server_node.erl
+++ b/lib/test_server/src/test_server_node.erl
@@ -307,11 +307,11 @@ start_node_peer(SlaveName, OptList, From, TI) ->
HostStr, " ", WaitPort]),
% Support for erl_crash_dump files..
- CrashFile = filename:join([TI#target_info.test_server_dir,
+ CrashDir = test_server_sup:crash_dump_dir(),
+ CrashFile = filename:join([CrashDir,
"erl_crash_dump."++cast_to_list(SlaveName)]),
CrashArgs = lists:concat([" -env ERL_CRASH_DUMP \"",CrashFile,"\" "]),
FailOnError = start_node_get_option_value(fail_on_error, OptList, true),
- Pa = TI#target_info.test_server_dir,
Prog0 = start_node_get_option_value(erl, OptList, default),
Prog = quote_progname(pick_erl_program(Prog0)),
Args =
@@ -322,7 +322,6 @@ start_node_peer(SlaveName, OptList, From, TI) ->
Cmd = lists:concat([Prog,
" -detached ",
TI#target_info.naming, " ", SlaveName,
- " -pa \"", Pa,"\"",
NodeStarted,
CrashArgs,
" ", Args]),
@@ -370,15 +369,15 @@ wait_for_node_started_fun(LSock, Tmo, Cleanup, TI, Self) ->
%% Slave nodes are started on a remote host if
%% - the option remote is given when calling test_server:start_node/3
%%
-start_node_slave(SlaveName, OptList, From, TI) ->
+start_node_slave(SlaveName, OptList, From, _TI) ->
SuppliedArgs = start_node_get_option_value(args, OptList, []),
Cleanup = start_node_get_option_value(cleanup, OptList, true),
- CrashFile = filename:join([TI#target_info.test_server_dir,
+ CrashDir = test_server_sup:crash_dump_dir(),
+ CrashFile = filename:join([CrashDir,
"erl_crash_dump."++cast_to_list(SlaveName)]),
CrashArgs = lists:concat([" -env ERL_CRASH_DUMP \"",CrashFile,"\" "]),
- Pa = TI#target_info.test_server_dir,
- Args = lists:concat([" -pa \"", Pa, "\" ", SuppliedArgs, CrashArgs]),
+ Args = lists:concat([" ", SuppliedArgs, CrashArgs]),
Prog0 = start_node_get_option_value(erl, OptList, default),
Prog = pick_erl_program(Prog0),
diff --git a/lib/test_server/src/test_server_sup.erl b/lib/test_server/src/test_server_sup.erl
index fc2cfd57bd..1c0eb18d70 100644
--- a/lib/test_server/src/test_server_sup.erl
+++ b/lib/test_server/src/test_server_sup.erl
@@ -594,7 +594,8 @@ cleanup_crash_dumps() ->
delete_files(Dumps).
crash_dump_dir() ->
- filename:dirname(code:which(?MODULE)).
+ {ok,Dir} = test_server_sup:framework_call(get_log_dir,[]),
+ Dir.
tar_crash_dumps() ->
Dir = crash_dump_dir(),