File 0521-compiler-tests-Avoid-skipping-slow-tests-cases-in-cl.patch of Package erlang
From 7b18220e413e2a397eff0a3be67190a328873f4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Wed, 25 Sep 2019 15:35:01 +0200
Subject: [PATCH] compiler tests: Avoid skipping slow tests cases in cloned
modules
In cloned modules (e.g. guard_inline_SUITE, cloned from
guard_SUITE), certain slow test cases that don't make sense
run more than once are skipped.
However, those test cases end up as false positives in our list of
test cases that are skipped on every platform. To avoid that,
omit the slow test cases from the list of test cases to be run.
---
lib/compiler/test/guard_SUITE.erl | 22 +++++++++++++---------
lib/compiler/test/misc_SUITE.erl | 33 +++++++++++++++------------------
lib/compiler/test/receive_SUITE.erl | 23 ++++++++++++++---------
3 files changed, 42 insertions(+), 36 deletions(-)
diff --git a/lib/compiler/test/guard_SUITE.erl b/lib/compiler/test/guard_SUITE.erl
index cea7a374cd..a61c56e331 100644
--- a/lib/compiler/test/guard_SUITE.erl
+++ b/lib/compiler/test/guard_SUITE.erl
@@ -41,7 +41,7 @@
suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
- [{group,p}].
+ slow_group() ++ [{group,p}].
groups() ->
[{p,[parallel],
@@ -52,10 +52,11 @@ groups() ->
old_guard_tests,complex_guard,gbif,
t_is_boolean,is_function_2,tricky,
rel_ops,rel_op_combinations,
- literal_type_tests,basic_andalso_orelse,traverse_dcd,
+ basic_andalso_orelse,traverse_dcd,
check_qlc_hrl,andalso_semi,t_tuple_size,binary_part,
bad_constants,bad_guards,guard_in_catch,beam_bool_SUITE,
- cover_beam_dead]}].
+ cover_beam_dead]},
+ {slow,[],[literal_type_tests]}].
init_per_suite(Config) ->
test_lib:recompile(?MODULE),
@@ -70,6 +71,15 @@ init_per_group(_GroupName, Config) ->
end_per_group(_GroupName, Config) ->
Config.
+slow_group() ->
+ case ?MODULE of
+ guard_SUITE ->
+ %% Canononical module name. Run slow cases.
+ [{group,slow}];
+ _ ->
+ %% Cloned module. Don't run.
+ []
+ end.
misc(Config) when is_list(Config) ->
42 = case id(42) of
@@ -1581,12 +1591,6 @@ redundant_12(_) -> none.
%% Test type tests on literal values. (From emulator test suites.)
literal_type_tests(Config) when is_list(Config) ->
- case ?MODULE of
- guard_SUITE -> literal_type_tests_1(Config);
- _ -> {skip,"Enough to run this case once."}
- end.
-
-literal_type_tests_1(Config) ->
%% Generate an Erlang module with all different type of type tests.
Tests = make_test([{T,L} || T <- type_tests(), L <- literals()] ++
[{is_function,L1,L2} ||
diff --git a/lib/compiler/test/misc_SUITE.erl b/lib/compiler/test/misc_SUITE.erl
index a0b415ceaa..6e81bafd61 100644
--- a/lib/compiler/test/misc_SUITE.erl
+++ b/lib/compiler/test/misc_SUITE.erl
@@ -61,12 +61,13 @@ suite() ->
-spec all() -> misc_SUITE_test_cases().
all() ->
- [{group,p}].
+ slow_group() ++ [{group,p}].
groups() ->
- [{p,[],
- [tobias,empty_string,md5,silly_coverage,
- confused_literals,integer_encoding,override_bif]}].
+ [{p,[parallel],
+ [tobias,empty_string,silly_coverage,
+ confused_literals,override_bif]},
+ {slow,[parallel],[integer_encoding,md5]}].
init_per_suite(Config) ->
test_lib:recompile(?MODULE),
@@ -81,8 +82,16 @@ init_per_group(_GroupName, Config) ->
end_per_group(_GroupName, Config) ->
Config.
-
-
+slow_group() ->
+ case ?MODULE of
+ misc_SUITE ->
+ %% Canononical module name. Run slow cases.
+ [{group,slow}];
+ _ ->
+ %% Cloned module. Don't run.
+ []
+ end.
+
%%
%% Functions that override new and old bif's
%%
@@ -142,12 +151,6 @@ empty_string_1(T) ->
end.
md5(Config) when is_list(Config) ->
- case ?MODULE of
- misc_SUITE -> md5();
- _ -> {skip,"Enough to run this case once."}
- end.
-
-md5() ->
Dir = filename:dirname(code:which(?MODULE)),
Beams = filelib:wildcard(filename:join(Dir, "*.beam")),
io:format("Found ~w beam files", [length(Beams)]),
@@ -334,12 +337,6 @@ integer_encoding() ->
[{timetrap,{minutes,4}}].
integer_encoding(Config) when is_list(Config) ->
- case ?MODULE of
- misc_SUITE -> integer_encoding_1(Config);
- _ -> {skip,"Enough to run this case once."}
- end.
-
-integer_encoding_1(Config) ->
PrivDir = proplists:get_value(priv_dir, Config),
SrcFile = filename:join(PrivDir, "misc_SUITE_integer_encoding.erl"),
DataFile = filename:join(PrivDir, "integer_encoding.data"),
diff --git a/lib/compiler/test/receive_SUITE.erl b/lib/compiler/test/receive_SUITE.erl
index 8cd864c59e..49a57cd1ff 100644
--- a/lib/compiler/test/receive_SUITE.erl
+++ b/lib/compiler/test/receive_SUITE.erl
@@ -41,12 +41,13 @@ suite() ->
{timetrap,{minutes,2}}].
all() ->
- [{group,p}].
+ slow_group() ++ [{group,p}].
groups() ->
[{p,test_lib:parallel(),
- [recv,coverage,otp_7980,ref_opt,export,wait,
- recv_in_try,double_recv]}].
+ [recv,coverage,otp_7980,export,wait,
+ recv_in_try,double_recv]},
+ {slow,[],[ref_opt]}].
init_per_suite(Config) ->
@@ -63,6 +64,16 @@ init_per_group(_GroupName, Config) ->
end_per_group(_GroupName, Config) ->
Config.
+slow_group() ->
+ case ?MODULE of
+ receive_SUITE ->
+ %% Canononical module name. Run slow cases.
+ [{group,slow}];
+ _ ->
+ %% Cloned module. Don't run.
+ []
+ end.
+
-record(state, {ena = true}).
recv(Config) when is_list(Config) ->
@@ -190,12 +201,6 @@ otp_7980_add_clients(Count) ->
end, Count, [1,2,3]).
ref_opt(Config) when is_list(Config) ->
- case ?MODULE of
- receive_SUITE -> ref_opt_1(Config);
- _ -> {skip,"Enough to run this case once."}
- end.
-
-ref_opt_1(Config) ->
DataDir = proplists:get_value(data_dir, Config),
PrivDir = proplists:get_value(priv_dir, Config),
Sources = filelib:wildcard(filename:join([DataDir,"ref_opt","*.{erl,S}"])),
--
2.16.4