aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-04-17 08:22:21 +0200
committerBjörn Gustavsson <[email protected]>2016-04-18 07:46:33 +0200
commit6c9822baad0ad7e0c535a023b45cee24619b301e (patch)
tree25118ff72e0581f609e74c7475afea7716c32c6d
parent7cc68fb4820f68e21867bb8f16172e8f72d04edc (diff)
downloadotp-6c9822baad0ad7e0c535a023b45cee24619b301e.tar.gz
otp-6c9822baad0ad7e0c535a023b45cee24619b301e.tar.bz2
otp-6c9822baad0ad7e0c535a023b45cee24619b301e.zip
int_SUITE: Fix interpretable/1 in a non-installed system
interpretable/1 tests (among other things) that we are not allowed to interpret modules in certain applications (such as kernel and stdlib). int:interpretable/1 as currently implement enforces the restriction only in an installed system (the applications must have versions, such as kernel-1.2.3). We could modify int:interpretable/1 to enforce the restriction, but it could sometimes be useful to be able to debug (for example) erl_lint or other library modules that can safely be reloaded without crashing the run-time system. Therefore, assume that anyone working in a non-installed system knows what they are doing and fix the test case so that it stop failing in a non-installed system.
-rw-r--r--lib/debugger/test/int_SUITE.erl41
1 files changed, 25 insertions, 16 deletions
diff --git a/lib/debugger/test/int_SUITE.erl b/lib/debugger/test/int_SUITE.erl
index 38b43bdcb0..31257d16e9 100644
--- a/lib/debugger/test/int_SUITE.erl
+++ b/lib/debugger/test/int_SUITE.erl
@@ -284,20 +284,29 @@ interpretable(Config) when is_list(Config) ->
?line {error, badarg} = int:interpretable("prejudice.erl"),
%% {error, {app,App}}
- ?line {error, {app,_}} = int:interpretable(file),
- ?line {error, {app,_}} = int:interpretable(lists),
- ?line case int:interpretable(dbg_ieval) of
- {error, {app,_}} ->
- ok;
- {error, badarg} ->
- case code:which(dbg_ieval) of
- cover_compiled ->
- ok;
- Other1 ->
- ?line ?t:fail({unexpected_result, Other1})
- end;
- Other2 ->
- ?line ?t:fail({unexpected_result, Other2})
- end,
-
+ case filename:basename(code:lib_dir(kernel)) of
+ "kernel" ->
+ %% Development system (not installed). We are allowed
+ %% to interpret modules in kernel and stdlib
+ %% (at our own risk).
+ ok;
+ "kernel-" ++ _ ->
+ %% Installed system. Certain applications (including
+ %% kernel and stdlib) cannot be interpreted.
+ {error, {app,_}} = int:interpretable(file),
+ {error, {app,_}} = int:interpretable(lists),
+ case int:interpretable(dbg_ieval) of
+ {error, {app,_}} ->
+ ok;
+ {error, badarg} ->
+ case code:which(dbg_ieval) of
+ cover_compiled ->
+ ok;
+ Other1 ->
+ ct:fail({unexpected_result, Other1})
+ end;
+ Other2 ->
+ ct:fail({unexpected_result, Other2})
+ end
+ end,
ok.