diff options
author | Björn Gustavsson <[email protected]> | 2015-07-02 10:19:56 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-07-02 12:29:36 +0200 |
commit | 16317f73f79265eba8e0cef4adaea6f6858d389b (patch) | |
tree | 94fe556d17f0f879f92cb03161291f7bf3a22449 /erts/emulator | |
parent | 0d69dcf52f190c29ba1778bc61f030e6379f4379 (diff) | |
download | otp-16317f73f79265eba8e0cef4adaea6f6858d389b.tar.gz otp-16317f73f79265eba8e0cef4adaea6f6858d389b.tar.bz2 otp-16317f73f79265eba8e0cef4adaea6f6858d389b.zip |
Add a smoke test of erts_debug:df/1
Run erts_debug:df/1 for all loaded modules. On my reasonably fast,
modern computer this test case runs in approximately 10 seconds.
To avoid spending many minutes running this test case on older
computers, limit the running time to 20 seconds.
While we are at it, remove all ?line macros.
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/test/erts_debug_SUITE.erl | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/erts/emulator/test/erts_debug_SUITE.erl b/erts/emulator/test/erts_debug_SUITE.erl index 3dd77eb920..35677f9953 100644 --- a/erts/emulator/test/erts_debug_SUITE.erl +++ b/erts/emulator/test/erts_debug_SUITE.erl @@ -139,23 +139,48 @@ flat_size_big_1(Term, Size0, Limit) when Size0 < Limit -> flat_size_big_1(_, _, _) -> ok. df(Config) when is_list(Config) -> - ?line P0 = pps(), - ?line PrivDir = ?config(priv_dir, Config), - ?line ok = file:set_cwd(PrivDir), - ?line erts_debug:df(?MODULE), - ?line Beam = filename:join(PrivDir, ?MODULE_STRING++".dis"), - ?line {ok,Bin} = file:read_file(Beam), - ?line ok = io:put_chars(binary_to_list(Bin)), - ?line ok = file:delete(Beam), - ?line true = (P0 == pps()), + P0 = pps(), + PrivDir = ?config(priv_dir, Config), + ok = file:set_cwd(PrivDir), + + AllLoaded = [M || {M,_} <- code:all_loaded()], + {Pid,Ref} = spawn_monitor(fun() -> df_smoke(AllLoaded) end), + receive + {'DOWN',Ref,process,Pid,Status} -> + normal = Status + after 20*1000 -> + %% Not finished (i.e. a slow computer). Stop now. + Pid ! stop, + receive + {'DOWN',Ref,process,Pid,Status} -> + normal = Status, + io:format("...") + end + end, + io:nl(), + _ = [_ = file:delete(atom_to_list(M) ++ ".dis") || + M <- AllLoaded], + + true = (P0 == pps()), ok. +df_smoke([M|Ms]) -> + io:format("~p", [M]), + erts_debug:df(M), + receive + stop -> + ok + after 0 -> + df_smoke(Ms) + end; +df_smoke([]) -> ok. + pps() -> {erlang:ports()}. instructions(Config) when is_list(Config) -> - ?line Is = erts_debug:instructions(), - ?line _ = [list_to_atom(I) || I <- Is], + Is = erts_debug:instructions(), + _ = [list_to_atom(I) || I <- Is], ok. id(I) -> |