diff options
author | Björn Gustavsson <[email protected]> | 2016-03-14 12:49:53 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-03-16 10:11:12 +0100 |
commit | 577125cc69feb5c14fa7e13edd3c3157f9c4a0ec (patch) | |
tree | b5d355bb122708b5d787584b1d9373bb775aeeeb /lib/kernel/test/code_SUITE.erl | |
parent | 4e0c08b7b7658531af6151702372e2b9bdd8d8fd (diff) | |
download | otp-577125cc69feb5c14fa7e13edd3c3157f9c4a0ec.tar.gz otp-577125cc69feb5c14fa7e13edd3c3157f9c4a0ec.tar.bz2 otp-577125cc69feb5c14fa7e13edd3c3157f9c4a0ec.zip |
code_server: Normalize the pathnames for all loaded modules
On Windows, the pathnames for modules that are loaded early are
returned with mixed backslashes and slashes:
1> code:which(lists).
"C:\\Program Files\\erl8.0/lib/stdlib-2.7/ebin/lists.beam"
2>
Modules loaded later are fully normalized.
When starting the code_server, normalize the pathnames for all modules
that have been loaded so far.
Diffstat (limited to 'lib/kernel/test/code_SUITE.erl')
-rw-r--r-- | lib/kernel/test/code_SUITE.erl | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl index 298c1f7d6b..abea23e854 100644 --- a/lib/kernel/test/code_SUITE.erl +++ b/lib/kernel/test/code_SUITE.erl @@ -34,7 +34,8 @@ purge_stacktrace/1, mult_lib_roots/1, bad_erl_libs/1, code_archive/1, code_archive2/1, on_load/1, on_load_binary/1, on_load_embedded/1, on_load_errors/1, big_boot_embedded/1, - native_early_modules/1, get_mode/1]). + native_early_modules/1, get_mode/1, + normalized_paths/1]). -export([init_per_testcase/2, end_per_testcase/2, init_per_suite/1, end_per_suite/1]). @@ -61,7 +62,7 @@ all() -> purge_stacktrace, mult_lib_roots, bad_erl_libs, code_archive, code_archive2, on_load, on_load_binary, on_load_embedded, on_load_errors, - big_boot_embedded, native_early_modules, get_mode]. + big_boot_embedded, native_early_modules, get_mode, normalized_paths]. groups() -> []. @@ -1451,6 +1452,22 @@ native_early_modules_1(Architecture) -> get_mode(Config) when is_list(Config) -> interactive = code:get_mode(). +%% Make sure that the paths for all loaded modules have been normalized. +normalized_paths(_Config) -> + do_normalized_paths(erlang:loaded()). + +do_normalized_paths([M|Ms]) -> + case code:which(M) of + Special when is_atom(Special) -> + do_normalized_paths(Ms); + File when is_list(File) -> + File = filename:join([File]), + do_normalized_paths(Ms) + end; +do_normalized_paths([]) -> + ok. + + %%----------------------------------------------------------------- %% error_logger handler. %% (Copied from stdlib/test/proc_lib_SUITE.erl.) |