From 5e9de936e28f18bf5ba3e392fcc54502505b01a8 Mon Sep 17 00:00:00 2001 From: Ivan Glushkov Date: Mon, 20 May 2019 11:21:34 +0400 Subject: Revert dependencies order in unit tests The PR https://github.com/erlware/relx/pull/655 changed the behaviour, while the tests were not fixed. This commit fixes the unit tests. --- .cirrus.yml | 4 +- .gitignore | 2 + src/rlx_depsolver.erl | 2 +- src/rlx_depsolver_culprit.erl | 2 +- test/rlx_depsolver_tester.erl | 500 ++++++++++++++++++++++-------------------- test/rlx_depsolver_tests.erl | 2 +- 6 files changed, 268 insertions(+), 244 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index b49a2b6..8e693dd 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -8,7 +8,7 @@ test_task: - image: erlang:19 - image: erlang:18 test_script: | - rebar3 ct + rebar3 eunit && rebar3 ct always: junit_artifacts: path: "_build/test/logs/ct_run.*/junit_report.xml" @@ -20,4 +20,4 @@ osx_check_task: test_script: | wget https://s3.amazonaws.com/rebar3/rebar3 chmod +x rebar3 - ./rebar3 ct + ./rebar3 eunit && ./rebar3 ct diff --git a/.gitignore b/.gitignore index ce87711..64d4e0b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ _rel/* !.cirrus.yml erl_crash.dump rebar +TEST-* +tags diff --git a/src/rlx_depsolver.erl b/src/rlx_depsolver.erl index 8a0f632..08b81a3 100644 --- a/src/rlx_depsolver.erl +++ b/src/rlx_depsolver.erl @@ -1,5 +1,5 @@ %% -*- erlang-indent-level: 4; indent-tabs-mode: nil; fill-column: 80 -*- -%% ex: ts=4 sx=4 et +%% ex: ts=4 sw=4 et %% %% Copyright 2012 Opscode, Inc. All Rights Reserved. %% diff --git a/src/rlx_depsolver_culprit.erl b/src/rlx_depsolver_culprit.erl index cf6dcb2..6368d24 100644 --- a/src/rlx_depsolver_culprit.erl +++ b/src/rlx_depsolver_culprit.erl @@ -1,5 +1,5 @@ %% -*- erlang-indent-level: 4; indent-tabs-mode: nil; fill-column: 80 -*- -%% ex: ts=4 sx=4 et +%% ex: ts=4 sw=4 et %% %% @author Eric Merritt %% diff --git a/test/rlx_depsolver_tester.erl b/test/rlx_depsolver_tester.erl index 9defd91..b3bc146 100644 --- a/test/rlx_depsolver_tester.erl +++ b/test/rlx_depsolver_tester.erl @@ -1,5 +1,5 @@ %% -*- erlang-indent-level: 4; indent-tabs-mode: nil; fill-column: 92 -*- -%% ex: ts=4 sx=4 et +%% ex: ts=4 sw=4 et %%------------------------------------------------------------------- %% %% Copyright 2012 Opscode, Inc. All Rights Reserved. @@ -49,153 +49,167 @@ run_log(FileName) -> run_log_file(Device). data1_test() -> - ExpectedResult = versionify([{"app6","0.0.1"}, - {"dep_pkg13","0.0.2"}, - {"app13","0.0.1"}, - {"dep_pkg2","0.0.5"}, - {"dep_pkg1","0.0.2"}, + ExpectedResult = versionify([ + {"app9","0.0.1"}, {"dep_pkg7","0.1.2"}, - {"app9","0.0.1"}]), + {"dep_pkg1","0.0.2"}, + {"dep_pkg2","0.0.5"}, + {"app13","0.0.1"}, + {"dep_pkg13","0.0.2"}, + {"app6","0.0.1"} + ]), ?assertMatch({ok, ExpectedResult}, run_data(fix_rebar_brokenness("data1.txt"))). data2_test() -> - ExpectedResult = versionify([{"app18","0.0.1"}, - {"app4","0.0.7"}, - {"app1","0.0.1"}, - {"app6","0.0.1"}, - {"dep_pkg13","0.0.2"}, - {"app13","0.0.1"}, - {"dep_pkg5","0.0.3"}, - {"dep_pkg1","0.0.2"}, - {"dep_pkg2","0.0.5"}, - {"dep_pkg7","0.1.2"}, + ExpectedResult = versionify([ + {"dep_pkg16","1.0.2"}, {"app9","0.0.1"}, - {"dep_pkg16","1.0.2"}]), + {"dep_pkg7","0.1.2"}, + {"dep_pkg2","0.0.5"}, + {"dep_pkg1","0.0.2"}, + {"dep_pkg5","0.0.3"}, + {"app13","0.0.1"}, + {"dep_pkg13","0.0.2"}, + {"app6","0.0.1"}, + {"app1","0.0.1"}, + {"app4","0.0.7"}, + {"app18","0.0.1"} + ]), ?assertMatch({ok, ExpectedResult}, run_data(fix_rebar_brokenness("data2.txt"))). - + data3_test() -> - ExpectedResult = versionify([{"app68","0.0.1"}, - {"app58","0.0.1"}, - {"app48","0.0.7"}, - {"app38","0.0.1"}, - {"app28","0.0.1"}, - {"app18","0.0.1"}, - {"app4","0.0.7"}, - {"app1","0.0.1"}, - {"app6","0.0.1"}, - {"dep_pkg13","0.0.2"}, - {"app13","0.0.1"}, - {"dep_pkg5","0.0.3"}, - {"dep_pkg1","0.0.2"}, - {"dep_pkg2","0.0.5"}, - {"dep_pkg7","0.1.2"}, + ExpectedResult = versionify([ + {"dep_pkg16","1.0.2"}, {"app9","0.0.1"}, - {"dep_pkg16","1.0.2"}]), + {"dep_pkg7","0.1.2"}, + {"dep_pkg2","0.0.5"}, + {"dep_pkg1","0.0.2"}, + {"dep_pkg5","0.0.3"}, + {"app13","0.0.1"}, + {"dep_pkg13","0.0.2"}, + {"app6","0.0.1"}, + {"app1","0.0.1"}, + {"app4","0.0.7"}, + {"app18","0.0.1"}, + {"app28","0.0.1"}, + {"app38","0.0.1"}, + {"app48","0.0.7"}, + {"app58","0.0.1"}, + {"app68","0.0.1"} + ]), ?assertMatch({ok,ExpectedResult}, run_data(fix_rebar_brokenness("data3.txt"))). data4_test() -> - ExpectedResult = versionify([{"dep_pkg20","0.0.2"}, - {"app78","0.0.1"}, - {"app68","0.0.1"}, - {"app58","0.0.1"}, - {"app48","0.0.7"}, - {"app38","0.0.1"}, - {"app28","0.0.1"}, - {"app18","0.0.1"}, - {"app4","0.0.7"}, - {"app1","0.0.1"}, - {"app6","0.0.1"}, - {"dep_pkg13","0.0.2"}, - {"app13","0.0.1"}, - {"dep_pkg5","0.0.3"}, - {"dep_pkg1","0.0.2"}, - {"dep_pkg2","0.0.5"}, - {"dep_pkg7","0.1.2"}, + ExpectedResult = versionify([ + {"dep_pkg16","1.0.2"}, {"app9","0.0.1"}, - {"dep_pkg16","1.0.2"}]), + {"dep_pkg7","0.1.2"}, + {"dep_pkg2","0.0.5"}, + {"dep_pkg1","0.0.2"}, + {"dep_pkg5","0.0.3"}, + {"app13","0.0.1"}, + {"dep_pkg13","0.0.2"}, + {"app6","0.0.1"}, + {"app1","0.0.1"}, + {"app4","0.0.7"}, + {"app18","0.0.1"}, + {"app28","0.0.1"}, + {"app38","0.0.1"}, + {"app48","0.0.7"}, + {"app58","0.0.1"}, + {"app68","0.0.1"}, + {"app78","0.0.1"}, + {"dep_pkg20","0.0.2"} + ]), ?assertMatch({ok, ExpectedResult}, run_data(fix_rebar_brokenness("data4.txt"))). data5_test() -> - ExpectedResult = versionify([{"dep_pkg14","0.0.2"}, - {"dep_pkg22","0.0.2"}, - {"dep_pkg20","0.0.2"}, - {"app78","0.0.1"}, - {"app68","0.0.1"}, - {"app58","0.0.1"}, - {"app48","0.0.7"}, - {"app38","0.0.1"}, - {"app28","0.0.1"}, - {"app18","0.0.1"}, - {"app4","0.0.7"}, - {"app1","0.0.1"}, - {"app6","0.0.1"}, - {"dep_pkg13","0.0.2"}, - {"app13","0.0.1"}, - {"dep_pkg5","0.0.3"}, - {"dep_pkg1","0.0.2"}, - {"dep_pkg2","0.0.5"}, - {"dep_pkg7","0.1.2"}, + ExpectedResult = versionify([ + {"dep_pkg16","1.0.2"}, {"app9","0.0.1"}, - {"dep_pkg16","1.0.2"}]), + {"dep_pkg7","0.1.2"}, + {"dep_pkg2","0.0.5"}, + {"dep_pkg1","0.0.2"}, + {"dep_pkg5","0.0.3"}, + {"app13","0.0.1"}, + {"dep_pkg13","0.0.2"}, + {"app6","0.0.1"}, + {"app1","0.0.1"}, + {"app4","0.0.7"}, + {"app18","0.0.1"}, + {"app28","0.0.1"}, + {"app38","0.0.1"}, + {"app48","0.0.7"}, + {"app58","0.0.1"}, + {"app68","0.0.1"}, + {"app78","0.0.1"}, + {"dep_pkg20","0.0.2"}, + {"dep_pkg22","0.0.2"}, + {"dep_pkg14","0.0.2"} + ]), ?assertMatch({ok, ExpectedResult}, run_data(fix_rebar_brokenness("data5.txt"))). data6_test() -> - ExpectedResult = versionify([{"app108","0.0.1"}, - {"app98","0.0.1"}, - {"app88","0.0.1"}, - {"dep_pkg14","0.0.2"}, - {"dep_pkg22","0.0.2"}, - {"dep_pkg20","0.0.2"}, - {"app78","0.0.1"}, - {"app68","0.0.1"}, - {"app58","0.0.1"}, - {"app48","0.0.7"}, - {"app38","0.0.1"}, - {"app28","0.0.1"}, - {"app18","0.0.1"}, - {"app4","0.0.7"}, - {"app1","0.0.1"}, - {"app6","0.0.1"}, - {"dep_pkg13","0.0.2"}, - {"app13","0.0.1"}, - {"dep_pkg5","0.0.3"}, - {"dep_pkg1","0.0.2"}, - {"dep_pkg2","0.0.5"}, - {"dep_pkg7","0.1.2"}, + ExpectedResult = versionify([ + {"dep_pkg16","1.0.2"}, {"app9","0.0.1"}, - {"dep_pkg16","1.0.2"}]), + {"dep_pkg7","0.1.2"}, + {"dep_pkg2","0.0.5"}, + {"dep_pkg1","0.0.2"}, + {"dep_pkg5","0.0.3"}, + {"app13","0.0.1"}, + {"dep_pkg13","0.0.2"}, + {"app6","0.0.1"}, + {"app1","0.0.1"}, + {"app4","0.0.7"}, + {"app18","0.0.1"}, + {"app28","0.0.1"}, + {"app38","0.0.1"}, + {"app48","0.0.7"}, + {"app58","0.0.1"}, + {"app68","0.0.1"}, + {"app78","0.0.1"}, + {"dep_pkg20","0.0.2"}, + {"dep_pkg22","0.0.2"}, + {"dep_pkg14","0.0.2"}, + {"app88","0.0.1"}, + {"app98","0.0.1"}, + {"app108","0.0.1"} + ]), ?assertMatch({ok, ExpectedResult}, run_data(fix_rebar_brokenness("data6.txt"))). log_07be9e47_test() -> Data = run_log(fix_rebar_brokenness("log-07be9e47-6f42-4a5d-b8b5-1d2eae1ad83b.txt")), - ExpectedResult = versionify([{"0","0"}, - {"1","0"}, - {"3","0"}, - {"4","0"}, - {"5","0"}, - {"6","0"}, - {"7","0"}, - {"8","0"}, - {"9","0"}, - {"10","0"}, - {"11","0"}, - {"12","0"}, - {"13","0"}, - {"14","0"}, - {"15","0"}, - {"16","0"}, - {"18","0"}, - {"19","0"}, - {"21","0"}, - {"22","0"}, - {"23","0"}, + ExpectedResult = versionify([ + {"25","0"}, {"24","0"}, - {"25","0"}]), + {"23","0"}, + {"22","0"}, + {"21","0"}, + {"19","0"}, + {"18","0"}, + {"16","0"}, + {"15","0"}, + {"14","0"}, + {"13","0"}, + {"12","0"}, + {"11","0"}, + {"10","0"}, + {"9","0"}, + {"8","0"}, + {"7","0"}, + {"6","0"}, + {"5","0"}, + {"4","0"}, + {"3","0"}, + {"1","0"}, + {"0","0"} + ]), ?assertMatch({ok, ExpectedResult}, Data). @@ -206,144 +220,152 @@ log_183998c1_test() -> log_311a15e7_test() -> {ok, Data} = run_log(fix_rebar_brokenness("log-311a15e7-3378-4c5b-beb7-86a1b9cf0ea9.txt")), - ExpectedResult = lists:sort(versionify([{"45", "22"}, - {"40","1"}, - {"3","5"}, - {"9","0"}, - {"8","0"}, - {"7","0"}, - {"6","2"}, - {"1","5"}, - {"0","2"}, - {"61","1"}, - {"60","0"}, - {"35","4"}, - {"39","0"}, - {"38","2"}, - {"37","2"}, - {"36","3"}, - {"32","24"}, - {"30","0"}, - {"19","1"}, - {"18","0"}, - {"17","2"}, - {"16","0"}, - {"15","0"}, - {"14","1"}, - {"13","0"}, - {"12","1"}, - {"11","0"}, - {"10","1"}, - {"59","0"}, - {"58","1"}, - {"57","0"}, - {"56","0"}, - {"55","4"}, - {"29","2"}, - {"27","2"}, - {"26","0"}, - {"25","5"}, - {"24","3"}, - {"23","1"}, - {"22","3"}, + ExpectedResult = lists:sort(versionify([ + {"20","0"}, {"21","2"}, - {"20","0"}])), + {"22","3"}, + {"23","1"}, + {"24","3"}, + {"25","5"}, + {"26","0"}, + {"27","2"}, + {"29","2"}, + {"55","4"}, + {"56","0"}, + {"57","0"}, + {"58","1"}, + {"59","0"}, + {"10","1"}, + {"11","0"}, + {"12","1"}, + {"13","0"}, + {"14","1"}, + {"15","0"}, + {"16","0"}, + {"17","2"}, + {"18","0"}, + {"19","1"}, + {"30","0"}, + {"32","24"}, + {"36","3"}, + {"37","2"}, + {"38","2"}, + {"39","0"}, + {"35","4"}, + {"60","0"}, + {"61","1"}, + {"0","2"}, + {"1","5"}, + {"6","2"}, + {"7","0"}, + {"8","0"}, + {"9","0"}, + {"3","5"}, + {"40","1"}, + {"45", "22"} + ])), ?assertMatch(ExpectedResult, lists:sort(Data)). log_382cfe5b_test() -> {ok, Data} = run_log(fix_rebar_brokenness("log-382cfe5b-0ac2-48b8-83d1-717cb4620990.txt")), - ExpectedResult = lists:sort(versionify([{"18","0"}, - {"17","0"}, - {"15","1"}, - {"14","0"}, - {"10","0"}, - {"7","0"}, - {"6","0"}, - {"5","0"}, - {"4","0"}, - {"3","0"}, - {"2","1"}, + ExpectedResult = lists:sort(versionify([ + {"0","0"}, {"1","0"}, - {"0","0"}])), + {"2","1"}, + {"3","0"}, + {"4","0"}, + {"5","0"}, + {"6","0"}, + {"7","0"}, + {"10","0"}, + {"14","0"}, + {"15","1"}, + {"17","0"}, + {"18","0"} + ])), ?assertMatch(ExpectedResult, lists:sort(Data)). log_d3564ef6_test() -> {ok, Data} = run_log(fix_rebar_brokenness("log-d3564ef6-6437-41e7-90b6-dbdb849551a6_mod.txt")), - ExpectedResult = lists:sort(versionify([{"57","5"}, - {"56","3"}, - {"55","4"}, - {"54","0"}, - {"53","1"}, - {"82","0"}, - {"81","0"}, - {"80","1"}, - {"29","0"}, - {"28","5"}, - {"27","3"}, - {"26","1"}, - {"25","3"}, - {"24","2"}, - {"23","0"}, - {"22","1"}, - {"21","0"}, - {"20","2"}, - {"75","32"}, - {"79","2"}, - {"78","4"}, - {"74","7"}, - {"73","11"}, - {"72","0"}, - {"70","1"}, - {"47","4"}, - {"45","1"}, - {"44","1"}, - {"43","7"}, - {"42","1"}, - {"41","2"}, - {"40","2"}, - {"19","0"}, - {"18","0"}, - {"17","1"}, - {"16","0"}, - {"15","1"}, - {"14","0"}, - {"13","1"}, - {"12","0"}, - {"11","0"}, - {"10","0"}, - {"9","2"}, - {"4","5"}, - {"3","2"}, - {"0","3"}, - {"69","0"}, - {"68","1"}, - {"67","7"}, - {"39","3"}, - {"35","24"}, - {"33","0"}, + ExpectedResult = lists:sort(versionify([ + {"30","2"}, {"32","2"}, - {"30","2"}])), + {"33","0"}, + {"35","24"}, + {"39","3"}, + {"67","7"}, + {"68","1"}, + {"69","0"}, + {"0","3"}, + {"3","2"}, + {"4","5"}, + {"9","2"}, + {"10","0"}, + {"11","0"}, + {"12","0"}, + {"13","1"}, + {"14","0"}, + {"15","1"}, + {"16","0"}, + {"17","1"}, + {"18","0"}, + {"19","0"}, + {"40","2"}, + {"41","2"}, + {"42","1"}, + {"43","7"}, + {"44","1"}, + {"45","1"}, + {"47","4"}, + {"70","1"}, + {"72","0"}, + {"73","11"}, + {"74","7"}, + {"78","4"}, + {"79","2"}, + {"75","32"}, + {"20","2"}, + {"21","0"}, + {"22","1"}, + {"23","0"}, + {"24","2"}, + {"25","3"}, + {"26","1"}, + {"27","3"}, + {"28","5"}, + {"29","0"}, + {"80","1"}, + {"81","0"}, + {"82","0"}, + {"53","1"}, + {"54","0"}, + {"55","4"}, + {"56","3"}, + {"57","5"} + ])), ?assertMatch(ExpectedResult, lists:sort(Data)). log_ea2d264b_test() -> {ok, Data} = run_log(fix_rebar_brokenness("log-ea2d264b-003e-4611-94ed-14efc7732083.txt")), - ExpectedResult = lists:sort(versionify([{"18","1"}, - {"17","0"}, - {"16","0"}, - {"15","0"}, - {"14","0"}, - {"13","1"}, - {"10","1"}, - {"9","1"}, - {"8","2"}, - {"6","0"}, - {"5","0"}, - {"4","0"}, - {"3","0"}, - {"2","0"}, + ExpectedResult = lists:sort(versionify([ + {"0","1"}, {"1","0"}, - {"0","1"}])), + {"2","0"}, + {"3","0"}, + {"4","0"}, + {"5","0"}, + {"6","0"}, + {"8","2"}, + {"9","1"}, + {"10","1"}, + {"13","1"}, + {"14","0"}, + {"15","0"}, + {"16","0"}, + {"17","0"}, + {"18","1"} + ])), ?assertMatch(ExpectedResult, lists:sort(Data)). %%============================================================================ diff --git a/test/rlx_depsolver_tests.erl b/test/rlx_depsolver_tests.erl index 206bad4..b1c8228 100644 --- a/test/rlx_depsolver_tests.erl +++ b/test/rlx_depsolver_tests.erl @@ -1,5 +1,5 @@ %% -*- erlang-indent-level: 4; indent-tabs-mode: nil; fill-column: 80 -*- -%% ex: ts=4 sx=4 et +%% ex: ts=4 sw=4 et %% %%------------------------------------------------------------------- %% Copyright 2012 Opscode, Inc. All Rights Reserved. -- cgit v1.2.3