From 34df9b51b0237172c41e81fd5ae5597cba534473 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Fri, 13 Oct 2017 14:35:07 +0200 Subject: Avoid falling measurements testcases on slow machines --- lib/stdlib/test/string_SUITE.erl | 37 +++++++++++++++++++++++----------- lib/stdlib/test/unicode_util_SUITE.erl | 15 ++++++++++++-- 2 files changed, 38 insertions(+), 14 deletions(-) (limited to 'lib/stdlib/test') diff --git a/lib/stdlib/test/string_SUITE.erl b/lib/stdlib/test/string_SUITE.erl index 7a39439764..f43bfb4482 100644 --- a/lib/stdlib/test/string_SUITE.erl +++ b/lib/stdlib/test/string_SUITE.erl @@ -712,21 +712,34 @@ nth_lexeme(_) -> meas(Config) -> + Parent = self(), + Exec = fun() -> + DataDir0 = proplists:get_value(data_dir, Config), + DataDir = filename:join(lists:droplast(filename:split(DataDir0))), + case proplists:get_value(profile, Config, false) of + false -> + do_measure(DataDir); + eprof -> + eprof:profile(fun() -> do_measure(DataDir) end, [set_on_spawn]), + eprof:stop_profiling(), + eprof:analyze(), + eprof:stop() + end, + Parent ! {test_done, self()}, + normal + end, + ct:timetrap({minutes,2}), case ct:get_timetrap_info() of {_,{_,Scale}} when Scale > 1 -> {skip,{will_not_run_in_debug,Scale}}; - _ -> % No scaling - DataDir0 = proplists:get_value(data_dir, Config), - DataDir = filename:join(lists:droplast(filename:split(DataDir0))), - case proplists:get_value(profile, Config, false) of - false -> - do_measure(DataDir); - eprof -> - eprof:profile(fun() -> do_measure(DataDir) end, [set_on_spawn]), - eprof:stop_profiling(), - eprof:analyze(), - eprof:stop() - end + _ -> % No scaling, run at most 1.5 min + Tester = spawn(Exec), + receive {test_done, Tester} -> ok + after 90000 -> + io:format("Timelimit reached stopping~n",[]), + exit(Tester, die) + end, + ok end. do_measure(DataDir) -> diff --git a/lib/stdlib/test/unicode_util_SUITE.erl b/lib/stdlib/test/unicode_util_SUITE.erl index f23e6b8b9a..a89627eba5 100644 --- a/lib/stdlib/test/unicode_util_SUITE.erl +++ b/lib/stdlib/test/unicode_util_SUITE.erl @@ -310,12 +310,23 @@ get(_) -> add_get_tests. count(Config) -> + Parent = self(), + Exec = fun() -> + do_measure(Config), + Parent ! {test_done, self()} + end, ct:timetrap({minutes,5}), case ct:get_timetrap_info() of {_,{_,Scale}} when Scale > 1 -> {skip,{measurments_skipped_debug,Scale}}; - _ -> % No scaling - do_measure(Config) + _ -> % No scaling, run at most 2 min + Tester = spawn(Exec), + receive {test_done, Tester} -> ok + after 120000 -> + io:format("Timelimit reached stopping~n",[]), + exit(Tester, die) + end, + ok end. do_measure(Config) -> -- cgit v1.2.3