aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2011-12-05 15:06:43 +0100
committerAnders Svensson <[email protected]>2011-12-05 15:28:44 +0100
commit9ff1e2673ce71cc6eb67a1a630ad5a2e485cbea8 (patch)
treed9a4a63d8f0be7a64a70ed70ca6f38fdb6c9dd6f /lib
parent16502f6af64fcc9eafe01a118d7c8c1a29073a66 (diff)
downloadotp-9ff1e2673ce71cc6eb67a1a630ad5a2e485cbea8.tar.gz
otp-9ff1e2673ce71cc6eb67a1a630ad5a2e485cbea8.tar.bz2
otp-9ff1e2673ce71cc6eb67a1a630ad5a2e485cbea8.zip
Check compiler dependencies in app suite
After having added a less than stellar dependency that broke the build. Parallel make could succeed by chance but not sequential. This ensures the error doesn't get past test.
Diffstat (limited to 'lib')
-rw-r--r--lib/diameter/test/diameter_app_SUITE.erl46
1 files changed, 32 insertions, 14 deletions
diff --git a/lib/diameter/test/diameter_app_SUITE.erl b/lib/diameter/test/diameter_app_SUITE.erl
index 88bd542eb8..7da145fb3b 100644
--- a/lib/diameter/test/diameter_app_SUITE.erl
+++ b/lib/diameter/test/diameter_app_SUITE.erl
@@ -41,6 +41,19 @@
-define(A, list_to_atom).
+%% Modules not in the app and that should not have dependencies on it
+%% for build reasons.
+-define(COMPILER_MODULES, [diameter_codegen,
+ diameter_dict_scanner,
+ diameter_dict_parser,
+ diameter_dict_util,
+ diameter_exprecs,
+ diameter_make]).
+
+-define(HELP_MODULES, [diameter_callback,
+ diameter_dbg,
+ diameter_info]).
+
%% ===========================================================================
suite() ->
@@ -93,15 +106,8 @@ vsn(Config) ->
modules(Config) ->
Mods = fetch(modules, fetch(app, Config)),
Installed = code_mods(),
- Help = [diameter_callback,
- diameter_codegen,
- diameter_dbg,
- diameter_dict_parser,
- diameter_dict_scanner,
- diameter_dict_util,
- diameter_exprecs,
- diameter_info,
- diameter_make],
+ Help = lists:sort(?HELP_MODULES ++ ?COMPILER_MODULES),
+
{[], Help} = {Mods -- Installed, lists:sort(Installed -- Mods)}.
code_mods() ->
@@ -168,14 +174,12 @@ xref(Config) ->
%% stop xref from complaining about calls to module erlang, which
%% was previously in kernel. Erts isn't an application however, in
%% the sense that there's no .app file, and isn't listed in
- %% applications. Seems less than ideal. Also, diameter_tcp does
- %% call ssl despite ssl not being listed as a dependency in the
- %% app file since ssl is only required for TLS security: it's up
- %% to a client who wants TLS it to start ssl.
+ %% applications.
ok = lists:foreach(fun(A) -> add_application(XRef, A) end,
[?APP, erts | fetch(applications, App)]),
{ok, Undefs} = xref:analyze(XRef, undefined_function_calls),
+ {ok, Called} = xref:analyze(XRef, {module_call, ?COMPILER_MODULES}),
xref:stop(XRef),
@@ -184,7 +188,21 @@ xref(Config) ->
lists:member(F, Mods)
andalso {F,T} /= {diameter_tcp, ssl}
end,
- Undefs).
+ Undefs),
+ %% diameter_tcp does call ssl despite the latter not being listed
+ %% as a dependency in the app file since ssl is only required for
+ %% TLS security: it's up to a client who wants TLS it to start
+ %% ssl.
+
+ [] = lists:filter(fun is_bad_dependency/1, Called).
+
+%% It's not strictly necessary that diameter compiler modules not
+%% depend on other diameter modules but it's a simple source of build
+%% errors if not encoded in the makefile (hence the test) so guard
+%% against it.
+is_bad_dependency(Mod) ->
+ lists:prefix("diameter", atom_to_list(Mod))
+ andalso not lists:member(Mod, ?COMPILER_MODULES).
add_application(XRef, App) ->
add_application(XRef, App, code:lib_dir(App)).