aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/andor_SUITE.erl6
-rw-r--r--lib/compiler/test/bs_bincomp_SUITE.erl38
-rw-r--r--lib/compiler/test/compilation_SUITE.erl16
-rw-r--r--lib/compiler/test/compile_SUITE.erl8
-rw-r--r--lib/compiler/test/core_fold_SUITE.erl9
-rw-r--r--lib/compiler/test/fun_SUITE.erl13
-rw-r--r--lib/compiler/test/warnings_SUITE.erl1
7 files changed, 46 insertions, 45 deletions
diff --git a/lib/compiler/test/andor_SUITE.erl b/lib/compiler/test/andor_SUITE.erl
index 4ffbe07e32..7bef0aa27c 100644
--- a/lib/compiler/test/andor_SUITE.erl
+++ b/lib/compiler/test/andor_SUITE.erl
@@ -194,6 +194,9 @@ t_andalso(Config) when is_list(Config) ->
?line false = id(false) andalso not id(glurf),
?line false = false andalso not id(glurf),
+ true = begin (X1 = true) andalso X1, X1 end,
+ false = false = begin (X2 = false) andalso X2, X2 end,
+
ok.
t_orelse(Config) when is_list(Config) ->
@@ -224,6 +227,9 @@ t_orelse(Config) when is_list(Config) ->
?line true = id(true) orelse not id(glurf),
?line true = true orelse not id(glurf),
+ true = begin (X1 = true) orelse X1, X1 end,
+ false = begin (X2 = false) orelse X2, X2 end,
+
ok.
t_andalso_1({X,Y}) ->
diff --git a/lib/compiler/test/bs_bincomp_SUITE.erl b/lib/compiler/test/bs_bincomp_SUITE.erl
index f6d8b1c532..4450405695 100644
--- a/lib/compiler/test/bs_bincomp_SUITE.erl
+++ b/lib/compiler/test/bs_bincomp_SUITE.erl
@@ -25,7 +25,7 @@
init_per_group/2,end_per_group/2,
byte_aligned/1,bit_aligned/1,extended_byte_aligned/1,
extended_bit_aligned/1,mixed/1,filters/1,trim_coverage/1,
- nomatch/1,sizes/1,tail/1]).
+ nomatch/1,sizes/1]).
-include_lib("test_server/include/test_server.hrl").
@@ -35,7 +35,7 @@ all() ->
test_lib:recompile(?MODULE),
[byte_aligned, bit_aligned, extended_byte_aligned,
extended_bit_aligned, mixed, filters, trim_coverage,
- nomatch, sizes, tail].
+ nomatch, sizes].
groups() ->
[].
@@ -290,40 +290,6 @@ sizes(Config) when is_list(Config) ->
?line cs_end(),
ok.
-tail(Config) when is_list(Config) ->
- ?line [] = tail_1(<<0:7>>),
- ?line [0] = tail_1(<<0>>),
- ?line [0] = tail_1(<<0:12>>),
- ?line [0,0] = tail_1(<<0:20>>),
-
- ?line [] = tail_2(<<0:7>>),
- ?line [42] = tail_2(<<0>>),
- ?line [] = tail_2(<<0:12>>),
- ?line [42,42] = tail_2(<<0,1>>),
-
- ?line <<>> = tail_3(<<0:7>>),
- ?line <<42>> = tail_3(<<0>>),
- ?line <<42>> = tail_3(<<0:12>>),
- ?line <<42,42>> = tail_3(<<0:20>>),
-
- ?line [] = tail_4(<<0:15>>),
- ?line [7] = tail_4(<<7,8>>),
- ?line [9] = tail_4(<<9,17:12>>),
- ok.
-
-tail_1(Bits) ->
- [X || <<X:8/integer, _/bits>> <= Bits].
-
-tail_2(Bits) ->
- [42 || <<_:8/integer, _/bytes>> <= Bits].
-
-tail_3(Bits) ->
- << <<42>> || <<_:8/integer, _/bits>> <= Bits >>.
-
-tail_4(Bits) ->
- [X || <<X:8/integer, Tail/bits>> <= Bits, bit_size(Tail) >= 8].
-
-
cs_init() ->
erts_debug:set_internal_state(available_internal_state, true),
ok.
diff --git a/lib/compiler/test/compilation_SUITE.erl b/lib/compiler/test/compilation_SUITE.erl
index d517029b1b..f7b1dbdddf 100644
--- a/lib/compiler/test/compilation_SUITE.erl
+++ b/lib/compiler/test/compilation_SUITE.erl
@@ -196,7 +196,7 @@ redundant_case_1(_) -> d.
failure(Module, Conf) ->
?line Src = filename:join(?config(data_dir, Conf), atom_to_list(Module)),
?line Out = ?config(priv_dir,Conf),
- ?line io:format("Compiling: ~s\n", [Src]),
+ ?line io:format("Compiling: ~ts\n", [Src]),
?line CompRc = compile:file(Src, [{outdir,Out},return,time]),
?line io:format("Result: ~p\n",[CompRc]),
?line case CompRc of
@@ -278,6 +278,16 @@ try_it(StartNode, Module, Conf) ->
?line ok = rpc:call(Node, ?MODULE, load_and_call, [Out, Module]),
?line test_server:timetrap_cancel(LastDog),
+ AsmDog = test_server:timetrap(test_server:minutes(10)),
+ io:format("Compiling (from assembly): ~s\n", [Src]),
+ {ok,_} = compile:file(Src, [to_asm,{outdir,Out},report|OtherOpts]),
+ Asm = filename:join(Out, lists:concat([Module, ".S"])),
+ CompRc3 = compile:file(Asm, [from_asm,{outdir,Out},report|OtherOpts]),
+ io:format("Result: ~p\n",[CompRc3]),
+ {ok,_} = CompRc3,
+ ok = rpc:call(Node, ?MODULE, load_and_call, [Out, Module]),
+ test_server:timetrap_cancel(AsmDog),
+
case StartNode of
false -> ok;
true -> ?line test_server:stop_node(Node)
@@ -466,8 +476,8 @@ self_compile_node(CompilerDir, OutDir, Version, Opts) ->
ok.
compile_compiler(Files, OutDir, Version, InlineOpts) ->
- io:format("~s", [code:which(compile)]),
- io:format("Compiling ~s into ~s", [Version,OutDir]),
+ io:format("~ts", [code:which(compile)]),
+ io:format("Compiling ~s into ~ts", [Version,OutDir]),
Opts = [report,
bin_opt_info,
{outdir,OutDir},
diff --git a/lib/compiler/test/compile_SUITE.erl b/lib/compiler/test/compile_SUITE.erl
index be01ea713d..4ec75d015e 100644
--- a/lib/compiler/test/compile_SUITE.erl
+++ b/lib/compiler/test/compile_SUITE.erl
@@ -769,8 +769,8 @@ do_core({M,A}, Outdir) ->
error
end.
-%% Compile to Beam assembly language (.S) and the try to
-%% run .S throught the compiler again.
+%% Compile to Beam assembly language (.S) and then try to
+%% run .S through the compiler again.
asm(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:minutes(20)),
@@ -791,10 +791,10 @@ do_asm(Beam, Outdir) ->
try
{ok,M,Asm} = compile:forms(A, ['S']),
AsmFile = filename:join(Outdir, atom_to_list(M)++".S"),
- {ok,Fd} = file:open(AsmFile, [write]),
+ {ok,Fd} = file:open(AsmFile, [write,{encoding,utf8}]),
beam_listing:module(Fd, Asm),
ok = file:close(Fd),
- case compile:file(AsmFile, [from_asm,no_postopt,binary,report]) of
+ case compile:file(AsmFile, [from_asm,binary,report]) of
{ok,M,_} ->
ok = file:delete(AsmFile);
Other ->
diff --git a/lib/compiler/test/core_fold_SUITE.erl b/lib/compiler/test/core_fold_SUITE.erl
index a5a4e62a42..69f61a046f 100644
--- a/lib/compiler/test/core_fold_SUITE.erl
+++ b/lib/compiler/test/core_fold_SUITE.erl
@@ -249,6 +249,12 @@ coverage(Config) when is_list(Config) ->
case list_to_pid("<0.42.0>") of
Pid when is_pid(Pid) -> ok
end,
+
+ %% Cover the non-variable case in bsm_do_an/4.
+ ok = bsm_an_inlined(<<1>>, Config),
+ error = bsm_an_inlined(<<1,2,3>>, Config),
+ error = bsm_an_inlined([], Config),
+
ok.
cover_will_match_list_type(A) ->
@@ -290,6 +296,9 @@ cover_is_safe_bool_expr(X) ->
false
end.
+bsm_an_inlined(<<_:8>>, _) -> ok;
+bsm_an_inlined(_, _) -> error.
+
id(I) -> I.
unused_multiple_values_error(Config) when is_list(Config) ->
diff --git a/lib/compiler/test/fun_SUITE.erl b/lib/compiler/test/fun_SUITE.erl
index 6067ee8e06..e35692efd1 100644
--- a/lib/compiler/test/fun_SUITE.erl
+++ b/lib/compiler/test/fun_SUITE.erl
@@ -21,7 +21,7 @@
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
init_per_group/2,end_per_group/2,
test1/1,overwritten_fun/1,otp_7202/1,bif_fun/1,
- external/1]).
+ external/1,eep37/1]).
%% Internal export.
-export([call_me/1]).
@@ -32,7 +32,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
test_lib:recompile(?MODULE),
- [test1,overwritten_fun,otp_7202,bif_fun,external].
+ [test1,overwritten_fun,otp_7202,bif_fun,external,eep37].
groups() ->
[].
@@ -197,5 +197,14 @@ external(Config) when is_list(Config) ->
call_me(I) ->
{ok,I}.
+eep37(Config) when is_list(Config) ->
+ F = fun Fact(N) when N > 0 -> N * Fact(N - 1); Fact(0) -> 1 end,
+ Add = fun _(N) -> N + 1 end,
+ UnusedName = fun BlackAdder(N) -> N + 42 end,
+ 720 = F(6),
+ 10 = Add(9),
+ 50 = UnusedName(8),
+ ok.
+
id(I) ->
I.
diff --git a/lib/compiler/test/warnings_SUITE.erl b/lib/compiler/test/warnings_SUITE.erl
index 810b2b48c9..7186956603 100644
--- a/lib/compiler/test/warnings_SUITE.erl
+++ b/lib/compiler/test/warnings_SUITE.erl
@@ -117,6 +117,7 @@ pattern2(Config) when is_list(Config) ->
Source,
[nowarn_unused_vars],
{warnings,[{2,sys_core_fold,{nomatch_shadow,1}},
+ {4,sys_core_fold,no_clause_match},
{5,sys_core_fold,nomatch_clause_type},
{6,sys_core_fold,nomatch_clause_type}]}}],
?line [] = run(Config, Ts),