aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/test_lib.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-10-26 11:20:10 +0200
committerBjörn Gustavsson <[email protected]>2012-10-26 11:20:10 +0200
commita8b2ba096dc48a29af52fd68070089d4bbb37483 (patch)
treeafca45311523d2da2fcb545e3649e0717a059dcd /lib/compiler/test/test_lib.erl
parenta6608f9e67b9f67e8d21bc3df81ba8129755741a (diff)
parentd18ab0179e83f378026cea87dea026cae1077bec (diff)
downloadotp-a8b2ba096dc48a29af52fd68070089d4bbb37483.tar.gz
otp-a8b2ba096dc48a29af52fd68070089d4bbb37483.tar.bz2
otp-a8b2ba096dc48a29af52fd68070089d4bbb37483.zip
Merge branch 'bjorn/compiler/test-cases'
* bjorn/compiler/test-cases: Correct typo in test suite name compiler: Run testcases in parallel
Diffstat (limited to 'lib/compiler/test/test_lib.erl')
-rw-r--r--lib/compiler/test/test_lib.erl15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/compiler/test/test_lib.erl b/lib/compiler/test/test_lib.erl
index 2295592a38..996c369705 100644
--- a/lib/compiler/test/test_lib.erl
+++ b/lib/compiler/test/test_lib.erl
@@ -20,7 +20,8 @@
-include("test_server.hrl").
-compile({no_auto_import,[binary_part/2]}).
--export([recompile/1,opt_opts/1,get_data_dir/1,smoke_disasm/1,p_run/2,binary_part/2]).
+-export([recompile/1,parallel/0,uniq/0,opt_opts/1,get_data_dir/1,
+ smoke_disasm/1,p_run/2,binary_part/2]).
recompile(Mod) when is_atom(Mod) ->
case whereis(cover_server) of
@@ -43,6 +44,18 @@ smoke_disasm(File) when is_list(File) ->
Res = beam_disasm:file(File),
{beam_file,_Mod} = {element(1, Res),element(2, Res)}.
+parallel() ->
+ case ?t:is_cover() orelse erlang:system_info(schedulers) =:= 1 of
+ true -> [];
+ false -> [parallel]
+ end.
+
+uniq() ->
+ U0 = erlang:ref_to_list(make_ref()),
+ U1 = re:replace(U0, "^#Ref", ""),
+ U = re:replace(U1, "[^[A-Za-z0-9_]+", "_", [global]),
+ re:replace(U, "_*$", "", [{return,list}]).
+
%% Retrieve the "interesting" compiler options (options for optimization
%% and compatibility) for the given module.