diff options
-rw-r--r-- | lib/common_test/src/test_server_sup.erl | 5 | ||||
-rw-r--r-- | lib/kernel/test/code_SUITE.erl | 16 | ||||
-rw-r--r-- | lib/stdlib/test/io_SUITE.erl | 40 |
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"), |