aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-01-28 12:17:04 +0100
committerBjörn Gustavsson <[email protected]>2016-01-28 12:17:04 +0100
commitd8161c3ad977c0e20c075ecf58d8ac5769637828 (patch)
tree8950abfe39252c22c75badbf0cd79bbb9a097a0d /lib/kernel/test
parentb8c6a1196f0be5a2e98429797b43c24784bcafca (diff)
parentfbfe12dad837300942fc4bf0a3f927b25eaf50a8 (diff)
downloadotp-d8161c3ad977c0e20c075ecf58d8ac5769637828.tar.gz
otp-d8161c3ad977c0e20c075ecf58d8ac5769637828.tar.bz2
otp-d8161c3ad977c0e20c075ecf58d8ac5769637828.zip
Merge branch 'bjorn/kernel/code/OTP-9375' into maint
* bjorn/kernel/code/OTP-9375: Update documentation for code-loading functions code: Correct the types for error returns Eliminate run-time system crash in code:load_abs/1
Diffstat (limited to 'lib/kernel/test')
-rw-r--r--lib/kernel/test/code_SUITE.erl12
-rw-r--r--lib/kernel/test/code_SUITE_data/on_load_errors/simple_on_load_error.erl5
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl
index ef5303defd..2b77ec8972 100644
--- a/lib/kernel/test/code_SUITE.erl
+++ b/lib/kernel/test/code_SUITE.erl
@@ -323,6 +323,7 @@ load_abs(Config) when is_list(Config) ->
{error, nofile} = code:load_abs(TestDir ++ "/duuuumy_mod"),
{error, badfile} = code:load_abs(TestDir ++ "/code_a_test"),
{'EXIT', _} = (catch code:load_abs({})),
+ {'EXIT', _} = (catch code:load_abs("Non-latin-имя-файла")),
{module, code_b_test} = code:load_abs(TestDir ++ "/code_b_test"),
code:stick_dir(TestDir),
{error, sticky_directory} = code:load_abs(TestDir ++ "/code_b_test"),
@@ -1599,6 +1600,17 @@ on_load_errors(Config) when is_list(Config) ->
ok
end,
+ %% Make sure that the code loading functions return the correct
+ %% error code.
+ Simple = simple_on_load_error,
+ SimpleList = atom_to_list(Simple),
+ {error,on_load_failure} = code:load_file(Simple),
+ {error,on_load_failure} = code:ensure_loaded(Simple),
+ {ok,SimpleCode} = file:read_file("simple_on_load_error.beam"),
+ {error,on_load_failure} = code:load_binary(Simple, "", SimpleCode),
+ {error,on_load_failure} = code:load_abs(SimpleList),
+ {error,on_load_failure} = code:load_abs(SimpleList, Simple),
+
ok.
do_on_load_error(ReturnValue) ->
diff --git a/lib/kernel/test/code_SUITE_data/on_load_errors/simple_on_load_error.erl b/lib/kernel/test/code_SUITE_data/on_load_errors/simple_on_load_error.erl
new file mode 100644
index 0000000000..603c282257
--- /dev/null
+++ b/lib/kernel/test/code_SUITE_data/on_load_errors/simple_on_load_error.erl
@@ -0,0 +1,5 @@
+-module(simple_on_load_error).
+-on_load(on_load/0).
+
+on_load() ->
+ nope.