diff options
author | Micael Karlberg <[email protected]> | 2011-03-02 16:23:04 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-03-02 16:23:04 +0100 |
commit | 24c45e5d18eafbc8fc85b0c49622980dac3f6fe2 (patch) | |
tree | 21e3e5759a65c3cae00aa4be8d4c1b461bd3af0d /lib/snmp/test/snmp_app_test.erl | |
parent | 455ff4bc78f94c997d43a46fd2619b7d683c10c5 (diff) | |
download | otp-24c45e5d18eafbc8fc85b0c49622980dac3f6fe2.tar.gz otp-24c45e5d18eafbc8fc85b0c49622980dac3f6fe2.tar.bz2 otp-24c45e5d18eafbc8fc85b0c49622980dac3f6fe2.zip |
* On some windows machines dirs seem to vanish sometime between
the call to init_per_testcase (when they are created) and the
call to the actual test case (when they are used).
* Try to handle systems where crypto is not built better.
This *is* handled by application, but the test case
snmp_app_test:undef_funcs could do a better job (which it
hopefully does now :).
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... |