aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tools')
-rw-r--r--lib/tools/doc/src/notes.xml69
-rw-r--r--lib/tools/emacs/erlang.el13
-rw-r--r--lib/tools/src/cover.erl10
-rw-r--r--lib/tools/src/make.erl17
-rw-r--r--lib/tools/test/Makefile2
-rw-r--r--lib/tools/test/cover_SUITE.erl4
-rw-r--r--lib/tools/vsn.mk2
7 files changed, 94 insertions, 23 deletions
diff --git a/lib/tools/doc/src/notes.xml b/lib/tools/doc/src/notes.xml
index 118800e44a..02d92fc4e7 100644
--- a/lib/tools/doc/src/notes.xml
+++ b/lib/tools/doc/src/notes.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2004</year><year>2010</year>
+ <year>2004</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -30,6 +30,73 @@
</header>
<p>This document describes the changes made to the Tools application.</p>
+<section><title>Tools 2.6.6.4</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Change make:files to behave more like erlc</p>
+ <p>
+ This change removes the unnecessary checks on the files
+ when make:files is called and allows the error checking
+ to be done in compile:file, where the error messages are
+ produced. It does not affect the return value.</p>
+ <p>
+ (Thanks to Sam bobroff)</p>
+ <p>
+ Own Id: OTP-9179</p>
+ </item>
+ <item>
+ <p>
+ add user specified compiler options on form reloading</p>
+ <p>
+ In order to be able to test non-exported functions from
+ another (test) module it is necessary to compile the
+ specific module (at least during the test phase) with the
+ export_all compiler option. This allows complete
+ separation of testing and productive code. At the moment
+ it is not possible to combine this with a test code
+ coverage using the cover module. The problem is that when
+ cover compiling a module using cover:compile_* the code
+ is reloaded into the emulator omitting/filtering the
+ passed user options. In my example above the export_all
+ option would be removed and the non-exported functions
+ cannot be called any more. (Thanks to Tobias Schlager)</p>
+ <p>
+ Own Id: OTP-9204</p>
+ </item>
+ <item>
+ <p>
+ Inhibit electric newline after "-&gt;" when inside a type
+ spec</p>
+ <p>
+ The Erlang mode for Emacs inserts a newline after every
+ "-&gt;", which saves you one keystroke when writing a
+ function, but that is inappropriate when writing a type
+ spec, as you'd normally keep the spec on one line. This
+ change inhibits the automatic insertion when the current
+ line starts with "-spec" or "-type".(Thanks to Magnus
+ Henoch)</p>
+ <p>
+ Own Id: OTP-9255</p>
+ </item>
+ <item>
+ <p>
+ Add a check logic to prevent file descriptor leak</p>
+ <p>
+ cover module handle files as raw in export and import.
+ Assert counts of ports are the same at the beginning and
+ at the end of the test case.(Thanks to Shunichi
+ Shinohara)</p>
+ <p>
+ Own Id: OTP-9300</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Tools 2.6.6.3</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index e1c0d31371..6728bef2a4 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -386,7 +386,8 @@ then no prototype is inserted.
The test is performed by the function `erlang-test-criteria-list'.")
(defvar erlang-electric-arrow-criteria
- '(erlang-next-lines-empty-p
+ '(erlang-stop-when-in-type-spec
+ erlang-next-lines-empty-p
erlang-at-end-of-function-p)
"*List of functions controlling the arrow aspect of `erlang-electric-gt'.
The functions in this list are called, in order, whenever a `>'
@@ -4045,6 +4046,16 @@ This function is designed to be a member of a criteria list."
nil)))
+(defun erlang-stop-when-in-type-spec ()
+ "Return `stop' when in a type spec line.
+
+This function is designed to be a member of a criteria list."
+ (save-excursion
+ (beginning-of-line)
+ (when (save-match-data (looking-at "-\\(spec\\|type\\)"))
+ 'stop)))
+
+
(defun erlang-next-lines-empty-p ()
"Return non-nil if next lines are empty.
diff --git a/lib/tools/src/cover.erl b/lib/tools/src/cover.erl
index 230f0e9428..905ad895c9 100644
--- a/lib/tools/src/cover.erl
+++ b/lib/tools/src/cover.erl
@@ -253,6 +253,7 @@ compile_modules(Files,Options) ->
{i, Dir} when is_list(Dir) -> true;
{d, _Macro} -> true;
{d, _Macro, _Value} -> true;
+ export_all -> true;
_ -> false
end
end,
@@ -625,7 +626,7 @@ main_process_loop(State) ->
case get_beam_file(Module,BeamFile0,Compiled0) of
{ok,BeamFile} ->
{Reply,Compiled} =
- case do_compile_beam(Module,BeamFile) of
+ case do_compile_beam(Module,BeamFile,[]) of
{ok, Module} ->
remote_load_compiled(State#main_state.nodes,
[{Module,BeamFile}]),
@@ -661,6 +662,7 @@ main_process_loop(State) ->
Imported = do_import_to_table(Fd,File,
State#main_state.imported),
reply(From, ok),
+ file:close(Fd),
main_process_loop(State#main_state{imported=Imported});
{error,Reason} ->
reply(From, {error, {cant_open_file,File,Reason}}),
@@ -1258,13 +1260,13 @@ do_compile(File, UserOptions) ->
Options = [debug_info,binary,report_errors,report_warnings] ++ UserOptions,
case compile:file(File, Options) of
{ok, Module, Binary} ->
- do_compile_beam(Module,Binary);
+ do_compile_beam(Module,Binary,UserOptions);
error ->
error
end.
%% Beam is a binary or a .beam file name
-do_compile_beam(Module,Beam) ->
+do_compile_beam(Module,Beam,UserOptions) ->
%% Clear database
do_clear(Module),
@@ -1284,7 +1286,7 @@ do_compile_beam(Module,Beam) ->
%% Compile and load the result
%% It's necessary to check the result of loading since it may
%% fail, for example if Module resides in a sticky directory
- {ok, Module, Binary} = compile:forms(Forms, []),
+ {ok, Module, Binary} = compile:forms(Forms, UserOptions),
case code:load_binary(Module, ?TAG, Binary) of
{module, Module} ->
diff --git a/lib/tools/src/make.erl b/lib/tools/src/make.erl
index 77c354651b..5cc8d47faa 100644
--- a/lib/tools/src/make.erl
+++ b/lib/tools/src/make.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -222,12 +222,7 @@ recompilep(File, NoExec, Load, Opts) ->
recompilep1(File, NoExec, Load, Opts, ObjFile) ->
{ok, Erl} = file:read_file_info(lists:append(File, ".erl")),
{ok, Obj} = file:read_file_info(ObjFile),
- case {readable(Erl), writable(Obj)} of
- {true, true} ->
- recompilep1(Erl, Obj, File, NoExec, Load, Opts);
- _ ->
- error
- end.
+ recompilep1(Erl, Obj, File, NoExec, Load, Opts).
recompilep1(#file_info{mtime=Te},
#file_info{mtime=To}, File, NoExec, Load, Opts) when Te>To ->
@@ -277,14 +272,6 @@ exists(File) ->
false
end.
-readable(#file_info{access=read_write}) -> true;
-readable(#file_info{access=read}) -> true;
-readable(_) -> false.
-
-writable(#file_info{access=read_write}) -> true;
-writable(#file_info{access=write}) -> true;
-writable(_) -> false.
-
coerce_2_list(X) when is_atom(X) ->
atom_to_list(X);
coerce_2_list(X) ->
diff --git a/lib/tools/test/Makefile b/lib/tools/test/Makefile
index 63f96520fd..8019b7269f 100644
--- a/lib/tools/test/Makefile
+++ b/lib/tools/test/Makefile
@@ -87,7 +87,7 @@ release_tests_spec: make_emakefile
$(INSTALL_DIR) $(RELSYSDIR)
$(INSTALL_DATA) $(SPEC_FILES) $(COVER_FILE) $(EMAKEFILE) \
$(ERL_FILES) $(RELSYSDIR)
- chmod -f -R u+w $(RELSYSDIR)
+ chmod -R u+w $(RELSYSDIR)
@tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -)
release_docs_spec:
diff --git a/lib/tools/test/cover_SUITE.erl b/lib/tools/test/cover_SUITE.erl
index b5c8e8a1b7..fe7f92de78 100644
--- a/lib/tools/test/cover_SUITE.erl
+++ b/lib/tools/test/cover_SUITE.erl
@@ -395,6 +395,7 @@ export_import(suite) -> [];
export_import(Config) when is_list(Config) ->
?line DataDir = ?config(data_dir, Config),
?line ok = file:set_cwd(DataDir),
+ ?line PortCount = length(erlang:ports()),
%% Export one module
?line {ok,f} = cover:compile(f),
@@ -484,6 +485,9 @@ export_import(Config) when is_list(Config) ->
?line ?t:capture_stop(),
?line check_f_calls(1,0),
+ %% Check no raw files are left open
+ ?line PortCount = length(erlang:ports()),
+
%% Cleanup
?line ok = cover:stop(),
?line Files = lsfiles(),
diff --git a/lib/tools/vsn.mk b/lib/tools/vsn.mk
index 83027cfaa6..6999c695e6 100644
--- a/lib/tools/vsn.mk
+++ b/lib/tools/vsn.mk
@@ -1 +1 @@
-TOOLS_VSN = 2.6.6.3
+TOOLS_VSN = 2.6.6.4