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

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.
Loïc Hoguin 9 лет назад
Родитель
Сommit
5bcfeece2f
7 измененных файлов с 48 добавлено и 8 удалено
  1. 8 3
      Makefile
  2. 2 1
      appveyor.yml
  3. 2 2
      circle.yml
  4. 2 2
      core/erlc.mk
  5. 6 0
      plugins/bootstrap.mk
  6. 22 0
      test/core_app.mk
  7. 6 0
      test/plugin_bootstrap.mk

+ 8 - 3
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:

+ 2 - 1
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"

+ 2 - 2
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:

+ 2 - 2
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 \

+ 6 - 0
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),)

+ 22 - 0
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

+ 6 - 0
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