Просмотр исходного кода

Add or improve tests based on false flag reports

Loïc Hoguin 6 лет назад
Родитель
Сommit
5d710a2402
2 измененных файлов с 42 добавлено и 2 удалено
  1. 3 0
      test/plugin_ct.mk
  2. 39 2
      test/plugin_relx.mk

+ 3 - 0
test/plugin_ct.mk

@@ -78,6 +78,9 @@ ct-apps: build clean
 	$t $(MAKE) -C $(APP) ct $v
 
 	$i "Check that Common Test runs tests from a specific test suite"
+	$t $(MAKE) -C $(APP) ct-my_root $v
+
+	$i "Check that Common Test runs tests from a specific test suite using CT_SUITES"
 	$t $(MAKE) -C $(APP) ct CT_SUITES=my_root $v
 
 ct-apps-only: build clean

+ 39 - 2
test/plugin_relx.mk

@@ -53,6 +53,40 @@ relx-rel: build clean
 	$i "Check that the output directory was removed entirely"
 	$t test ! -d $(APP)/_rel/
 
+relx-apps-with-deps: build clean
+
+	$i "Bootstrap a new release as a multi application repository"
+	$t mkdir $(APP)/
+	$t cp ../erlang.mk $(APP)/
+	$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
+
+	$i "Create a new application my_app"
+	$t $(MAKE) -C $(APP) new-app in=my_app $v
+
+	$i "Include my_app in the release"
+	$t perl -pi.bak -e 's/$(APP),/$(APP), my_app,/' $(APP)/relx.config
+
+	$i "Add Cowlib to the list of dependencies for my_app"
+	$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/apps/my_app/Makefile
+
+ifdef LEGACY
+	$i "Add Cowlib to the applications key in the my_app.app.src file"
+	$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/apps/my_app/src/my_app.app.src
+endif
+
+	$i "Build the application"
+	$t $(MAKE) -C $(APP) $v
+
+	$i "Check that all compiled files exist"
+	$t test -f $(APP)/apps/my_app/my_app.d
+	$t test -f $(APP)/apps/my_app/ebin/my_app.app
+	$t test -f $(APP)/apps/my_app/ebin/my_app_app.beam
+	$t test -f $(APP)/apps/my_app/ebin/my_app_sup.beam
+	$t test -f $(APP)/deps/cowlib/ebin/cowlib.app
+
+	$i "Check that Cowlib was included in the release"
+	$t test -d $(APP)/_rel/test_relx_apps_with_deps_release/lib/cowlib-1.0.2
+
 relx-bare-rel: build clean
 
 	$i "Bootstrap a new release named $(APP)"
@@ -84,6 +118,7 @@ relx-post-rel: build clean
 	$i "Add relx-post-rel target to Makefile"
 	$t echo "relx-post-rel::" >> $(APP)/Makefile
 	$t echo "	echo test post rel > _rel/$(APP)_release/test_post_rel" >> $(APP)/Makefile
+
 	$i "Build the release"
 	$t $(MAKE) -C $(APP) $v
 
@@ -93,12 +128,12 @@ relx-post-rel: build clean
 	$i "Check that the release was built"
 	$t test -d $(APP)/_rel
 	$t test -d $(APP)/_rel/$(APP)_release
-	$t test -f $(APP)/_rel/$(APP)_release/test_post_rel
-	$t test "test post rel" = "`cat $(APP)/_rel/$(APP)_release/test_post_rel`"
 	$t test -d $(APP)/_rel/$(APP)_release/bin
 	$t test -d $(APP)/_rel/$(APP)_release/lib
 	$t test -d $(APP)/_rel/$(APP)_release/releases
 	$t test -d $(APP)/_rel/$(APP)_release/releases/1
+	$t test -f $(APP)/_rel/$(APP)_release/test_post_rel
+	$t test "test post rel" = "`cat $(APP)/_rel/$(APP)_release/test_post_rel`"
 
 	$i "Clean the application"
 	$t $(MAKE) -C $(APP) clean $v
@@ -110,6 +145,8 @@ relx-post-rel: build clean
 	$t test -d $(APP)/_rel/$(APP)_release/lib
 	$t test -d $(APP)/_rel/$(APP)_release/releases
 	$t test -d $(APP)/_rel/$(APP)_release/releases/1
+	$t test -f $(APP)/_rel/$(APP)_release/test_post_rel
+	$t test "test post rel" = "`cat $(APP)/_rel/$(APP)_release/test_post_rel`"
 
 	$i "Distclean the application"
 	$t $(MAKE) -C $(APP) distclean $v