diff options
author | Micael Karlberg <[email protected]> | 2011-03-03 18:50:00 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-03-03 18:50:00 +0100 |
commit | 890ccb33dd4ffd754a232a676433b3bc3b469bc0 (patch) | |
tree | 972909d298ae9c5ebdb8cf664bb65696894d5fb8 /lib/snmp/test/snmp_app_test.erl | |
parent | 62d32fe953ba33d441e1511e1d548fd55c51ab36 (diff) | |
parent | 24c45e5d18eafbc8fc85b0c49622980dac3f6fe2 (diff) | |
download | otp-890ccb33dd4ffd754a232a676433b3bc3b469bc0.tar.gz otp-890ccb33dd4ffd754a232a676433b3bc3b469bc0.tar.bz2 otp-890ccb33dd4ffd754a232a676433b3bc3b469bc0.zip |
Merge branch 'bmk/snmp/test_case_cleanup/OTP-9084' into dev
Diffstat (limited to 'lib/snmp/test/snmp_app_test.erl')
-rw-r--r-- | lib/snmp/test/snmp_app_test.erl | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/lib/snmp/test/snmp_app_test.erl b/lib/snmp/test/snmp_app_test.erl index 64dd638f83..27a7b4af2e 100644 --- a/lib/snmp/test/snmp_app_test.erl +++ b/lib/snmp/test/snmp_app_test.erl @@ -300,6 +300,25 @@ undef_funcs(Config) when is_list(Config) -> xref:stop(XRef), analyze_undefined_function_calls(Undefs, Mods, []). +valid_undef(crypto = CalledMod) -> + case (catch CalledMod:version()) of + Version when is_list(Version) -> + %% The called module was crypto and the version + %% function returns a valid value. + %% This means that the function is + %% actually undefined... + true; + _ -> + %% The called module was crypto but the version + %% function does *not* return a valid value. + %% This means the crypto was not actually not + %% build, which is an case snmp handles. + false + end; +valid_undef(_) -> + true. + + analyze_undefined_function_calls([], _, []) -> ok; analyze_undefined_function_calls([], _, AppUndefs) -> @@ -312,14 +331,25 @@ analyze_undefined_function_calls([{{Mod, _F, _A}, _C} = AppUndef|Undefs], {Calling,Called} = AppUndef, {Mod1,Func1,Ar1} = Calling, {Mod2,Func2,Ar2} = Called, - io:format("undefined function call: " - "~n ~w:~w/~w calls ~w:~w/~w~n", - [Mod1,Func1,Ar1,Mod2,Func2,Ar2]), - analyze_undefined_function_calls(Undefs, AppModules, - [AppUndef|AppUndefs]); + %% If the called module is crypto, then we will *not* + %% fail if crypto is not built (since crypto is actually + %% not built for all platforms) + case valid_undef(Mod2) of + true -> + io:format("undefined function call: " + "~n ~w:~w/~w calls ~w:~w/~w~n", + [Mod1,Func1,Ar1,Mod2,Func2,Ar2]), + analyze_undefined_function_calls( + Undefs, AppModules, [AppUndef|AppUndefs]); + false -> + io:format("skipping ~p (calling ~w:~w/~w)~n", + [Mod, Mod2, Func2, Ar2]), + analyze_undefined_function_calls(Undefs, + AppModules, AppUndefs) + end; false -> - io:format("dropping ~p~n", [Mod]), - analyze_undefined_function_calls(Undefs, AppModules, AppUndefs) + io:format("dropping ~p~n", [Mod]), + analyze_undefined_function_calls(Undefs, AppModules, AppUndefs) end. %% This function is used simply to avoid cut-and-paste errors later... |