diff options
author | Siri Hansen <[email protected]> | 2012-05-21 11:08:58 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2012-05-21 11:08:58 +0200 |
commit | e4717301b73f2d7b2716b625e1b647b35d2815be (patch) | |
tree | 23cff0017f351c052d9bd375a57b47644b31adaf /lib/observer/test/crashdump_viewer_SUITE.erl | |
parent | 77842e72cb1780ac05b392256da511a7651f1258 (diff) | |
parent | dd0d187b13dfa6451e5044bcb0005cc399ebf6ab (diff) | |
download | otp-e4717301b73f2d7b2716b625e1b647b35d2815be.tar.gz otp-e4717301b73f2d7b2716b625e1b647b35d2815be.tar.bz2 otp-e4717301b73f2d7b2716b625e1b647b35d2815be.zip |
Merge branch 'siri/crashdump_viewer/crash-when-hash-in-module-name/OTP-10090' into maint
* siri/crashdump_viewer/crash-when-hash-in-module-name/OTP-10090:
[crashdump_viewer] URL encode module names in link to loaded module details
Diffstat (limited to 'lib/observer/test/crashdump_viewer_SUITE.erl')
-rw-r--r-- | lib/observer/test/crashdump_viewer_SUITE.erl | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/lib/observer/test/crashdump_viewer_SUITE.erl b/lib/observer/test/crashdump_viewer_SUITE.erl index 5bbce9d076..7478ae65a3 100644 --- a/lib/observer/test/crashdump_viewer_SUITE.erl +++ b/lib/observer/test/crashdump_viewer_SUITE.erl @@ -414,6 +414,10 @@ special(Port,File) -> _ -> ok end; + ".strangemodname" -> + AllMods = contents(Port,"loaded_modules"), + open_all_modules(Port,AllMods), + ok; %%! No longer needed - all atoms are shown on one page!! %% ".250atoms" -> %% Html1 = contents(Port,"atoms"), @@ -496,6 +500,26 @@ expand_binary_link(Html) -> expand_binary_link(T) end. +open_all_modules(Port,Modules) -> + case get_first_module(Modules) of + {Module,Rest} -> + ModuleDetails = contents(Port,"loaded_mod_details?mod=" ++ Module), + ModTitle = http_uri:decode(Module), + ModTitle = title(ModuleDetails), + open_all_modules(Port,Rest); + false -> + ok + end. + +get_first_module([]) -> + false; +get_first_module(Html) -> + case Html of + "<TD><A HREF=\"loaded_mod_details?mod=" ++ Rest -> + {string:sub_word(Rest,1,$"),Rest}; + [_H|T] -> + get_first_module(T) + end. %% next_link(Html) -> %% case Html of @@ -590,7 +614,8 @@ do_create_dumps(DataDir,Rel) -> case Rel of current -> CD3 = dump_with_args(DataDir,Rel,"instr","+Mim true"), - {SlAllocDumps, [CD1,CD2,CD3], DosDump}; + CD4 = dump_with_strange_module_name(DataDir,Rel,"strangemodname"), + {SlAllocDumps, [CD1,CD2,CD3,CD4], DosDump}; _ -> {SlAllocDumps, [CD1,CD2], DosDump} end. @@ -648,7 +673,22 @@ dump_with_args(DataDir,Rel,DumpName,Args) -> ?t:stop_node(n1), CD. +%% This dump is added to test OTP-10090 - regarding URL encoding of +%% module names in the module detail link. +dump_with_strange_module_name(DataDir,Rel,DumpName) -> + Opt = rel_opt(Rel), + {ok,N1} = ?t:start_node(n1,peer,Opt), + Mod = '<mod ule#with?strange%name>', + File = atom_to_list(Mod) ++ ".erl", + Forms = [{attribute,1,file,{File,1}}, + {attribute,1,module,Mod}, + {eof,4}], + {ok,Mod,Bin} = rpc:call(N1,compile,forms,[Forms,[binary]]), + {module,Mod} = rpc:call(N1,code,load_binary,[Mod,File,Bin]), + CD = dump(N1,DataDir,Rel,DumpName), + ?t:stop_node(n1), + CD. dump(Node,DataDir,Rel,DumpName) -> rpc:call(Node,erlang,halt,[DumpName]), |