aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-03-09 10:26:28 +0100
committerBjörn Gustavsson <[email protected]>2016-03-09 10:26:28 +0100
commit21e395b93eafe68544b7ee5dd186c01bcfc5d02e (patch)
tree2edba65235d8c1da4aa08e34f2c8343e54b5a735 /lib
parentfa86be90274abf69451007db04fd4d21257c1843 (diff)
parentb68ec56d44ff7f94289670ca0f10c8bbce927be5 (diff)
downloadotp-21e395b93eafe68544b7ee5dd186c01bcfc5d02e.tar.gz
otp-21e395b93eafe68544b7ee5dd186c01bcfc5d02e.tar.bz2
otp-21e395b93eafe68544b7ee5dd186c01bcfc5d02e.zip
Merge branch 'maint'
* maint: io_SUITE: Don't fail on fast computers with rough timers Fix code_SUITE after test_server change Set default value for crash_dump_dir
Diffstat (limited to 'lib')
-rw-r--r--lib/common_test/src/test_server_sup.erl5
-rw-r--r--lib/kernel/test/code_SUITE.erl16
-rw-r--r--lib/stdlib/test/io_SUITE.erl40
3 files changed, 42 insertions, 19 deletions
diff --git a/lib/common_test/src/test_server_sup.erl b/lib/common_test/src/test_server_sup.erl
index 1c0eb18d70..c4530ba62f 100644
--- a/lib/common_test/src/test_server_sup.erl
+++ b/lib/common_test/src/test_server_sup.erl
@@ -594,7 +594,10 @@ cleanup_crash_dumps() ->
delete_files(Dumps).
crash_dump_dir() ->
- {ok,Dir} = test_server_sup:framework_call(get_log_dir,[]),
+ %% If no framework is known, then we use current working directory
+ %% - in most cases that will be the same as the default log
+ %% directory.
+ {ok,Dir} = test_server_sup:framework_call(get_log_dir,[],file:get_cwd()),
Dir.
tar_crash_dumps() ->
diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl
index 00f29aa8ed..13d3809ef6 100644
--- a/lib/kernel/test/code_SUITE.erl
+++ b/lib/kernel/test/code_SUITE.erl
@@ -966,9 +966,8 @@ mult_lib_roots(Config) when is_list(Config) ->
?t:start_node(mult_lib_roots, slave,
[{args,"-env ERL_LIBS "++ErlLibs}]),
- TSPath = filename:dirname(code:which(test_server)),
Path0 = rpc:call(Node, code, get_path, []),
- [TSPath,"."|Path1] = Path0,
+ ["."|Path1] = Path0,
[Kernel|Path2] = Path1,
[Stdlib|Path3] = Path2,
mult_lib_verify_lib(Kernel, "kernel"),
@@ -1012,16 +1011,19 @@ mult_lib_remove_prefix([$/|T], []) -> T.
bad_erl_libs(Config) when is_list(Config) ->
{ok,Node} =
- ?t:start_node(mult_lib_roots, slave,
- [{args,"-env ERL_LIBS "}]),
-
+ ?t:start_node(bad_erl_libs, slave, []),
+ Code = rpc:call(Node,code,get_path,[]),
?t:stop_node(Node),
{ok,Node2} =
- ?t:start_node(mult_lib_roots, slave,
+ ?t:start_node(bad_erl_libs, slave,
[{args,"-env ERL_LIBS /no/such/dir"}]),
-
+ Code2 = rpc:call(Node,code,get_path,[]),
?t:stop_node(Node2),
+
+ %% Test that code path is not affected by the faulty ERL_LIBS
+ Code == Code2,
+
ok.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/lib/stdlib/test/io_SUITE.erl b/lib/stdlib/test/io_SUITE.erl
index 1aca0f3fa6..2d56f2d502 100644
--- a/lib/stdlib/test/io_SUITE.erl
+++ b/lib/stdlib/test/io_SUITE.erl
@@ -2265,12 +2265,14 @@ io_lib_width_too_small(_Config) ->
%% Test that the time for a huge message queue is not
%% significantly slower than with an empty message queue.
io_with_huge_message_queue(Config) when is_list(Config) ->
- case test_server:is_native(gen) of
- true ->
+ case {test_server:is_native(gen),test_server:is_cover()} of
+ {true,_} ->
{skip,
"gen is native - huge message queue optimization "
"is not implemented"};
- false ->
+ {_,true} ->
+ {skip,"Running under cover"};
+ {false,false} ->
do_io_with_huge_message_queue(Config)
end.
@@ -2278,19 +2280,23 @@ do_io_with_huge_message_queue(Config) ->
PrivDir = ?privdir(Config),
File = filename:join(PrivDir, "slask"),
{ok, F1} = file:open(File, [write]),
-
- {Time,ok} = timer:tc(fun() -> writes(1000, F1) end),
+ Test = fun(Times) ->
+ {Time,ok} = timer:tc(fun() -> writes(Times, F1) end),
+ Time
+ end,
+ {Times,EmptyTime} = calibrate(100, Test),
[self() ! {msg,N} || N <- lists:seq(1, 500000)],
erlang:garbage_collect(),
- {NewTime,ok} = timer:tc(fun() -> writes(1000, F1) end),
+ FullTime = Test(Times),
file:close(F1),
- io:format("Time for empty message queue: ~p", [Time]),
- io:format("Time for huge message queue: ~p", [NewTime]),
+ file:delete(File),
+ io:format("Number of writes: ~p", [Times]),
+ io:format("Time for empty message queue: ~p", [EmptyTime]),
+ io:format("Time for huge message queue: ~p", [FullTime]),
- IsCover = test_server:is_cover(),
- case (NewTime+1) / (Time+1) of
- Q when Q < 10; IsCover ->
+ case (FullTime+1) / (EmptyTime+1) of
+ Q when Q < 10 ->
ok;
Q ->
io:format("Q = ~p", [Q]),
@@ -2298,6 +2304,18 @@ do_io_with_huge_message_queue(Config) ->
end,
ok.
+%% Make sure that the time is not too short. That could cause the
+%% test case to fail.
+calibrate(N, Test) when N =< 100000 ->
+ case Test(N) of
+ Time when Time < 50000 ->
+ calibrate(10*N, Test);
+ Time ->
+ {N,Time}
+ end;
+calibrate(N, _) ->
+ N.
+
writes(0, _) -> ok;
writes(N, F1) ->
file:write(F1, "hello\n"),