Browse Source

Add tests for git, hg, svn fetch methods

Renamed dep-full to fetch-git to avoid having duplicate tests.
Loïc Hoguin 9 years ago
parent
commit
43c4414f29
1 changed files with 87 additions and 21 deletions
  1. 87 21
      test/core_deps.mk

+ 87 - 21
test/core_deps.mk

@@ -1,6 +1,6 @@
 # Core: Packages and dependencies.
 
-CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js dep-commit dep-full doc otp pkg rel search shell test
+CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js dep-commit doc fetch-git fetch-hg fetch-svn otp pkg rel search shell test
 CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES))
 CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS))
 
@@ -160,7 +160,47 @@ endif
 		{ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
 		halt()"
 
-core-deps-dep-full: build clean-core-deps-dep-full
+core-deps-doc: build clean-core-deps-doc
+
+	$i "Bootstrap a new OTP library named $(APP)"
+	$t mkdir $(APP)/
+	$t cp ../erlang.mk $(APP)/
+	$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+	$i "Generate .erl files"
+	$t echo "-module(boy)." > $(APP)/src/boy.erl
+	$t echo "-module(girl)." > $(APP)/src/girl.erl
+
+	$i "Add Edown as a documentation building dependency"
+	$t sed -i.bak '2i\
+DOC_DEPS = edown\
+EDOC_OPTS = {doclet, edown_doclet}\
+' $(APP)/Makefile
+
+	$i "Build the application"
+	$t $(MAKE) -C $(APP) $v
+
+	$i "Check that no dependencies were fetched"
+	$t test ! -e $(APP)/deps
+
+	$i "Check that the application was compiled correctly"
+	$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
+		[ok = application:load(App) || App <- [$(APP)]], \
+		{ok, Deps} = application:get_key($(APP), applications), \
+		false = lists:member(edown, Deps), \
+		halt()"
+
+	$i "Build the application documentation"
+	$t $(MAKE) -C $(APP) docs $v
+
+	$i "Check that documentation dependencies were fetched"
+	$t test -d $(APP)/deps/edown
+
+	$i "Check the Edown generated Markdown documentation"
+	$t test -f $(APP)/doc/boy.md
+	$t test -f $(APP)/doc/girl.md
+
+core-deps-fetch-git: build clean-core-deps-fetch-git
 
 	$i "Bootstrap a new OTP library named $(APP)"
 	$t mkdir $(APP)/
@@ -195,45 +235,71 @@ endif
 		{ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
 		halt()"
 
-core-deps-doc: build clean-core-deps-doc
+core-deps-fetch-hg: build clean-core-deps-fetch-hg
 
 	$i "Bootstrap a new OTP library named $(APP)"
 	$t mkdir $(APP)/
 	$t cp ../erlang.mk $(APP)/
 	$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
 
-	$i "Generate .erl files"
-	$t echo "-module(boy)." > $(APP)/src/boy.erl
-	$t echo "-module(girl)." > $(APP)/src/girl.erl
-
-	$i "Add Edown as a documentation building dependency"
+	$i "Add Ehsa 4.0.3 to the list of dependencies"
 	$t sed -i.bak '2i\
-DOC_DEPS = edown\
-EDOC_OPTS = {doclet, edown_doclet}\
+DEPS = ehsa\
+dep_ehsa = hg https://bitbucket.org/a12n/ehsa 4.0.3\
 ' $(APP)/Makefile
 
+ifdef LEGACY
+	$i "Add ehsa to the applications key in the .app.src file"
+	$t sed -i.bak '8i\
+			ehsa,' $(APP)/src/$(APP).app.src
+endif
+
 	$i "Build the application"
 	$t $(MAKE) -C $(APP) $v
 
-	$i "Check that no dependencies were fetched"
-	$t test ! -e $(APP)/deps
+	$i "Check that all dependencies were fetched"
+	$t test -d $(APP)/deps/ehsa
 
 	$i "Check that the application was compiled correctly"
 	$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
-		[ok = application:load(App) || App <- [$(APP)]], \
+		[ok = application:load(App) || App <- [$(APP), ehsa]], \
 		{ok, Deps} = application:get_key($(APP), applications), \
-		false = lists:member(edown, Deps), \
+		true = lists:member(ehsa, Deps), \
+		{ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
 		halt()"
 
-	$i "Build the application documentation"
-	$t $(MAKE) -C $(APP) docs $v
+core-deps-fetch-svn: build clean-core-deps-fetch-svn
 
-	$i "Check that documentation dependencies were fetched"
-	$t test -d $(APP)/deps/edown
+	$i "Bootstrap a new OTP library named $(APP)"
+	$t mkdir $(APP)/
+	$t cp ../erlang.mk $(APP)/
+	$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
 
-	$i "Check the Edown generated Markdown documentation"
-	$t test -f $(APP)/doc/boy.md
-	$t test -f $(APP)/doc/girl.md
+	$i "Add Cowlib 1.0.0 to the list of dependencies"
+	$t sed -i.bak '2i\
+DEPS = cowlib\
+dep_cowlib = svn https://github.com/ninenines/cowlib/tags/1.0.0\
+' $(APP)/Makefile
+
+ifdef LEGACY
+	$i "Add Cowlib to the applications key in the .app.src file"
+	$t sed -i.bak '8i\
+			cowlib,' $(APP)/src/$(APP).app.src
+endif
+
+	$i "Build the application"
+	$t $(MAKE) -C $(APP) $v
+
+	$i "Check that all dependencies were fetched"
+	$t test -d $(APP)/deps/cowlib
+
+	$i "Check that the application was compiled correctly"
+	$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
+		[ok = application:load(App) || App <- [$(APP), cowlib]], \
+		{ok, Deps} = application:get_key($(APP), applications), \
+		true = lists:member(cowlib, Deps), \
+		{ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
+		halt()"
 
 ifndef LEGACY
 core-deps-otp: build clean-core-deps-otp