aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTuncer Ayaz <[email protected]>2010-02-04 19:58:28 +0100
committerBjörn Gustavsson <[email protected]>2010-02-06 09:29:34 +0100
commit79194d5fa70c7cd8ca0a31918e7954f9e3ae9f6c (patch)
tree146af9eb2727267c3450ecd1c2c9bb47880ddd1d
parent49da83de4bbc2ceab37bd7336e10c7910d1b06a3 (diff)
downloadotp-79194d5fa70c7cd8ca0a31918e7954f9e3ae9f6c.tar.gz
otp-79194d5fa70c7cd8ca0a31918e7954f9e3ae9f6c.tar.bz2
otp-79194d5fa70c7cd8ca0a31918e7954f9e3ae9f6c.zip
Add tests for code:clash/0
Add first batch of tests for code:clash/0. Signed-off-by: Tuncer Ayaz <[email protected]>
-rw-r--r--lib/kernel/test/code_SUITE.erl36
-rw-r--r--lib/kernel/test/code_SUITE_data/clash/foobar-0.1.ezbin0 -> 505 bytes
-rw-r--r--lib/kernel/test/code_SUITE_data/clash/foobar-0.1/ebin/baz.beam1
-rw-r--r--lib/kernel/test/code_SUITE_data/clash/foobar-0.1/ebin/blarg.beam1
-rw-r--r--lib/kernel/test/code_SUITE_data/clash/zork-0.8.ezbin0 -> 492 bytes
-rw-r--r--lib/kernel/test/code_SUITE_data/clash/zork-0.8/ebin/bork.beam1
-rw-r--r--lib/kernel/test/code_SUITE_data/clash/zork-0.8/ebin/flarp.beam1
7 files changed, 38 insertions, 2 deletions
diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl
index 8e1e3d5390..e07135c1bb 100644
--- a/lib/kernel/test/code_SUITE.erl
+++ b/lib/kernel/test/code_SUITE.erl
@@ -26,7 +26,7 @@
delete/1, purge/1, soft_purge/1, is_loaded/1, all_loaded/1,
load_binary/1, dir_req/1, object_code/1, set_path_file/1,
sticky_dir/1, pa_pz_option/1, add_del_path/1,
- dir_disappeared/1, ext_mod_dep/1,
+ dir_disappeared/1, ext_mod_dep/1, clash/1,
load_cached/1, start_node_with_cache/1, add_and_rehash/1,
where_is_file_cached/1, where_is_file_no_cache/1,
purge_stacktrace/1, mult_lib_roots/1, bad_erl_libs/1,
@@ -48,7 +48,7 @@ all(suite) ->
delete, purge, soft_purge, is_loaded, all_loaded,
load_binary, dir_req, object_code, set_path_file,
pa_pz_option, add_del_path,
- dir_disappeared, ext_mod_dep,
+ dir_disappeared, ext_mod_dep, clash,
load_cached, start_node_with_cache, add_and_rehash,
where_is_file_no_cache, where_is_file_cached,
purge_stacktrace, mult_lib_roots, bad_erl_libs,
@@ -545,6 +545,38 @@ add_del_path(Config) ->
ok.
+clash(Config) when is_list(Config) ->
+ DDir = ?config(data_dir,Config)++"clash/",
+ P = code:get_path(),
+
+ %% test non-clashing entries
+
+ %% remove "." to prevent clash with test-server path
+ ?line true = code:del_path("."),
+ ?line true = code:add_path(DDir++"foobar-0.1/ebin"),
+ ?line true = code:add_path(DDir++"zork-0.8/ebin"),
+ ?line test_server:capture_start(),
+ ?line code:clash(),
+ ?line test_server:capture_stop(),
+ ?line OKMsg = test_server:capture_get(),
+ ?line lists:prefix("** Found 0 name clashes in code paths", OKMsg),
+ ?line true = code:set_path(P),
+
+ %% test clashing entries
+
+ %% remove "." to prevent clash with test-server path
+ ?line true = code:del_path("."),
+ ?line true = code:add_path(DDir++"foobar-0.1/ebin"),
+ ?line true = code:add_path(DDir++"foobar-0.1.ez/foobar-0.1/ebin"),
+ ?line test_server:capture_start(),
+ ?line code:clash(),
+ ?line test_server:capture_stop(),
+ ?line [ErrMsg1|_] = test_server:capture_get(),
+ ?line {match, [" hides "]} = re:run(ErrMsg1, "\\*\\* .*( hides ).*",
+ [{capture,all_but_first,list}]),
+ ?line true = code:set_path(P),
+ ok.
+
ext_mod_dep(suite) ->
[];
ext_mod_dep(doc) ->
diff --git a/lib/kernel/test/code_SUITE_data/clash/foobar-0.1.ez b/lib/kernel/test/code_SUITE_data/clash/foobar-0.1.ez
new file mode 100644
index 0000000000..33d8a59b92
--- /dev/null
+++ b/lib/kernel/test/code_SUITE_data/clash/foobar-0.1.ez
Binary files differ
diff --git a/lib/kernel/test/code_SUITE_data/clash/foobar-0.1/ebin/baz.beam b/lib/kernel/test/code_SUITE_data/clash/foobar-0.1/ebin/baz.beam
new file mode 100644
index 0000000000..da87f32b9f
--- /dev/null
+++ b/lib/kernel/test/code_SUITE_data/clash/foobar-0.1/ebin/baz.beam
@@ -0,0 +1 @@
+baz 298734
diff --git a/lib/kernel/test/code_SUITE_data/clash/foobar-0.1/ebin/blarg.beam b/lib/kernel/test/code_SUITE_data/clash/foobar-0.1/ebin/blarg.beam
new file mode 100644
index 0000000000..e4c70c267c
--- /dev/null
+++ b/lib/kernel/test/code_SUITE_data/clash/foobar-0.1/ebin/blarg.beam
@@ -0,0 +1 @@
+baz 86234
diff --git a/lib/kernel/test/code_SUITE_data/clash/zork-0.8.ez b/lib/kernel/test/code_SUITE_data/clash/zork-0.8.ez
new file mode 100644
index 0000000000..051fa1efe4
--- /dev/null
+++ b/lib/kernel/test/code_SUITE_data/clash/zork-0.8.ez
Binary files differ
diff --git a/lib/kernel/test/code_SUITE_data/clash/zork-0.8/ebin/bork.beam b/lib/kernel/test/code_SUITE_data/clash/zork-0.8/ebin/bork.beam
new file mode 100644
index 0000000000..7b292c0b44
--- /dev/null
+++ b/lib/kernel/test/code_SUITE_data/clash/zork-0.8/ebin/bork.beam
@@ -0,0 +1 @@
+baz 23784
diff --git a/lib/kernel/test/code_SUITE_data/clash/zork-0.8/ebin/flarp.beam b/lib/kernel/test/code_SUITE_data/clash/zork-0.8/ebin/flarp.beam
new file mode 100644
index 0000000000..7b2f6a850f
--- /dev/null
+++ b/lib/kernel/test/code_SUITE_data/clash/zork-0.8/ebin/flarp.beam
@@ -0,0 +1 @@
+baz 3246238