From 5c6153ddd991f88f9539958f3c27e51793041abd Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Wed, 1 Jun 2016 12:01:00 +0200 Subject: Skip test cases if cover or debug is running --- lib/common_test/test/ct_repeat_testrun_SUITE.erl | 45 ++++++++++++++---------- 1 file changed, 26 insertions(+), 19 deletions(-) (limited to 'lib/common_test/test') diff --git a/lib/common_test/test/ct_repeat_testrun_SUITE.erl b/lib/common_test/test/ct_repeat_testrun_SUITE.erl index 632597c214..199df66767 100644 --- a/lib/common_test/test/ct_repeat_testrun_SUITE.erl +++ b/lib/common_test/test/ct_repeat_testrun_SUITE.erl @@ -66,25 +66,32 @@ %% there will be clashes with logging processes etc). %%-------------------------------------------------------------------- init_per_suite(Config0) -> - Config = ct_test_support:init_per_suite(Config0), - DataDir = ?config(data_dir, Config), - Suite1 = filename:join([DataDir,"a_test","r1_SUITE"]), - Suite2 = filename:join([DataDir,"b_test","r2_SUITE"]), - Opts0 = ct_test_support:get_opts(Config), - Opts1 = Opts0 ++ [{suite,Suite1},{testcase,tc2},{label,timing1}], - Opts2 = Opts0 ++ [{suite,Suite2},{testcase,tc2},{label,timing2}], - - %% Make sure both suites are compiled - {1,0,{0,0}} = ct_test_support:run(ct,run_test,[Opts1],Config), - {1,0,{0,0}} = ct_test_support:run(ct,run_test,[Opts2],Config), - - %% Time the shortest testcase to use for offset - {_T0,{1,0,{0,0}}} = timer:tc(ct_test_support,run,[ct,run_test,[Opts1],Config]), - - %% -2 is to ensure we hit inside the target test case and not after -% T = round(T0/1000000)-2, - T=0, - [{offset,T}|Config]. + TTInfo = {_T,{_Scaled,ScaleVal}} = ct:get_timetrap_info(), + ct:pal("Timetrap info = ~w", [TTInfo]), + if ScaleVal > 1 -> + {skip,"Skip on systems running e.g. cover or debug!"}; + ScaleVal =< 1 -> + Config = ct_test_support:init_per_suite(Config0), + DataDir = ?config(data_dir, Config), + Suite1 = filename:join([DataDir,"a_test","r1_SUITE"]), + Suite2 = filename:join([DataDir,"b_test","r2_SUITE"]), + Opts0 = ct_test_support:get_opts(Config), + Opts1 = Opts0 ++ [{suite,Suite1},{testcase,tc2},{label,timing1}], + Opts2 = Opts0 ++ [{suite,Suite2},{testcase,tc2},{label,timing2}], + + %% Make sure both suites are compiled + {1,0,{0,0}} = ct_test_support:run(ct,run_test,[Opts1],Config), + {1,0,{0,0}} = ct_test_support:run(ct,run_test,[Opts2],Config), + + %% Time the shortest testcase to use for offset + {_T0,{1,0,{0,0}}} = timer:tc(ct_test_support,run, + [ct,run_test,[Opts1],Config]), + + %% -2 is to ensure we hit inside the target test case and not after + % T = round(T0/1000000)-2, + T=0, + [{offset,T}|Config] + end. end_per_suite(Config) -> ct_test_support:end_per_suite(Config). -- cgit v1.2.3 From f204d0dd77fa261bf2b99a7aa0b6a2413f0ef533 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Mon, 6 Jun 2016 01:30:35 +0200 Subject: Measure file i/o overhead and skip test if the speed is too slow --- lib/common_test/test/ct_repeat_testrun_SUITE.erl | 31 +++++++++++++++++------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'lib/common_test/test') diff --git a/lib/common_test/test/ct_repeat_testrun_SUITE.erl b/lib/common_test/test/ct_repeat_testrun_SUITE.erl index 199df66767..195abdb7c0 100644 --- a/lib/common_test/test/ct_repeat_testrun_SUITE.erl +++ b/lib/common_test/test/ct_repeat_testrun_SUITE.erl @@ -70,7 +70,7 @@ init_per_suite(Config0) -> ct:pal("Timetrap info = ~w", [TTInfo]), if ScaleVal > 1 -> {skip,"Skip on systems running e.g. cover or debug!"}; - ScaleVal =< 1 -> + ScaleVal =< 1 -> Config = ct_test_support:init_per_suite(Config0), DataDir = ?config(data_dir, Config), Suite1 = filename:join([DataDir,"a_test","r1_SUITE"]), @@ -83,14 +83,27 @@ init_per_suite(Config0) -> {1,0,{0,0}} = ct_test_support:run(ct,run_test,[Opts1],Config), {1,0,{0,0}} = ct_test_support:run(ct,run_test,[Opts2],Config), - %% Time the shortest testcase to use for offset - {_T0,{1,0,{0,0}}} = timer:tc(ct_test_support,run, - [ct,run_test,[Opts1],Config]), - - %% -2 is to ensure we hit inside the target test case and not after - % T = round(T0/1000000)-2, - T=0, - [{offset,T}|Config] + %% Check if file i/o is too slow for correct measurements + Opts3 = Opts0 ++ [{suite,Suite1},{testcase,tc1},{label,timing3}], + {T,{1,0,{0,0}}} = + timer:tc(fun() -> + ct_test_support:run(ct,run_test, + [Opts3],Config), + ct_test_support:run(ct,run_test, + [Opts3],Config) + end), + %% The time to compare with here must match the timeout value + %% in the test suite. Accept 30% logging overhead (26 sec total). + if T > 26000000 -> + ct:pal("Timing test took ~w sec (< 27 sec expected). " + "Skipping the suite!", + [trunc(T/1000000)]), + {skip,"File I/O too slow for this suite"}; + true -> + ct:pal("Timing test took ~w sec. Proceeding...", + [trunc(T/1000000)]), + [{offset,0}|Config] + end end. end_per_suite(Config) -> -- cgit v1.2.3 From 3d5e91fada367fee723563fe133a45cc81dd3a73 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Tue, 7 Jun 2016 11:04:18 +0200 Subject: Make sure test node shuts down before skipping suite --- lib/common_test/test/ct_repeat_testrun_SUITE.erl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib/common_test/test') diff --git a/lib/common_test/test/ct_repeat_testrun_SUITE.erl b/lib/common_test/test/ct_repeat_testrun_SUITE.erl index 195abdb7c0..f8b6a379f6 100644 --- a/lib/common_test/test/ct_repeat_testrun_SUITE.erl +++ b/lib/common_test/test/ct_repeat_testrun_SUITE.erl @@ -85,19 +85,21 @@ init_per_suite(Config0) -> %% Check if file i/o is too slow for correct measurements Opts3 = Opts0 ++ [{suite,Suite1},{testcase,tc1},{label,timing3}], - {T,{1,0,{0,0}}} = - timer:tc(fun() -> - ct_test_support:run(ct,run_test, - [Opts3],Config), - ct_test_support:run(ct,run_test, - [Opts3],Config) - end), + {T,_} = + timer:tc( + fun() -> + {1,0,{0,0}} = ct_test_support:run(ct,run_test, + [Opts3],Config), + {1,0,{0,0}} = ct_test_support:run(ct,run_test, + [Opts3],Config) + end), %% The time to compare with here must match the timeout value %% in the test suite. Accept 30% logging overhead (26 sec total). if T > 26000000 -> ct:pal("Timing test took ~w sec (< 27 sec expected). " "Skipping the suite!", [trunc(T/1000000)]), + ct_test_support:end_per_suite(Config), {skip,"File I/O too slow for this suite"}; true -> ct:pal("Timing test took ~w sec. Proceeding...", -- cgit v1.2.3