diff options
author | Jean-Sébastien Pédron <[email protected]> | 2014-03-19 15:19:19 +0100 |
---|---|---|
committer | Jean-Sébastien Pédron <[email protected]> | 2014-03-24 17:37:29 +0100 |
commit | f149194f227fd593757ff2c750b82b62f9a6e8aa (patch) | |
tree | f1ac375ec02f2673cf5e03e1b40a9ecaa3503b85 /lib/sasl/test/systools_SUITE.erl | |
parent | 8acc644e162bad52f7ab81c76c0cad15628e4f3d (diff) | |
download | otp-f149194f227fd593757ff2c750b82b62f9a6e8aa.tar.gz otp-f149194f227fd593757ff2c750b82b62f9a6e8aa.tar.bz2 otp-f149194f227fd593757ff2c750b82b62f9a6e8aa.zip |
sasl: Fix crash in systools_make:format_error/1
The crash occurred when systools:make_script/2 raises the
'duplicate_modules' error. Depending on the 'silent' option,
systools_make:format_error/1 is called to either format and display an
error message, or return a tuple containing the error properties.
When displaying a 'duplicate_modules' error message, format_error/1
receives a list of applications providing the same module(s):
[
{{Mod,App1,_}, {Mod,App2,_}},
...
]
However, before this fix, format_error/1 expected the following
structure, leading to a 'function_clause' exception:
[
{{Mod,_,App1,_,_}, {Mod,_,App2,_,_}},
...
]
The crash never occurred with the 'silent' option, because the error and
its properties are returned as is to the caller.
Diffstat (limited to 'lib/sasl/test/systools_SUITE.erl')
-rw-r--r-- | lib/sasl/test/systools_SUITE.erl | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/lib/sasl/test/systools_SUITE.erl b/lib/sasl/test/systools_SUITE.erl index 9efc8f8392..d7e01d74c0 100644 --- a/lib/sasl/test/systools_SUITE.erl +++ b/lib/sasl/test/systools_SUITE.erl @@ -47,6 +47,7 @@ abnormal_script/1, src_tests_script/1, crazy_script/1, included_script/1, included_override_script/1, included_fail_script/1, included_bug_script/1, exref_script/1, + duplicate_modules_script/1, otp_3065_circular_dependenies/1, included_and_used_sort_script/1]). -export([tar_options/1, normal_tar/1, no_mod_vsn_tar/1, system_files_tar/1, system_files_tar/2, invalid_system_files_tar/1, @@ -84,6 +85,7 @@ groups() -> src_tests_script, crazy_script, included_script, included_override_script, included_fail_script, included_bug_script, exref_script, + duplicate_modules_script, otp_3065_circular_dependenies, included_and_used_sort_script]}, {tar, [], [tar_options, normal_tar, no_mod_vsn_tar, system_files_tar, @@ -822,6 +824,33 @@ no_hipe({ok, Value}) -> {ok, Value} end. +%% duplicate_modules_script: Check that make_script rejects two +%% applications providing the same module. +duplicate_modules_script(Config) when is_list(Config) -> + {ok, OldDir} = file:get_cwd(), + + {LatestDir, LatestName} = create_script(duplicate_modules,Config), + + DataDir = filename:absname(?copydir), + + ok = file:set_cwd(LatestDir), + LibDir = fname([DataDir, d_duplicate_modules, lib]), + P = [fname([LibDir, 'app1-1.0', ebin]), + fname([LibDir, 'app2-1.0', ebin])], + + %% Check wrong app vsn + error = systools:make_script(LatestName, [{path, P}]), + {error, + systools_make, + {duplicate_modules, [ + {{myapp,app1,_}, {myapp,app2,_}} + ] + } + } = systools:make_script(LatestName, [silent, {path, P}]), + + ok = file:set_cwd(OldDir), + ok. + %% tar_options: Check illegal tar options. tar_options(Config) when is_list(Config) -> {'EXIT',{{badarg,[{path,["Path",12,"Another"]}]}, _}} = @@ -2186,7 +2215,10 @@ create_script(current_all_future_sasl,Config) -> do_create_script(current_all_future_sasl,Config,current,Apps); create_script({unicode,RelVsn},Config) -> Apps = core_apps(current) ++ [{ua,"1.0"}], - do_create_script(unicode,RelVsn,Config,current,Apps). + do_create_script(unicode,RelVsn,Config,current,Apps); +create_script(duplicate_modules,Config) -> + Apps = core_apps(current) ++ [{app1,"1.0"},{app2,"1.0"}], + do_create_script(duplicate_modules,Config,current,Apps). do_create_script(Id,Config,ErtsVsn,AppVsns) -> |