aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/test/xref_SUITE.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-09-15 07:58:04 +0200
committerHans Bolinder <[email protected]>2017-09-15 07:58:04 +0200
commit01dbddbcdd4afa33cc7e93fd3583e32120466394 (patch)
tree1e3c014ec7c173101a38b5e4fbca5969ea97706c /lib/tools/test/xref_SUITE.erl
parent29c8936ac73bfff98dddcfcc3b48e169f28c06d6 (diff)
parent40ab89f78863b17f8657b8c4575b4a904eb395ae (diff)
downloadotp-01dbddbcdd4afa33cc7e93fd3583e32120466394.tar.gz
otp-01dbddbcdd4afa33cc7e93fd3583e32120466394.tar.bz2
otp-01dbddbcdd4afa33cc7e93fd3583e32120466394.zip
Merge branch 'maint'
* maint: tools: Add handling of the -on_load() attribute to Xref tools: Correction of xref(3)
Diffstat (limited to 'lib/tools/test/xref_SUITE.erl')
-rw-r--r--lib/tools/test/xref_SUITE.erl34
1 files changed, 31 insertions, 3 deletions
diff --git a/lib/tools/test/xref_SUITE.erl b/lib/tools/test/xref_SUITE.erl
index 379a5c09ab..d651cbcfee 100644
--- a/lib/tools/test/xref_SUITE.erl
+++ b/lib/tools/test/xref_SUITE.erl
@@ -51,7 +51,7 @@
-export([analyze/1, basic/1, md/1, q/1, variables/1, unused_locals/1]).
-export([format_error/1, otp_7423/1, otp_7831/1, otp_10192/1, otp_13708/1,
- otp_14464/1]).
+ otp_14464/1, otp_14344/1]).
-import(lists, [append/2, flatten/1, keysearch/3, member/2, sort/1, usort/1]).
@@ -85,7 +85,7 @@ groups() ->
[analyze, basic, md, q, variables, unused_locals]},
{misc, [], [format_error, otp_7423, otp_7831, otp_10192, otp_13708,
- otp_14464]}].
+ otp_14464, otp_14344]}].
init_per_suite(Conf) when is_list(Conf) ->
@@ -2441,6 +2441,30 @@ otp_14464(Conf) when is_list(Conf) ->
ok = file:delete(File1),
ok = file:delete(Beam1).
+%% OTP-14344. -on_load() attribute.
+otp_14344(Conf) when is_list(Conf) ->
+ Dir = ?copydir,
+
+ File1 = fname(Dir, "a.erl"),
+ MFile1 = fname(Dir, "a"),
+ Beam1 = fname(Dir, "a.beam"),
+ Test1 = <<"-module(a).
+ -on_load(doit/0).
+ doit() -> ok.
+ ">>,
+ ok = file:write_file(File1, Test1),
+ {ok, a} = compile:file(File1, [debug_info,{outdir,Dir}]),
+
+ {ok, _} = xref:start(s),
+ {ok, a} = xref:add_module(s, MFile1),
+
+ {ok, [{a,doit,0}]} = xref:q(s, "OL"),
+ {ok, []} = xref:analyze(s, locals_not_used),
+
+ xref:stop(s),
+ ok = file:delete(File1),
+ ok = file:delete(Beam1).
+
%%%
%%% Utilities
%%%
@@ -2515,7 +2539,8 @@ add_module(S, XMod, DefAt, X, LCallAt, XCallAt, XC, LC) ->
Depr0 = {[], [], [], []},
DBad = [],
Depr = {Depr0,DBad},
- Data = {DefAt, LCallAt, XCallAt, LC, XC, X, Attr, Depr},
+ OL = [],
+ Data = {DefAt, LCallAt, XCallAt, LC, XC, X, Attr, Depr, OL},
Unres = [],
{ok, _Module, _Bad, State} =
xref_base:do_add_module(S, XMod, Unres, Data),
@@ -2596,6 +2621,9 @@ functions_mode_check(S, Info) ->
%% UU subset F
{ok, []} = xref:q(S, "UU - F"),
+ %% OL subset F
+ {ok, []} = xref:q(S, "OL - F"),
+
%% ME = (Mod) E
{ok, ME} = xref:q(S, "ME"),
{ok, ME} = xref:q(S, "(Mod) E"),