aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/code_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-08-26 11:40:33 +0200
committerBjörn Gustavsson <[email protected]>2011-08-26 11:40:33 +0200
commit67f89ecba0ef3a1f707c6c3b40d32605b7e2b352 (patch)
tree659895bb3f9d5947646c0305e516fdb04aaa53f5 /erts/emulator/test/code_SUITE.erl
parentd48eaa0731017e5cdadca0af77ac14cd949b6c67 (diff)
parent4275ca6ecfa35554416bdb517999642b242e9776 (diff)
downloadotp-67f89ecba0ef3a1f707c6c3b40d32605b7e2b352.tar.gz
otp-67f89ecba0ef3a1f707c6c3b40d32605b7e2b352.tar.bz2
otp-67f89ecba0ef3a1f707c6c3b40d32605b7e2b352.zip
Merge branch 'bjorn/erts/old-code-checking-improvements/OTP-9495' into dev
* bjorn/erts/old-code-checking-improvements/OTP-9495: code: Optimize purge/1 and soft_purge/1 using check_old_code/1 Add erlang:check_old_code/1 check_process_code/2: Quickly return 'false' if there is no old code
Diffstat (limited to 'erts/emulator/test/code_SUITE.erl')
-rw-r--r--erts/emulator/test/code_SUITE.erl32
1 files changed, 30 insertions, 2 deletions
diff --git a/erts/emulator/test/code_SUITE.erl b/erts/emulator/test/code_SUITE.erl
index a062cea117..29cbdedd17 100644
--- a/erts/emulator/test/code_SUITE.erl
+++ b/erts/emulator/test/code_SUITE.erl
@@ -20,7 +20,9 @@
-module(code_SUITE).
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
init_per_group/2,end_per_group/2,
- new_binary_types/1,t_check_process_code/1,t_check_process_code_ets/1,
+ new_binary_types/1,
+ t_check_process_code/1,t_check_old_code/1,
+ t_check_process_code_ets/1,
external_fun/1,get_chunk/1,module_md5/1,make_stub/1,
make_stub_many_funs/1,constant_pools/1,
false_dependency/1,coverage/1]).
@@ -31,7 +33,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
[new_binary_types, t_check_process_code,
- t_check_process_code_ets, external_fun, get_chunk,
+ t_check_process_code_ets, t_check_old_code, external_fun, get_chunk,
module_md5, make_stub, make_stub_many_funs,
constant_pools, false_dependency, coverage].
@@ -248,6 +250,32 @@ fun_refc(F) ->
Count.
+%% Test the erlang:check_old_code/1 BIF.
+t_check_old_code(Config) when is_list(Config) ->
+ ?line Data = ?config(data_dir, Config),
+ ?line File = filename:join(Data, "my_code_test"),
+
+ ?line erlang:purge_module(my_code_test),
+ ?line erlang:delete_module(my_code_test),
+ ?line catch erlang:purge_module(my_code_test),
+
+ ?line false = erlang:check_old_code(my_code_test),
+
+ ?line {ok,my_code_test,Code} = compile:file(File, [binary]),
+ ?line {module,my_code_test} = code:load_binary(my_code_test, File, Code),
+
+ ?line false = erlang:check_old_code(my_code_test),
+ ?line {module,my_code_test} = code:load_binary(my_code_test, File, Code),
+ ?line true = erlang:check_old_code(my_code_test),
+
+ ?line true = erlang:purge_module(my_code_test),
+ ?line true = erlang:delete_module(my_code_test),
+ ?line true = erlang:purge_module(my_code_test),
+
+ ?line {'EXIT',_} = (catch erlang:check_old_code([])),
+
+ ok.
+
external_fun(Config) when is_list(Config) ->
?line false = erlang:function_exported(another_code_test, x, 1),
?line ExtFun = erlang:make_fun(id(another_code_test), x, 1),