From 7054ccc393c8e4056ee7129cc698996f1323ea8c Mon Sep 17 00:00:00 2001 From: Antonio Nikishaev Date: Mon, 13 May 2019 17:52:03 +0400 Subject: [PATCH 1/6] travis --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..3bd35b093 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: erlang +otp_release: + - 20.3.8 +script: + - ./rebar3 as test compile + - make test From 45ce0643538bc5f10091167c7f79a97765d28262 Mon Sep 17 00:00:00 2001 From: Antonio Nikishaev Date: Tue, 14 May 2019 16:55:11 +0400 Subject: [PATCH 2/6] only run riak eunit tests for now --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3bd35b093..9bebf308b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,8 @@ language: erlang otp_release: - 20.3.8 script: - - ./rebar3 as test compile - - make test + - ./rebar3 eunit + + ## for deps tests: + # - ./rebar3 as test compile + # - make test From b1e7c74ea0aa18219367bbd5101c43727d0a0809 Mon Sep 17 00:00:00 2001 From: Antonio Nikishaev Date: Mon, 20 May 2019 09:01:07 +0400 Subject: [PATCH 3/6] =?UTF-8?q?make=20more=20of=20=E2=80=98make=20deptest?= =?UTF-8?q?=E2=80=99=20work?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 11 +++++------ misc/deptest.escript | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 misc/deptest.escript diff --git a/Makefile b/Makefile index 0747cd5f1..b71245040 100644 --- a/Makefile +++ b/Makefile @@ -47,17 +47,16 @@ TEST_LOG_FILE := eunit.log testclean: @rm -f $(TEST_LOG_FILE) -TMP_CONFIG=rebar.config.tmp +TMP_CONFIG=rebar.config.deptest # Tricking rebar3 to use the dependencies from the top-level _build directory. testdep-% : @echo "--- Running EUnit tests for $* ---" @rm -rf _build/deptest+test _build/deptest - @(cd $(TEST_DEPS_DIR)/$* && \ - cp rebar.config $(TMP_CONFIG) && \ - echo "" >> $(TMP_CONFIG) && \ - echo '{profiles, [{deptest, [{base_dir, "../../.."}]}]}.' >> $(TMP_CONFIG) && \ - REBAR_CONFIG=$(TMP_CONFIG) $(REBAR) as deptest eunit) || echo "Eunit: $* FAILED" >> $(TEST_LOG_FILE) + @(cd $(TEST_DEPS_DIR)/$* \ + && escript ../../../../misc/deptest.escript rebar.config $(TMP_CONFIG) \ + && REBAR_CONFIG=$(TMP_CONFIG) $(REBAR) as deptest eunit) \ + || echo "Eunit: $* FAILED" >> $(TEST_LOG_FILE) @(cd $(TEST_DEPS_DIR)/$* && rm -f $(TMP_CONFIG)) test-deps : deps compile testclean $(patsubst %, testdep-%, $(TEST_DEPS)) diff --git a/misc/deptest.escript b/misc/deptest.escript new file mode 100644 index 000000000..834e42901 --- /dev/null +++ b/misc/deptest.escript @@ -0,0 +1,24 @@ +#!/usr/bin/env escript + +%% A hack for running dependencies test, see Makefile#deptest + +main([FileIn,FileOut]) -> + {ok,Conf0} = file:consult(FileIn), + Conf = lists:ukeymerge(1, lists:keysort(1,Conf0), [{profiles,[]}]), + [Profiles] = [ P || {profiles,P} <- Conf ], + + %% if no test profile, add an empty one + ProfilesT = lists:ukeymerge(1, lists:keysort(1,Profiles), [{test,[]}]), + + NewProfiles + = [ case P of + %% rename test → deptest; add base_dir + {test,Spec} -> {deptest, [{base_dir,"../../.."} | Spec]}; + X -> X + end + || P <- ProfilesT ], + + NewConf = lists:keyreplace(profiles, 1, Conf, {profiles,NewProfiles}), + file:write_file(FileOut, [io_lib:format("~tp.~n", [X]) || X <- NewConf]). + + From 343aa88483a65bd65eb1df152155a3a99106c132 Mon Sep 17 00:00:00 2001 From: Antonio Nikishaev Date: Mon, 20 May 2019 10:17:12 +0400 Subject: [PATCH 4/6] .travis: sudo=true --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9bebf308b..c74b23852 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: erlang +sudo: true otp_release: - 20.3.8 script: From e1283c863dfd9162ffc986fbc52aa53d1cf3cafa Mon Sep 17 00:00:00 2001 From: Antonio Nikishaev Date: Mon, 20 May 2019 11:34:59 +0400 Subject: [PATCH 5/6] make deptest for deps without rebar.config --- misc/deptest.escript | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/misc/deptest.escript b/misc/deptest.escript index 834e42901..c75056e0a 100644 --- a/misc/deptest.escript +++ b/misc/deptest.escript @@ -3,7 +3,10 @@ %% A hack for running dependencies test, see Makefile#deptest main([FileIn,FileOut]) -> - {ok,Conf0} = file:consult(FileIn), + Conf0 = case file:consult(FileIn) of + {ok,C} -> C; + _ -> [] % no rebar.config! amazing + end, Conf = lists:ukeymerge(1, lists:keysort(1,Conf0), [{profiles,[]}]), [Profiles] = [ P || {profiles,P} <- Conf ], From a3d8f49816b1827ad162c90dd6dfb451d4ffe680 Mon Sep 17 00:00:00 2001 From: Antonio Nikishaev Date: Tue, 21 May 2019 20:49:33 +0400 Subject: [PATCH 6/6] more deps test fixes --- Makefile | 21 +++++++++++++++------ misc/deptest.escript | 12 +++++++----- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index b71245040..d4ed58ba8 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,10 @@ REBAR ?= $(BASE_DIR)/rebar3 OVERLAY_VARS ?= TEST_IGNORE ?= TEST_DEPS_DIR ?= _build/test/lib +DEPS_DIR ?= _build/default/lib REL_DIR ?= _build/default/rel -DEPS = $(patsubst $(TEST_DEPS_DIR)/%, %, $(wildcard $(TEST_DEPS_DIR)/*)) -TEST_DEPS = $(filter-out $(TEST_IGNORE), $(DEPS)) +DEPS = $(patsubst $(DEPS_DIR)/%, %, $(wildcard $(DEPS_DIR)/*)) +TEST_DEPS = $(filter-out $(TEST_IGNORE), $(DEPS)) RIAK_CORE_STAT_PREFIX = riak export RIAK_CORE_STAT_PREFIX @@ -49,21 +50,29 @@ testclean: TMP_CONFIG=rebar.config.deptest +TEST_IGNORE += riak + # Tricking rebar3 to use the dependencies from the top-level _build directory. testdep-% : @echo "--- Running EUnit tests for $* ---" - @rm -rf _build/deptest+test _build/deptest + @rm -rf _build/deptest+test @(cd $(TEST_DEPS_DIR)/$* \ && escript ../../../../misc/deptest.escript rebar.config $(TMP_CONFIG) \ && REBAR_CONFIG=$(TMP_CONFIG) $(REBAR) as deptest eunit) \ || echo "Eunit: $* FAILED" >> $(TEST_LOG_FILE) @(cd $(TEST_DEPS_DIR)/$* && rm -f $(TMP_CONFIG)) -test-deps : deps compile testclean $(patsubst %, testdep-%, $(TEST_DEPS)) +TEST_DEPS_RULES = $(patsubst %, testdep-%, $(TEST_DEPS)) -# Test each dependency individually in its own VM -test : test-deps + +test-deps : deps compile testclean $(TEST_DEPS_RULES) + +test-riak: $(REBAR) eunit + + +# Test each dependency individually in its own VM +test : test-riak test-deps @if test -s $(TEST_LOG_FILE) ; then \ cat $(TEST_LOG_FILE) && \ exit `wc -l < $(TEST_LOG_FILE)`; \ diff --git a/misc/deptest.escript b/misc/deptest.escript index c75056e0a..0e67e2e0c 100644 --- a/misc/deptest.escript +++ b/misc/deptest.escript @@ -1,12 +1,14 @@ #!/usr/bin/env escript -%% A hack for running dependencies test, see Makefile#deptest +%% A hack for running dependencies test, see Makefile#deptest. Adds riak’s _build as +%% a base_dir to the test profile, renames test profile to deptest +%% E. g. FileIn=rebar.config, FileOut=rebar.config.deptest main([FileIn,FileOut]) -> - Conf0 = case file:consult(FileIn) of - {ok,C} -> C; - _ -> [] % no rebar.config! amazing - end, + case file:consult(FileIn) of + {ok,Conf0} -> ok; + _ -> Conf0=[] % no rebar.config! amazing + end, Conf = lists:ukeymerge(1, lists:keysort(1,Conf0), [{profiles,[]}]), [Profiles] = [ P || {profiles,P} <- Conf ],