From a40abed1616da47fbd83f1548228e8129bd42deb Mon Sep 17 00:00:00 2001
From: Alexey Lebedeff <alebedev@mirantis.com>
Date: Wed, 9 Nov 2016 18:29:30 +0300
Subject: Add test for CT on root app with sub-apps

---
 test/plugin_ct.mk | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/test/plugin_ct.mk b/test/plugin_ct.mk
index 50410c9..fe054e9 100644
--- a/test/plugin_ct.mk
+++ b/test/plugin_ct.mk
@@ -1,6 +1,6 @@
 # Common Test plugin.
 
-CT_CASES = all apps-only case check group logs-dir opts suite tests
+CT_CASES = all apps apps-only case check group logs-dir opts suite tests
 CT_TARGETS = $(addprefix ct-,$(CT_CASES))
 
 .PHONY: ct $(CT_TARGETS)
@@ -50,6 +50,34 @@ ct-all: build clean
 	$t $(MAKE) -C $(APP) distclean $v
 	$t test ! -e $(APP)/logs/index.html
 
+ct-apps: build clean
+
+	$i "Create a multi application repository with root application"
+	$t mkdir $(APP)/
+	$t cp ../erlang.mk $(APP)/.
+	$t echo "include erlang.mk" > $(APP)/Makefile
+
+	$i "Create a new library named my_lib"
+	$t $(MAKE) -C $(APP) new-lib in=my_lib $v
+
+	$i "Populate my_lib"
+	$t printf "%s\n" \
+		"-module(my_lib)." \
+		"-export([random_int/0])." \
+		"random_int() -> 4." > $(APP)/apps/my_lib/src/my_lib.erl
+
+	$i "Generate a Common Test suite in root application"
+	$t mkdir $(APP)/test
+	$t printf "%s\n" \
+		"-module(my_root_SUITE)." \
+		"-export([all/0, ok/1, call_my_lib/1])." \
+		"all() -> [ok, call_my_lib]." \
+		"ok(_) -> ok." \
+		"call_my_lib(_) -> 4 = my_lib:random_int()." > $(APP)/test/my_root_SUITE.erl
+
+	$i "Check that Common Test runs tests"
+	$t $(MAKE) -C $(APP) ct $v CT_SUITES=my_root
+
 ct-apps-only: build clean
 
 	$i "Create a multi application repository with no root application"
-- 
cgit v1.2.3