From e44da124e225d28d8600a2f48c79cab2ac86516b Mon Sep 17 00:00:00 2001 From: Alexander Shorin Date: Fri, 24 Jul 2015 05:31:45 +0300 Subject: [PATCH 1/3] Update Makefile - Sort make commands - Add make help and descriptions for the available commands - Remove related path to rebar --- Makefile | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 73f4484..754165e 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,46 @@ -REBAR?=./rebar +REBAR?=rebar +.PHONY: all +# target: all - Makes everything all: build +.PHONY: build +# target: build - Builds the project +build: + $(REBAR) compile + + +.PHONY: check +# target: check - Checks if project builds and passes all the tests +check: build eunit + + +.PHONY: clean +# target: clean - Removes build artifacts clean: $(REBAR) clean - rm -rf logs rm -f test/*.beam +.PHONY: distclean +# target: distclean - Removes all unversioned files distclean: clean git clean -fxd -build: - $(REBAR) compile - - +.PHONY: eunit +# target: eunit - Runs eunit test suite eunit: $(REBAR) eunit -check: build eunit +.PHONY: help +# target: help - Prints this help +help: + @egrep "^# target:" Makefile | sed -e 's/^# target: //g' | sort %.beam: %.erl erlc -o test/ $< - - -.PHONY: all clean distclean build eunit check From 8b3a848a7015f6887e304fc7f7644a2092b0545b Mon Sep 17 00:00:00 2001 From: Alexander Shorin Date: Fri, 24 Jul 2015 05:31:52 +0300 Subject: [PATCH 2/3] Integrate with Travis CI --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..99e6cb3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: erlang + +otp_release: + - 17.5 + - 17.4 + - 17.1 + - 17.0 + - R16B03-1 + - R14B04 + - R14B02 From fc1a80fe38cb7f1c19ba0b4d275f14fbf3b5251e Mon Sep 17 00:00:00 2001 From: Alexander Shorin Date: Fri, 24 Jul 2015 05:38:11 +0300 Subject: [PATCH 3/3] Increase timeout limit for randomized and comparison tests --- test/khash_test.erl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/khash_test.erl b/test/khash_test.erl index cab9820..d1bb9e2 100644 --- a/test/khash_test.erl +++ b/test/khash_test.erl @@ -7,6 +7,7 @@ -define(NUM_RAND_CYCLES, 10000). -define(NUM_CYCLES, 1000000). -define(NUM_KVS, 5000). +-define(TIMEOUT, 15). load_test_() -> { @@ -98,10 +99,10 @@ randomized_test_() -> {ok, Actions, ?NUM_RAND_CYCLES, {Dict, KHash}} end, fun(State) -> - { + {timeout, ?TIMEOUT, { "State matches dict implementation", ?_assert(run_randomized(State, true)) - } + }} end } }. @@ -115,7 +116,7 @@ compare_dict_test_() -> receive after 1000 -> ok end end, fun(ok) -> - [{ + [{timeout, ?TIMEOUT, { "Dict's fetch is slower than of khash", ?_test(begin {DTime, _} = timer:tc(fun() -> dict_fetch() end, []), @@ -124,8 +125,8 @@ compare_dict_test_() -> ?debugFmt("KHash: ~10b", [KTime]), ?assert(DTime > KTime) end) - }, - { + }}, + {timeout, ?TIMEOUT, { "Dict's store is slower than of khash", ?_test(begin {DTime, _} = timer:tc(fun() -> dict_store() end, []), @@ -134,7 +135,7 @@ compare_dict_test_() -> ?debugFmt("KHash: ~10b", [KTime]), ?assert(DTime > KTime) end) - }] + }}] end } }.