From 48c2e612e086680efddd48b0f7337345c4b4d1df Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Tue, 5 Sep 2017 16:54:08 +0200 Subject: ct: ts:run now abort the test run on compilation failure --- lib/common_test/test_server/ts_run.erl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/common_test/test_server/ts_run.erl b/lib/common_test/test_server/ts_run.erl index 82ae44ec06..e22fa8d196 100644 --- a/lib/common_test/test_server/ts_run.erl +++ b/lib/common_test/test_server/ts_run.erl @@ -96,6 +96,9 @@ ct_run_test(Dir, CommonTestArgs) -> case ct:run_test(CommonTestArgs) of {_,_,_} -> ok; + {error,{make_failed, _Modules} = Error} -> + io:format("ERROR: ~P\n", [Error,20]), + erlang:halt(123, [{flush,false}]); {error,Error} -> io:format("ERROR: ~P\n", [Error,20]); Other -> @@ -288,6 +291,10 @@ tricky_print_data(Port, Timeout) -> receive {Port, {exit_status, 0}} -> ok; + {Port, {exit_status, 123 = N}} -> + io:format(user, "Test run exited with status ~p," + "aborting rest of test~n", [N]), + erlang:halt(123, [{flush,false}]); {Port, {exit_status, N}} -> io:format(user, "Test run exited with status ~p~n", [N]) after 1 -> -- cgit v1.2.3 From 4cd39050980ad78ec60079b80a76aec5677b1a7f Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 6 Sep 2017 10:47:57 +0200 Subject: asn1: Fix test suite deprecated functions --- lib/asn1/test/asn1_SUITE.erl | 2 +- lib/asn1/test/testUniqueObjectSets.erl | 2 +- lib/asn1/test/test_modified_x420.erl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index c61cecca4c..b98a704e28 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -266,7 +266,7 @@ replace_path(PathA, PathB) -> true = code:add_patha(PathB). join(Rule, Opts) -> - string:join([atom_to_list(Rule)|lists:map(fun atom_to_list/1, Opts)], "_"). + lists:join("_", [atom_to_list(Rule)|lists:map(fun atom_to_list/1, Opts)]). %%------------------------------------------------------------------------------ %% Test cases diff --git a/lib/asn1/test/testUniqueObjectSets.erl b/lib/asn1/test/testUniqueObjectSets.erl index 476d190651..cabdb44a0c 100644 --- a/lib/asn1/test/testUniqueObjectSets.erl +++ b/lib/asn1/test/testUniqueObjectSets.erl @@ -60,7 +60,7 @@ main(CaseDir, Rule, Opts) -> Objs = [gen_obj(I) || {I,_,_} <- D1], DupObjs = [gen_dup_obj(I, T) || {I,T,_} <- D1], DupObjRefs0 = [gen_dup_obj_refs(I) || {I,_,_} <- D1], - DupObjRefs = string:join(DupObjRefs0, " |\n"), + DupObjRefs = lists:join(" |\n", DupObjRefs0), Asn1Spec = 'UniqueObjectSets', A = ["UniqueObjectSets DEFINITIONS AUTOMATIC TAGS ::=\n", "BEGIN\n\n", diff --git a/lib/asn1/test/test_modified_x420.erl b/lib/asn1/test/test_modified_x420.erl index 6cd9e0e33b..15f7c70978 100644 --- a/lib/asn1/test/test_modified_x420.erl +++ b/lib/asn1/test/test_modified_x420.erl @@ -38,7 +38,7 @@ read_pem(File) -> extract_base64(Binary) -> - extract_base64_lines(string:tokens(binary_to_list(Binary), "\n")). + extract_base64_lines(string:lexemes(binary_to_list(Binary), "\n")). extract_base64_lines(["-----BEGIN"++_ | Lines]) -> take_base64_lines(Lines, _Acc = []); -- cgit v1.2.3 From 373f6170e70953838d95f09f511d81abc1fec87c Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 6 Sep 2017 11:59:43 +0200 Subject: ts: Don't test apps that are not available --- lib/common_test/test_server/ts_lib.erl | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/common_test/test_server/ts_lib.erl b/lib/common_test/test_server/ts_lib.erl index a7be740c5c..ea039a2c2b 100644 --- a/lib/common_test/test_server/ts_lib.erl +++ b/lib/common_test/test_server/ts_lib.erl @@ -120,7 +120,8 @@ specs(Dir) -> [] end end, Specs), - sort_tests(MainSpecs). + + sort_tests(filter_tests(MainSpecs)). test_categories(Dir, App) -> Specs = filelib:wildcard(filename:join([filename:dirname(Dir), @@ -141,10 +142,29 @@ suites(Dir, App) -> "*_SUITE.erl"]), Suites=filelib:wildcard(Glob), [filename_to_atom(Name) || Name <- Suites]. - + filename_to_atom(Name) -> list_to_atom(filename:rootname(filename:basename(Name))). +%% Filter out tests of applications that are not accessible + +filter_tests(Tests) -> + lists:filter( + fun(Special) when Special == epmd; + Special == emulator; + Special == system -> + true; + (Test) -> + case application:load(filename_to_atom(Test)) of + {error, {already_loaded, _}} -> + true; + {error,_NoSuchApplication} -> + false; + _ -> + true + end + end, Tests). + %% Sorts a list of either log files directories or spec files. sort_tests(Tests) -> -- cgit v1.2.3 From bcfa4564df41ad5806a4848dcb3be31fbfea6a9e Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 7 Sep 2017 17:26:25 +0200 Subject: erts: Fix leaking of fds in iovec_SUITE --- erts/emulator/test/iovec_SUITE.erl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/erts/emulator/test/iovec_SUITE.erl b/erts/emulator/test/iovec_SUITE.erl index a5f605bfff..28df36d293 100644 --- a/erts/emulator/test/iovec_SUITE.erl +++ b/erts/emulator/test/iovec_SUITE.erl @@ -20,7 +20,7 @@ -module(iovec_SUITE). --export([all/0, suite/0]). +-export([all/0, suite/0, init_per_suite/1, end_per_suite/1]). -export([integer_lists/1, binary_lists/1, empty_lists/1, empty_binary_lists/1, mixed_lists/1, improper_lists/1, illegal_lists/1, cons_bomb/1, @@ -37,6 +37,13 @@ all() -> illegal_lists, improper_lists, cons_bomb, iolist_to_iovec_idempotence, iolist_to_iovec_correctness]. +init_per_suite(Config) -> + Config. + +end_per_suite(Config) -> + application:stop(os_mon), + Config. + integer_lists(Config) when is_list(Config) -> Variations = gen_variations([I || I <- lists:seq(1, 255)]), -- cgit v1.2.3