From e6886b8389a036002eae30332cfde1b233ba4c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 5 Sep 2019 10:26:37 +0200 Subject: Improve coverage for functionality used by Core Erlang modules Make sure to recompile the lfe_*_SUITE modules when running under cover. --- lib/compiler/test/lfe_andor_SUITE.core | 2 ++ lib/compiler/test/lfe_guard_SUITE.core | 2 ++ lib/compiler/test/test_lib.erl | 18 +++++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/compiler/test/lfe_andor_SUITE.core b/lib/compiler/test/lfe_andor_SUITE.core index df58b39ae6..e8cb0919a0 100644 --- a/lib/compiler/test/lfe_andor_SUITE.core +++ b/lib/compiler/test/lfe_andor_SUITE.core @@ -34,6 +34,8 @@ module 'lfe_andor_SUITE' ['$handle_undefined_function'/2, 'init_per_suite'/1 = %% Line 48 fun (_config) -> + do + call 'test_lib':'recompile_core'('lfe_andor_SUITE') _config 'end_per_suite'/1 = %% Line 50 diff --git a/lib/compiler/test/lfe_guard_SUITE.core b/lib/compiler/test/lfe_guard_SUITE.core index 920be82f61..9d184ed166 100644 --- a/lib/compiler/test/lfe_guard_SUITE.core +++ b/lib/compiler/test/lfe_guard_SUITE.core @@ -53,6 +53,8 @@ module 'lfe_guard_SUITE' ['$handle_undefined_function'/2, 'init_per_suite'/1 = %% Line 62 fun (_config) -> + do + call 'test_lib':'recompile_core'('lfe_guard_SUITE') _config 'end_per_suite'/1 = %% Line 64 diff --git a/lib/compiler/test/test_lib.erl b/lib/compiler/test/test_lib.erl index 4b68e663cd..66f45aad5e 100644 --- a/lib/compiler/test/test_lib.erl +++ b/lib/compiler/test/test_lib.erl @@ -21,7 +21,8 @@ -include_lib("common_test/include/ct.hrl"). -compile({no_auto_import,[binary_part/2]}). --export([id/1,recompile/1,parallel/0,uniq/0,opt_opts/1,get_data_dir/1, +-export([id/1,recompile/1,recompile_core/1,parallel/0, + uniq/0,opt_opts/1,get_data_dir/1, is_cloned_mod/1,smoke_disasm/1,p_run/2, highest_opcode/1]). @@ -45,6 +46,21 @@ recompile(Mod) when is_atom(Mod) -> %% Smoke-test of beam disassembler. smoke_disasm(Mod). +recompile_core(Mod) when is_atom(Mod) -> + case whereis(cover_server) of + undefined -> ok; + _ -> + %% Re-compile the test suite if the cover server is running. + Beam = code:which(Mod), + Src = filename:rootname(Beam, ".beam"), + Opts = [bin_opt_info|opt_opts(Mod)], + io:format("Recompiling ~p (~p)\n", [Mod,Opts]), + c:c(Src, [from_core,{outdir,filename:dirname(Src)}|Opts]) + end, + + %% Smoke-test of beam disassembler. + smoke_disasm(Mod). + smoke_disasm(Mod) when is_atom(Mod) -> smoke_disasm(code:which(Mod)); smoke_disasm(File) when is_list(File) -> -- cgit v1.2.1