aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_server
diff options
context:
space:
mode:
Diffstat (limited to 'lib/test_server')
-rw-r--r--lib/test_server/include/test_server.hrl2
-rw-r--r--lib/test_server/src/erl2html2.erl30
-rw-r--r--lib/test_server/src/ts.erl18
3 files changed, 29 insertions, 21 deletions
diff --git a/lib/test_server/include/test_server.hrl b/lib/test_server/include/test_server.hrl
index 36e7e1f83d..f206374116 100644
--- a/lib/test_server/include/test_server.hrl
+++ b/lib/test_server/include/test_server.hrl
@@ -21,7 +21,7 @@
-line_trace(true).
-define(line,
io:format(lists:concat([?MODULE,",",integer_to_list(?LINE),": ~p"]),
- [erlang:now()]),).
+ [erlang:monotonic_time()-erlang:system_info(start_time)]),).
-else.
-define(line,).
-endif.
diff --git a/lib/test_server/src/erl2html2.erl b/lib/test_server/src/erl2html2.erl
index 2e443c7b8b..9101212852 100644
--- a/lib/test_server/src/erl2html2.erl
+++ b/lib/test_server/src/erl2html2.erl
@@ -109,27 +109,26 @@ parse_file(File, InclPath) ->
Error
end.
-parse_preprocessed_file(Epp,File,InCorrectFile) ->
+parse_preprocessed_file(Epp, File, InCorrectFile) ->
case epp:parse_erl_form(Epp) of
{ok,Form} ->
case Form of
{attribute,_,file,{File,_}} ->
- parse_preprocessed_file(Epp,File,true);
+ parse_preprocessed_file(Epp, File, true);
{attribute,_,file,{_OtherFile,_}} ->
- parse_preprocessed_file(Epp,File,false);
+ parse_preprocessed_file(Epp, File, false);
{function,L,F,A,Cs} when InCorrectFile ->
{CLs,LastCL} = find_clause_lines(Cs, []),
- Clauses = [{clause,get_line(CL)} ||
- {clause,CL,_,_,_} <- tl(CLs)],
- [{atom_to_list(F),A,get_line(L),get_line(LastCL)} | Clauses] ++
- parse_preprocessed_file(Epp,File,true);
+ %% tl(CLs) cause we know the start line already
+ [{atom_to_list(F),A,get_line(L),LastCL} | tl(CLs)] ++
+ parse_preprocessed_file(Epp, File, true);
_ ->
- parse_preprocessed_file(Epp,File,InCorrectFile)
+ parse_preprocessed_file(Epp, File, InCorrectFile)
end;
{error,Reason={_L,epp,{undefined,_Macro,none}}} ->
throw({error,Reason,InCorrectFile});
{error,_Reason} ->
- parse_preprocessed_file(Epp,File,InCorrectFile);
+ parse_preprocessed_file(Epp, File, InCorrectFile);
{eof,_Location} ->
[]
end.
@@ -150,9 +149,8 @@ parse_non_preprocessed_file(Epp, File, Location) ->
try erl_syntax:revert(Tree) of
{function,L,F,A,Cs} ->
{CLs,LastCL} = find_clause_lines(Cs, []),
- Clauses = [{clause,get_line(CL)} ||
- {clause,CL,_,_,_} <- tl(CLs)],
- [{atom_to_list(F),A,get_line(L),get_line(LastCL)} | Clauses] ++
+ %% tl(CLs) cause we know the start line already
+ [{atom_to_list(F),A,get_line(L),LastCL} | tl(CLs)] ++
parse_non_preprocessed_file(Epp, File, Location1);
_ ->
parse_non_preprocessed_file(Epp, File, Location1)
@@ -173,16 +171,16 @@ get_line(Anno) ->
find_clause_lines([{clause,CL,_Params,_Op,Exprs}], CLs) -> % last clause
try tuple_to_list(lists:last(Exprs)) of
[_Type,ExprLine | _] ->
- {lists:reverse([{clause,CL}|CLs]), ExprLine};
+ {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(ExprLine)};
_ ->
- {lists:reverse([{clause,CL}|CLs]), CL}
+ {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(CL)}
catch
_:_ ->
- {lists:reverse([{clause,CL}|CLs]), CL}
+ {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(CL)}
end;
find_clause_lines([{clause,CL,_Params,_Op,_Exprs} | Cs], CLs) ->
- find_clause_lines(Cs, [{clause,CL}|CLs]).
+ find_clause_lines(Cs, [{clause,get_line(CL)}|CLs]).
%%%-----------------------------------------------------------------
%%% Add a link target for each line and one for each function definition.
diff --git a/lib/test_server/src/ts.erl b/lib/test_server/src/ts.erl
index 469593e947..85f97656ff 100644
--- a/lib/test_server/src/ts.erl
+++ b/lib/test_server/src/ts.erl
@@ -262,18 +262,28 @@ run_all(_Vars) ->
run_some([], _Opts) ->
ok;
-run_some([{App,Mod}|Apps], Opts) ->
+run_some(Apps, Opts) ->
+ case proplists:get_value(test_category, Opts) of
+ bench ->
+ check_and_run(fun(Vars) -> ts_benchmark:run(Apps, Opts, Vars) end);
+ _Other ->
+ run_some1(Apps, Opts)
+ end.
+
+run_some1([], _Opts) ->
+ ok;
+run_some1([{App,Mod}|Apps], Opts) ->
case run(App, Mod, Opts) of
ok -> ok;
Error -> io:format("~p: ~p~n",[{App,Mod},Error])
end,
- run_some(Apps, Opts);
-run_some([App|Apps], Opts) ->
+ run_some1(Apps, Opts);
+run_some1([App|Apps], Opts) ->
case run(App, Opts) of
ok -> ok;
Error -> io:format("~p: ~p~n",[App,Error])
end,
- run_some(Apps, Opts).
+ run_some1(Apps, Opts).
%% This can be used from command line. Both App and
%% TestCategory must be specified. App may be 'all'