From 1c8a57ce030907596bcddf14ce4b676f6adb3a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 5 Feb 2014 14:40:15 +0100 Subject: Speed up bs_construct_SUITE:dynamic/1 The original test comes from the emulator test suite for testing binary syntax in the run-time system. Running interpreted it can be quite slow, especially when the system has been compiled with the configure option --enable-native-libs (probably because of very many context switches between native code and BEAM code). Speed up the test by scaling down the size of binaries from 128 bits to 64 bits. That should speed up the test roughly four times. By running the little and big endian tests in parallel we will cut that time in half. Thus all in all the test will run roughly 8 times faster. --- lib/debugger/test/bs_construct_SUITE.erl | 40 +++++++++++++++++++------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/debugger/test/bs_construct_SUITE.erl b/lib/debugger/test/bs_construct_SUITE.erl index 4870c87d74..8a6798c6ad 100644 --- a/lib/debugger/test/bs_construct_SUITE.erl +++ b/lib/debugger/test/bs_construct_SUITE.erl @@ -647,19 +647,27 @@ make_sub_bin(Bin0) -> %% give the same result. dynamic(Config) when is_list(Config) -> - ?line dynamic_1(fun dynamic_big/5), - ?line dynamic_1(fun dynamic_little/5), + Ps = [spawn_monitor(fun() -> + dynamic_1(Fun) + end) || Fun <- [fun dynamic_big/5, + fun dynamic_little/5]], + [receive + {'DOWN',Ref,process,Pid,normal} -> + ok; + {'DOWN',Ref,process,Pid,Exit} -> + ?t:fail({Pid,Exit}) + end || {Pid,Ref} <- Ps], ok. dynamic_1(Dynamic) -> - <> = erlang:md5([0]), - <> = erlang:md5([1]), - <> = erlang:md5([2]), - 8385 = dynamic_2(0, {Int,Lpad,Rpad,Dynamic}, 0). + <> = erlang:md5([0]), + <> = erlang:md5([1]), + <> = erlang:md5([2]), + 2145 = dynamic_2(0, {Int,Lpad,Rpad,Dynamic}, 0). -dynamic_2(129, _, Count) -> Count; +dynamic_2(64+1, _, Count) -> Count; dynamic_2(Bef, Data, Count0) -> - Count = dynamic_3(Bef, 128-Bef, Data, Count0), + Count = dynamic_3(Bef, 64-Bef, Data, Count0), dynamic_2(Bef+1, Data, Count). dynamic_3(_, -1, _, Count) -> Count; @@ -680,13 +688,13 @@ dynamic_big(Bef, N, Int, Lpad, Rpad) -> <> = NumBin, %% Construct the binary in two different ways. - Bin = id(<>), - Bin = <>, + Bin = id(<>), + Bin = <>, %% Further verify the result by matching. LpadMasked = Lpad band ((1 bsl Bef) - 1), - RpadMasked = Rpad band ((1 bsl (128-Bef-N)) - 1), - Rbits = (128-Bef-N), + RpadMasked = Rpad band ((1 bsl (64-Bef-N)) - 1), + Rbits = (64-Bef-N), <> = id(Bin), ok. @@ -696,13 +704,13 @@ dynamic_little(Bef, N, Int, Lpad, Rpad) -> <> = NumBin, %% Construct the binary in two different ways. - Bin = id(<>), - Bin = <>, + Bin = id(<>), + Bin = <>, %% Further verify the result by matching. LpadMasked = Lpad band ((1 bsl Bef) - 1), - RpadMasked = Rpad band ((1 bsl (128-Bef-N)) - 1), - Rbits = (128-Bef-N), + RpadMasked = Rpad band ((1 bsl (64-Bef-N)) - 1), + Rbits = (64-Bef-N), <> = id(Bin), ok. -- cgit v1.2.3 From 04d156de2527b796c6352b1ef138ec59fbcff587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 14 Feb 2014 10:23:19 +0100 Subject: With --enable-native-libs, skip eprof_SUITE:basic_option/1 eprof does not work on native-compiled code. Since eprof_SUITE:basic_option/1 does profiling on the lists modules, the test case will fail if --enable-native-libs is used. --- lib/tools/test/eprof_SUITE.erl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/tools/test/eprof_SUITE.erl b/lib/tools/test/eprof_SUITE.erl index 26685a6a84..1227d5b841 100644 --- a/lib/tools/test/eprof_SUITE.erl +++ b/lib/tools/test/eprof_SUITE.erl @@ -127,6 +127,14 @@ basic(Config) when is_list(Config) -> ok. basic_option(Config) when is_list(Config) -> + %% Eprof is not supported on native-compile code. + case lists:module_info(native_addresses) of + [] -> basic_option_1(Config); + [_|_] -> {skip,"lists is native-compiled"} + end. + +basic_option_1(Config) -> + %% load eprof_test and change directory {ok, OldCurDir} = file:get_cwd(), -- cgit v1.2.3