From 5bcfeece2f55cd8570b1356d9982756e99f90b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 18 Sep 2015 14:34:58 +0200 Subject: Test "no .app.src" by default, test legacy with LEGACY=1 Also fixes two bugs with the new "no .app.src" method. All tests now pass with both methods. We can now test specific cases with make check c=$CASE. --- Makefile | 11 ++++++++--- appveyor.yml | 3 ++- circle.yml | 4 ++-- core/erlc.mk | 4 ++-- plugins/bootstrap.mk | 6 ++++++ test/core_app.mk | 22 ++++++++++++++++++++++ test/plugin_bootstrap.mk | 6 ++++++ 7 files changed, 48 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 3e7364a..5eff5d6 100644 --- a/Makefile +++ b/Makefile @@ -24,12 +24,17 @@ all: awk 'FNR==1 && NR!=1{print ""}1' $(patsubst %,%.mk,$(BUILD_CONFIG)) \ | sed 's/^ERLANG_MK_VERSION = .*/ERLANG_MK_VERSION = $(ERLANG_MK_VERSION)/' > $(ERLANG_MK) -ifeq ($(p),) +ifdef p check: - $(MAKE) -C test + $(MAKE) -C test pkg-$p else +ifdef c check: - $(MAKE) -C test pkg-$(p) + $(MAKE) -C test $c LEGACY=$(LEGACY) +else +check: + $(MAKE) -C test LEGACY=$(LEGACY) +endif endif clean: diff --git a/appveyor.yml b/appveyor.yml index 20a6947..5e8e5af 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,4 +3,5 @@ build_script: - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Sy" - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S git make" test_script: -- C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER && make -k check" +- C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER && make -j 32 -k check" +- C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER && make -j 32 -k check LEGACY=1" diff --git a/circle.yml b/circle.yml index 73b087e..25e1f13 100644 --- a/circle.yml +++ b/circle.yml @@ -17,5 +17,5 @@ dependencies: test: override: - - source $HOME/erlang/OTP-18.0.2/activate && make check: - timeout: 7200 + - source $HOME/erlang/OTP-18.0.2/activate && make -j 32 -k check: + - source $HOME/erlang/OTP-18.0.2/activate && make -j 32 -k check LEGACY=1: diff --git a/core/erlc.mk b/core/erlc.mk index 1a73698..fbba7ae 100644 --- a/core/erlc.mk +++ b/core/erlc.mk @@ -57,7 +57,7 @@ define app_file {application, $(PROJECT), [ {description, "$(PROJECT_DESCRIPTION)"}, {vsn, "$(PROJECT_VERSION)"}, - $(if $(IS_DEP),{id, "$(1)"},) + $(if $(IS_DEP),{id$(comma)$(space)"$(1)"}$(comma)) {modules, [$(call comma_list,$(2))]}, {registered, []}, {applications, [$(call comma_list,kernel stdlib $(OTP_DEPS) $(DEPS))]} @@ -201,7 +201,7 @@ ebin/$(PROJECT).app:: $(ERL_FILES) $(CORE_FILES) $(eval MODULES := $(patsubst %,'%',$(sort $(notdir $(basename \ $(filter-out $(ERLC_EXCLUDE_PATHS),$(ERL_FILES) $(CORE_FILES))))))) ifeq ($(wildcard src/$(PROJECT).app.src),) - $(app_verbose) echo $(subst $(newline),,$(subst ",\",$(call app_file,$(GITDESCRIBE),$(MODULES)))) \ + $(app_verbose) echo "$(subst $(newline),,$(subst ",\",$(call app_file,$(GITDESCRIBE),$(MODULES))))" \ > ebin/$(PROJECT).app else $(verbose) if [ -z "$$(grep -E '^[^%]*{\s*modules\s*,' src/$(PROJECT).app.src)" ]; then \ diff --git a/plugins/bootstrap.mk b/plugins/bootstrap.mk index 7f8331e..44f10ea 100644 --- a/plugins/bootstrap.mk +++ b/plugins/bootstrap.mk @@ -49,6 +49,8 @@ endef ifdef SP define bs_Makefile PROJECT = $(PROJECT) +PROJECT_DESCRIPTION = New project +PROJECT_VERSION = 0.0.1 # Whitespace to be used when creating files from templates. SP = $(SP) @@ -355,7 +357,9 @@ ifneq ($(wildcard src/),) endif $(call render_template,bs_Makefile,Makefile) $(verbose) mkdir src/ +ifdef LEGACY $(call render_template,bs_appsrc,src/$(PROJECT).app.src) +endif $(call render_template,bs_app,src/$(PROJECT)_app.erl) $(eval n := $(PROJECT)_sup) $(call render_template,tpl_supervisor,src/$(PROJECT)_sup.erl) @@ -366,7 +370,9 @@ ifneq ($(wildcard src/),) endif $(call render_template,bs_Makefile,Makefile) $(verbose) mkdir src/ +ifdef LEGACY $(call render_template,bs_appsrc_lib,src/$(PROJECT).app.src) +endif bootstrap-rel: ifneq ($(wildcard relx.config),) diff --git a/test/core_app.mk b/test/core_app.mk index a782e65..1acaef1 100644 --- a/test/core_app.mk +++ b/test/core_app.mk @@ -91,7 +91,9 @@ core-app-asn1: build clean-core-app-asn1 $t test -f $(APP)/asn1/CAP.asn1 $t test -f $(APP)/asn1/Def.asn1 $t test -f $(APP)/include/unrelated.hrl +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/use_cap.erl $t test -f $(APP)/src/use_def.erl @@ -292,7 +294,9 @@ core-app-generate-erl: build clean-core-app-generate-erl $t test -f $(APP)/Makefile $t test -f $(APP)/erlang.mk $t test -f $(APP)/script.sh +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/boy.erl $t test -f $(APP)/src/girl.erl @@ -457,7 +461,9 @@ core-app-generate-erl-prepend: build clean-core-app-generate-erl-prepend $t test -f $(APP)/Makefile $t test -f $(APP)/erlang.mk $t test -f $(APP)/script.sh +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/boy.erl $t test -f $(APP)/src/girl.erl @@ -556,7 +562,9 @@ core-app-hrl: build clean-core-app-hrl $t test -f $(APP)/erlang.mk $t test -f $(APP)/include/blue.hrl $t test -f $(APP)/include/red.hrl +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/use_blue.erl $t test -f $(APP)/src/use_red.erl @@ -643,7 +651,9 @@ core-app-hrl-recursive: build clean-core-app-hrl-recursive $t test -f $(APP)/include/blue.hrl $t test -f $(APP)/include/pill.hrl $t test -f $(APP)/include/red.hrl +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/use_blue.erl $t test -f $(APP)/src/use_red.erl @@ -740,7 +750,9 @@ core-app-mib: build clean-core-app-mib $t test -f $(APP)/include/unrelated.hrl $t test -f $(APP)/mibs/EX1-MIB.mib $t test -f $(APP)/mibs/OTP-REG.mib +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/use_v1.erl $t test -f $(APP)/src/use_v2.erl @@ -867,7 +879,9 @@ NO_MAKEDEP ?= 1\ $t test -f $(APP)/erlang.mk $t test -f $(APP)/include/blue.hrl $t test -f $(APP)/include/red.hrl +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/use_blue.erl $t test -f $(APP)/src/use_red.erl @@ -956,7 +970,9 @@ core-app-xrl: build clean-core-app-xrl $i "Check that source files still exist" $t test -f $(APP)/Makefile $t test -f $(APP)/erlang.mk +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/boy.erl $t test -f $(APP)/src/erlang_scan.xrl $t test -f $(APP)/src/girl.erl @@ -1092,7 +1108,9 @@ core-app-xrl-include: build clean-core-app-xrl-include $i "Check that source files still exist" $t test -f $(APP)/Makefile $t test -f $(APP)/erlang.mk +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/boy.erl $t test -f $(APP)/src/girl.erl $t test -f $(APP)/src/errvals.hrl @@ -1186,7 +1204,9 @@ core-app-yrl: build clean-core-app-yrl $i "Check that source files still exist" $t test -f $(APP)/Makefile $t test -f $(APP)/erlang.mk +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/boy.erl $t test -f $(APP)/src/girl.erl $t test -f $(APP)/src/xmerl_xpath_parse.yrl @@ -1297,7 +1317,9 @@ core-app-yrl-include: build clean-core-app-yrl-include $i "Check that source files still exist" $t test -f $(APP)/Makefile $t test -f $(APP)/erlang.mk +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/boy.erl $t test -f $(APP)/src/core_parse.hrl $t test -f $(APP)/src/core_parse.yrl diff --git a/test/plugin_bootstrap.mk b/test/plugin_bootstrap.mk index b927a92..16bfb58 100644 --- a/test/plugin_bootstrap.mk +++ b/test/plugin_bootstrap.mk @@ -22,7 +22,9 @@ bootstrap-app: build clean-bootstrap-app $i "Check that all bootstrapped files exist" $t test -f $(APP)/Makefile +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/$(APP)_app.erl $t test -f $(APP)/src/$(APP)_sup.erl @@ -51,7 +53,9 @@ bootstrap-lib: build clean-bootstrap-lib $i "Check that all bootstrapped files exist" $t test -f $(APP)/Makefile +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $i "Build the application" $t $(MAKE) -C $(APP) $v @@ -77,7 +81,9 @@ bootstrap-rel: build clean-bootstrap-rel $t test -f $(APP)/relx.config $t test -f $(APP)/rel/sys.config $t test -f $(APP)/rel/vm.args +ifdef LEGACY $t test -f $(APP)/src/$(APP).app.src +endif $t test -f $(APP)/src/$(APP)_app.erl $t test -f $(APP)/src/$(APP)_sup.erl -- cgit v1.2.3