Browse Source

Use a separate rebar.config file for running tests

Loïc Hoguin 13 years ago
parent
commit
4b27d3ec43
3 changed files with 31 additions and 18 deletions
  1. 24 12
      Makefile
  2. 0 6
      rebar.config
  3. 7 0
      rebar.tests.config

+ 24 - 12
Makefile

@@ -1,41 +1,53 @@
 # See LICENSE for licensing information.
 # See LICENSE for licensing information.
 
 
+PROJECT = cowboy
+
 DIALYZER = dialyzer
 DIALYZER = dialyzer
 REBAR = rebar
 REBAR = rebar
 
 
 all: app
 all: app
 
 
-app: deps
-	@$(REBAR) compile
+# Application.
 
 
 deps:
 deps:
 	@$(REBAR) get-deps
 	@$(REBAR) get-deps
 
 
+app: deps
+	@$(REBAR) compile
+
+docs:
+	@$(REBAR) doc skip_deps=true
+
 clean:
 clean:
 	@$(REBAR) clean
 	@$(REBAR) clean
 	rm -f test/*.beam
 	rm -f test/*.beam
 	rm -f erl_crash.dump
 	rm -f erl_crash.dump
 
 
-tests: clean app eunit ct
+# Tests.
+
+deps/proper:
+	@$(REBAR) -C rebar.tests.config get-deps
+	cd deps/proper && $(REBAR) compile
 
 
-inttests: clean app eunit intct
+tests: clean deps/proper app eunit ct
+
+inttests: clean deps/proper app eunit intct
 
 
 eunit:
 eunit:
-	@$(REBAR) eunit skip_deps=true
+	@$(REBAR) -C rebar.tests.config eunit skip_deps=true
 
 
 ct:
 ct:
-	@$(REBAR) ct skip_deps=true suites=http,proper,ws
+	@$(REBAR) -C rebar.tests.config ct skip_deps=true suites=http,proper,ws
 
 
 intct:
 intct:
-	@$(REBAR) ct skip_deps=true suites=http,proper,ws,autobahn
+	@$(REBAR) -C rebar.tests.config ct skip_deps=true suites=http,proper,ws,autobahn
+
+# Dialyzer.
 
 
 build-plt:
 build-plt:
-	@$(DIALYZER) --build_plt --output_plt .cowboy_dialyzer.plt \
+	@$(DIALYZER) --build_plt --output_plt .$(PROJECT).plt \
 		--apps kernel stdlib sasl inets crypto public_key ssl
 		--apps kernel stdlib sasl inets crypto public_key ssl
 
 
 dialyze:
 dialyze:
-	@$(DIALYZER) --src src --plt .cowboy_dialyzer.plt --no_native \
+	@$(DIALYZER) --src src --plt .$(PROJECT).plt --no_native \
 		-Werror_handling -Wrace_conditions -Wunmatched_returns # -Wunderspecs
 		-Werror_handling -Wrace_conditions -Wunmatched_returns # -Wunderspecs
-
-docs:
-	@$(REBAR) doc skip_deps=true

+ 0 - 6
rebar.config

@@ -1,9 +1,3 @@
-{cover_enabled, true}.
-{deps, [
-	{proper, "1.0",
-		{git, "git://github.com/manopapad/proper.git", {tag, "v1.0"}}}
-]}.
-{eunit_opts, [verbose, {report, {eunit_surefire, [{dir, "."}]}}]}.
 {erl_opts, [
 {erl_opts, [
 %%	bin_opt_info,
 %%	bin_opt_info,
 %%	warn_missing_spec,
 %%	warn_missing_spec,

+ 7 - 0
rebar.tests.config

@@ -0,0 +1,7 @@
+{cover_enabled, true}.
+{deps, [
+	{proper, "1.0",
+		{git, "git://github.com/manopapad/proper.git", {tag, "v1.0"}}}
+]}.
+{eunit_opts, [verbose, {report, {eunit_surefire, [{dir, "."}]}}]}.
+{erl_opts, []}.