From cc66230916294d9a29a26c77d32e88ca38ea6927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Fri, 27 May 2016 16:56:00 +0200 Subject: kernel: Don't test negative time values in file info --- lib/kernel/test/prim_file_SUITE.erl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl index cc7f2f6713..8be94f1e57 100644 --- a/lib/kernel/test/prim_file_SUITE.erl +++ b/lib/kernel/test/prim_file_SUITE.erl @@ -1023,7 +1023,7 @@ file_write_file_info_opts(Config) when is_list(Config) -> Time <- [ 0,1,-1,100,-100,1000,-1000,10000,-10000 ] ]), - %% REM: determine date range dependent on time_t = Uint32 | Sint32 | Sint64 + %% REM: determine date range dependent on time_t = Uint32 | Sint32 | Sint64 | Uint64 %% Determine time_t on os:type()? lists:foreach(fun ({FI, Opts}) -> ok = ?PRIM_FILE_call(write_file_info, Handle, [Name, FI, Opts]) @@ -1072,9 +1072,10 @@ file_write_read_file_info_opts(Config) when is_list(Config) -> %ok = file_write_read_file_info_opts(Handle, Name, {{1930, 04, 28}, {19,30,22}}, [{time, local}]), %ok = file_write_read_file_info_opts(Handle, Name, {{1930, 04, 28}, {19,30,22}}, [{time, universal}]), ok = file_write_read_file_info_opts(Handle, Name, 1, [{time, posix}]), - ok = file_write_read_file_info_opts(Handle, Name, -1, [{time, posix}]), + %% will not work on platforms with unsigned time_t + %ok = file_write_read_file_info_opts(Handle, Name, -1, [{time, posix}]), + %ok = file_write_read_file_info_opts(Handle, Name, -300000, [{time, posix}]), ok = file_write_read_file_info_opts(Handle, Name, 300000, [{time, posix}]), - ok = file_write_read_file_info_opts(Handle, Name, -300000, [{time, posix}]), ok = file_write_read_file_info_opts(Handle, Name, 0, [{time, posix}]), ok = ?PRIM_FILE:stop(Handle), -- cgit v1.2.3 From 9d34b2abed25ab304c345bef922b0632af9d2cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Fri, 27 May 2016 18:54:13 +0200 Subject: stdlib: Strengthen or relax test cases In particular, valgrind needs a lot of time for certain tests. --- lib/stdlib/test/binary_module_SUITE.erl | 29 +++------------------- lib/stdlib/test/ets_SUITE.erl | 4 ++- lib/stdlib/test/io_SUITE.erl | 44 ++++++++------------------------- lib/stdlib/test/io_proto_SUITE.erl | 3 ++- lib/stdlib/test/rand_SUITE.erl | 28 ++++++--------------- lib/stdlib/test/select_SUITE.erl | 30 +++------------------- lib/stdlib/test/unicode_SUITE.erl | 24 ++---------------- 7 files changed, 32 insertions(+), 130 deletions(-) (limited to 'lib') diff --git a/lib/stdlib/test/binary_module_SUITE.erl b/lib/stdlib/test/binary_module_SUITE.erl index 55fdcdd054..c5cfea5e9e 100644 --- a/lib/stdlib/test/binary_module_SUITE.erl +++ b/lib/stdlib/test/binary_module_SUITE.erl @@ -19,9 +19,7 @@ %% -module(binary_module_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_testcase/2, end_per_testcase/2, - init_per_group/2,end_per_group/2, +-export([all/0, suite/0, interesting/1,scope_return/1,random_ref_comp/1,random_ref_sr_comp/1, random_ref_fla_comp/1,parts/1, bin_to_list/1, list_to_bin/1, copy/1, referenced/1,guard/1,encode_decode/1,badargs/1,longest_common_trap/1]). @@ -30,15 +28,9 @@ -include_lib("common_test/include/ct.hrl"). -init_per_testcase(_Case, Config) -> - Config. - -end_per_testcase(_Case, _Config) -> - ok. - suite() -> [{ct_hooks,[ts_install_cth]}, - {timetrap,{minutes,30}}]. + {timetrap,{minutes,10}}]. all() -> [scope_return,interesting, random_ref_fla_comp, random_ref_sr_comp, @@ -46,21 +38,6 @@ all() -> referenced, guard, encode_decode, badargs, longest_common_trap]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -define(MASK_ERROR(EXPR),mask_error((catch (EXPR)))). @@ -961,6 +938,7 @@ random_parts(X,N) -> %% Test pseudorandomly generated cases against reference implementation. random_ref_comp(Config) when is_list(Config) -> + ct:timetrap({minutes,30}), %% valgrind needs a lot of time put(success_counter,0), rand:seed(exsplus, {1271,769940,559934}), Nr = {1,40}, @@ -991,6 +969,7 @@ random_ref_comp(Config) when is_list(Config) -> %% Test pseudorandomly generated cases against reference implementation %% of split and replace. random_ref_sr_comp(Config) when is_list(Config) -> + ct:timetrap({minutes,30}), %% valgrind needs a lot put(success_counter,0), rand:seed(exsplus, {1271,769940,559934}), Nr = {1,40}, diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl index 15e3142408..57ee25bcf0 100644 --- a/lib/stdlib/test/ets_SUITE.erl +++ b/lib/stdlib/test/ets_SUITE.erl @@ -125,7 +125,7 @@ end_per_testcase(_Func, _Config) -> suite() -> [{ct_hooks,[ts_install_cth]}, - {timetrap,{minutes,20}}]. + {timetrap,{minutes,5}}]. all() -> [{group, new}, {group, insert}, {group, lookup}, @@ -3297,6 +3297,7 @@ exit_large_table_owner_do(Opts,{FEData,Config}) -> verify_rescheduling_exit(Config, FEData, Opts, false, 1, 1). exit_many_large_table_owner(Config) when is_list(Config) -> + ct:timetrap({minutes,30}), %% valgrind needs a lot %%Data = [{erlang:phash2(I, 16#ffffff),I} || I <- lists:seq(1, 500000)], FEData = fun(Do) -> repeat_while(fun(500000) -> {false,ok}; (I) -> Do({erlang:phash2(I, 16#ffffff),I}), @@ -4270,6 +4271,7 @@ do_lookup_element(Tab, N, M) -> heavy_concurrent(Config) when is_list(Config) -> + ct:timetrap({minutes,30}), %% valgrind needs a lot of time repeat_for_opts(do_heavy_concurrent). do_heavy_concurrent(Opts) -> diff --git a/lib/stdlib/test/io_SUITE.erl b/lib/stdlib/test/io_SUITE.erl index be6b470ca7..7d48cbc97c 100644 --- a/lib/stdlib/test/io_SUITE.erl +++ b/lib/stdlib/test/io_SUITE.erl @@ -19,10 +19,7 @@ %% -module(io_SUITE). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). - --export([init_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0]). -export([error_1/1, float_g/1, otp_5403/1, otp_5813/1, otp_6230/1, otp_6282/1, otp_6354/1, otp_6495/1, otp_6517/1, otp_6502/1, @@ -51,12 +48,6 @@ -define(privdir(Conf), proplists:get_value(priv_dir, Conf)). -endif. -init_per_testcase(_Case, Config) -> - Config. - -end_per_testcase(_Case, _Config) -> - ok. - suite() -> [{ct_hooks,[ts_install_cth]}, {timetrap,{minutes,1}}]. @@ -72,22 +63,6 @@ all() -> io_lib_width_too_small, io_with_huge_message_queue, format_string, maps, coverage]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - %% Error cases for output. error_1(Config) when is_list(Config) -> %% We don't do erroneous output on stdout - the test server @@ -952,7 +927,7 @@ otp_6708(Config) when is_list(Config) -> otp_7084() -> - [{timetrap,{minutes,3}}]. + [{timetrap,{minutes,6}}]. %% valgrind needs a lot of time %% OTP-7084. Printing floating point numbers nicely. otp_7084(Config) when is_list(Config) -> @@ -1830,13 +1805,14 @@ bad_printable_range(Config) when is_list(Config) -> Cmd = lists:concat([lib:progname()," +pcunnnnnicode -run erlang halt"]), P = open_port({spawn, Cmd}, [stderr_to_stdout, {line, 200}]), ok = receive - {P, {data, {eol , "bad range of printable characters" ++ _}}} -> - ok; - Other -> - Other - after 1000 -> - timeout - end, + {P, {data, {eol , "bad range of printable characters" ++ _}}} -> + ok; + Other -> + Other + %% valgrind needs a lot of time + after 6000 -> + timeout + end, catch port_close(P), flush_from_port(P), ok. diff --git a/lib/stdlib/test/io_proto_SUITE.erl b/lib/stdlib/test/io_proto_SUITE.erl index 4e39f011f6..1e286a9306 100644 --- a/lib/stdlib/test/io_proto_SUITE.erl +++ b/lib/stdlib/test/io_proto_SUITE.erl @@ -75,7 +75,7 @@ end_per_testcase(_Case, Config) -> suite() -> [{ct_hooks,[ts_install_cth]}, - {timetrap,{minutes,20}}]. + {timetrap,{minutes,5}}]. all() -> [setopts_getopts, unicode_options, unicode_options_gen, @@ -462,6 +462,7 @@ unicode_options(Config) when is_list(Config) -> %% Tests various unicode options on random generated files. unicode_options_gen(Config) when is_list(Config) -> + ct:timetrap({minutes,30}), %% valgrind needs a alot of time random:seed(1240, 900586, 553728), PrivDir = proplists:get_value(priv_dir, Config), AllModes = [utf8,utf16,{utf16,big},{utf16,little}, diff --git a/lib/stdlib/test/rand_SUITE.erl b/lib/stdlib/test/rand_SUITE.erl index 1bcdc3ccd0..cb778c96d4 100644 --- a/lib/stdlib/test/rand_SUITE.erl +++ b/lib/stdlib/test/rand_SUITE.erl @@ -18,18 +18,13 @@ %% %CopyrightEnd% -module(rand_SUITE). --export([all/0, suite/0,groups/0, - init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, - init_per_testcase/2, end_per_testcase/2 - ]). +-export([all/0, suite/0,groups/0]). -export([interval_int/1, interval_float/1, seed/1, api_eq/1, reference/1, basic_stats_uniform_1/1, basic_stats_uniform_2/1, basic_stats_normal/1, - plugin/1, measure/1 - ]). + plugin/1, measure/1]). -export([test/0, gen/1]). @@ -37,12 +32,6 @@ -define(LOOP, 1000000). -init_per_testcase(_Case, Config) -> - Config. - -end_per_testcase(_Case, _Config) -> - ok. - suite() -> [{ct_hooks,[ts_install_cth]}, {timetrap,{minutes,3}}]. @@ -52,19 +41,12 @@ all() -> api_eq, reference, {group, basic_stats}, - plugin, measure - ]. + plugin, measure]. groups() -> [{basic_stats, [parallel], [basic_stats_uniform_1, basic_stats_uniform_2, basic_stats_normal]}]. -init_per_suite(Config) -> Config. -end_per_suite(_Config) -> ok. - -init_per_group(_GroupName, Config) -> Config. -end_per_group(_GroupName, Config) -> Config. - %% A simple helper to test without test_server during dev test() -> Tests = all(), @@ -285,16 +267,19 @@ gen(_, _, Acc) -> lists:reverse(Acc). %% Check that the algorithms generate sound values. basic_stats_uniform_1(Config) when is_list(Config) -> + ct:timetrap({minutes,6}), %% valgrind needs a lot of time [basic_uniform_1(?LOOP, rand:seed_s(Alg), 0.0, array:new([{default, 0}])) || Alg <- algs()], ok. basic_stats_uniform_2(Config) when is_list(Config) -> + ct:timetrap({minutes,6}), %% valgrind needs a lot of time [basic_uniform_2(?LOOP, rand:seed_s(Alg), 0, array:new([{default, 0}])) || Alg <- algs()], ok. basic_stats_normal(Config) when is_list(Config) -> + ct:timetrap({minutes,6}), %% valgrind needs a lot of time io:format("Testing normal~n",[]), [basic_normal_1(?LOOP, rand:seed_s(Alg), 0, 0) || Alg <- algs()], ok. @@ -395,6 +380,7 @@ crypto_uniform_n(N, State0) -> %% Not a test but measures the time characteristics of the different algorithms measure(Suite) when is_atom(Suite) -> []; measure(_Config) -> + ct:timetrap({minutes,6}), %% valgrind needs a lot of time Algos = [crypto64|algs()], io:format("RNG uniform integer performance~n",[]), _ = measure_1(random, fun(State) -> {int, random:uniform_s(10000, State)} end), diff --git a/lib/stdlib/test/select_SUITE.erl b/lib/stdlib/test/select_SUITE.erl index e999d040c9..22b6d37e5d 100644 --- a/lib/stdlib/test/select_SUITE.erl +++ b/lib/stdlib/test/select_SUITE.erl @@ -59,42 +59,20 @@ config(priv_dir,_) -> ".". -else. %% When run in test server. --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2,select_test/1, - init_per_testcase/2, end_per_testcase/2, - return_values/1]). - -init_per_testcase(_Case, Config) -> - Config. - -end_per_testcase(_Case, _Config) -> - ok. +-export([all/0, suite/0, + select_test/1, return_values/1]). suite() -> [{ct_hooks,[ts_install_cth]}, - {timetrap,{minutes,20}}]. + {timetrap,{minutes,1}}]. all() -> [return_values, select_test]. -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - %% Test select in numerous ways. select_test(Config) when is_list(Config) -> + ct:timetrap({minutes,40}), %% valgrinds needs a lot of time do_test(Config). %% Test return values in specific situations for select/3 and select/1. diff --git a/lib/stdlib/test/unicode_SUITE.erl b/lib/stdlib/test/unicode_SUITE.erl index 81a591f433..07d63bdf22 100644 --- a/lib/stdlib/test/unicode_SUITE.erl +++ b/lib/stdlib/test/unicode_SUITE.erl @@ -21,10 +21,7 @@ -include_lib("common_test/include/ct.hrl"). --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, - init_per_testcase/2, - end_per_testcase/2, +-export([all/0, suite/0,groups/0, utf8_illegal_sequences_bif/1, utf16_illegal_sequences_bif/1, random_lists/1, @@ -38,12 +35,6 @@ ex_binaries_errors_utf32_little/1, ex_binaries_errors_utf32_big/1]). -init_per_testcase(_Case, Config) -> - Config. - -end_per_testcase(_Case, _Config) -> - ok. - suite() -> [{ct_hooks,[ts_install_cth]}, {timetrap,{minutes,20}}]. @@ -63,18 +54,6 @@ groups() -> ex_binaries_errors_utf32_little, ex_binaries_errors_utf32_big]}]. -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - binaries_errors_limit(Config) when is_list(Config) -> setlimit(10), ex_binaries_errors_utf8(Config), @@ -761,6 +740,7 @@ leading_lo_surrogate_bif(HiSurr, LoSurr, End) when LoSurr =< End -> leading_lo_surrogate_bif(_, _, _) -> ok. utf8_illegal_sequences_bif(Config) when is_list(Config) -> + ct:timetrap({minutes,40}), %% valgrind needs a lot setlimit(10), ex_utf8_illegal_sequences_bif(Config), setlimit(default), -- cgit v1.2.3 From 9e9627dd573a14fe604ecd05185afc0640d3517b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Fri, 27 May 2016 19:09:21 +0200 Subject: stdlib: Fix small inconsistencies in ets_SUITE --- lib/stdlib/test/ets_SUITE.erl | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl index 57ee25bcf0..8c1c625676 100644 --- a/lib/stdlib/test/ets_SUITE.erl +++ b/lib/stdlib/test/ets_SUITE.erl @@ -698,7 +698,7 @@ chk_normal_tab_struct_size() -> io:format("?TAB_STRUCT_SZ=~p~n", [?TAB_STRUCT_SZ]), ok. -adjust_xmem([T1,T2,T3,T4], {A0,B0,C0,D0} = _Mem0) -> +adjust_xmem([_T1,_T2,_T3,_T4], {A0,B0,C0,D0} = _Mem0) -> %% Adjust for 64-bit, smp, and os: %% Table struct size may differ. @@ -2809,16 +2809,22 @@ privacy_do(Opts) -> privacy_check(pub,prot,priv), Owner ! {shift,1,{pub,prot,priv}}, - receive {Pub1,Prot1,Priv1} -> ok end, - privacy_check(Pub1,Prot1,Priv1), + receive + {Pub1,Prot1,Priv1} -> + ok = privacy_check(Pub1,Prot1,Priv1), + Owner ! {shift,2,{Pub1,Prot1,Priv1}} + end, - Owner ! {shift,2,{Pub1,Prot1,Priv1}}, - receive {Pub2,Prot2,Priv2} -> ok end, - privacy_check(Pub2,Prot2,Priv2), + receive + {Pub2,Prot2,Priv2} -> + ok = privacy_check(Pub2,Prot2,Priv2), + Owner ! {shift,0,{Pub2,Prot2,Priv2}} + end, - Owner ! {shift,0,{Pub2,Prot2,Priv2}}, - receive {Pub2,Prot2,Priv2} -> ok end, - privacy_check(Pub2,Prot2,Priv2), + receive + {Pub3,Prot3,Priv3} -> + ok = privacy_check(Pub3,Prot3,Priv3) + end, Owner ! die, receive {'EXIT',Owner,_} -> ok end, @@ -2836,7 +2842,8 @@ privacy_check(Pub,Prot,Priv) -> {'EXIT',{badarg,_}} = (catch ets:insert(Priv,{3,foo})), %% check that it really wasn't written, either - [] = ets:lookup(Prot,foo). + [] = ets:lookup(Prot,foo), + ok. privacy_owner(Boss, Opts) -> ets_new(pub, [public,named_table | Opts]), @@ -3197,7 +3204,6 @@ delete_large_named_table_1(Name, Flags, Data, Fix) -> true = ets:safe_fixtable(Tab, true), lists:foreach(fun({K,_}) -> ets:delete(Tab, K) end, Data) end, - Parent = self(), {Pid, MRef} = my_spawn_opt(fun() -> receive ets_new -> -- cgit v1.2.3