From 6c9822baad0ad7e0c535a023b45cee24619b301e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Sun, 17 Apr 2016 08:22:21 +0200 Subject: 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. --- lib/debugger/test/int_SUITE.erl | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'lib/debugger/test/int_SUITE.erl') 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. -- cgit v1.2.3