Browse Source

+ added check for file with .ree extension
if .ree extension is found the content is assumed to be the
expected Run Time Error

pierre 25 năm trước cách đây
mục cha
commit
db5d26f132
3 tập tin đã thay đổi với 173 bổ sung35 xóa
  1. 141 30
      tests/Makefile
  2. 31 5
      tests/Makefile.fpc
  3. 1 0
      tests/tbs/tbs0306.ree

+ 141 - 30
tests/Makefile

@@ -14,9 +14,9 @@ defaultrule: info
 override PATH:=$(subst \,/,$(PATH))
 
 # Search for PWD and determine also if we are under linux
-PWD=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
 ifeq ($(PWD),)
-PWD=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
 ifeq ($(PWD),)
 nopwd:
 	@echo You need the GNU utils package to use this Makefile!
@@ -52,47 +52,105 @@ else
 EXEEXT=.exe
 endif
 
-# The path which is search separated by spaces
+# The path which is searched separated by spaces
 ifdef inlinux
 SEARCHPATH=$(subst :, ,$(PATH))
 else
 SEARCHPATH=$(subst ;, ,$(PATH))
 endif
 
+# Base dir
+ifdef PWD
+BASEDIR:=$(shell $(PWD))
+else
+BASEDIR=.
+endif
+
 #####################################################################
 # FPC version/target Detection
 #####################################################################
 
 # What compiler to use ?
 ifndef FPC
+# Compatibility with old makefiles
+ifdef PP
+FPC=$(PP)
+else
 ifdef inOS2
-export FPC=ppos2$(EXEEXT)
+FPC=ppos2
 else
-export FPC=ppc386$(EXEEXT)
+FPC=ppc386
+endif
 endif
 endif
+override FPC:=$(subst $(EXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(EXEEXT)
 
 # Target OS
 ifndef OS_TARGET
-export OS_TARGET=$(shell $(FPC) -iTO)
+OS_TARGET:=$(shell $(FPC) -iTO)
 endif
 
 # Source OS
 ifndef OS_SOURCE
-export OS_SOURCE=$(shell $(FPC) -iSO)
+OS_SOURCE:=$(shell $(FPC) -iSO)
 endif
 
-# FPC_CPU
-ifndef FPC_CPU
-export FPC_CPU=$(shell $(FPC) -iTP)
+# Target CPU
+ifndef CPU_TARGET
+CPU_TARGET:=$(shell $(FPC) -iTP)
+endif
+
+# Source CPU
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(shell $(FPC) -iSP)
 endif
 
 # FPC version
 ifndef FPC_VERSION
-export FPC_VERSION=$(shell $(FPC) -iV)
+FPC_VERSION:=$(shell $(FPC) -iV)
 endif
 
+export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
+
+#####################################################################
+# FPCDIR Setting
+#####################################################################
+
+# Test FPCDIR to look if the RTL dir exists
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(FPCDIR)/rtl),)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=wrong
+endif
+endif
+else
+override FPCDIR=wrong
+endif
 
+# Detect FPCDIR
+ifeq ($(FPCDIR),wrong)
+ifdef inlinux
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(FPCDIR)/rtl),)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(FPCDIR)/rtl),)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+endif
 
 #####################################################################
 # User Settings
@@ -134,7 +192,8 @@ ASMEXT=.s
 SMARTEXT=.sl
 STATICLIBEXT=.a
 SHAREDLIBEXT=.so
-PACKAGESUFFIX=
+RSTEXT=.rst
+FPCMADE=fpcmade
 
 # Go32v1
 ifeq ($(OS_TARGET),go32v1)
@@ -144,17 +203,17 @@ ASMEXT=.s1
 SMARTEXT=.sl1
 STATICLIBEXT=.a1
 SHAREDLIBEXT=.so1
-PACKAGESUFFIX=v1
+FPCMADE=fpcmade.v1
 endif
 
 # Go32v2
 ifeq ($(OS_TARGET),go32v2)
-PACKAGESUFFIX=go32
+FPCMADE=fpcmade.dos
 endif
 
 # Linux
 ifeq ($(OS_TARGET),linux)
-PACKAGESUFFIX=linux
+FPCMADE=fpcmade.lnx
 endif
 
 # Win32
@@ -165,7 +224,7 @@ ASMEXT=.sw
 SMARTEXT=.slw
 STATICLIBEXT=.aw
 SHAREDLIBEXT=.dll
-PACKAGESUFFIX=win32
+FPCMADE=fpcmade.w32
 endif
 
 # OS/2
@@ -176,7 +235,7 @@ OEXT=.oo2
 SMARTEXT=.so
 STATICLIBEXT=.ao2
 SHAREDLIBEXT=.dll
-PACKAGESUFFIX=os2
+FPCMADE=fpcmade.os2
 endif
 
 # library prefix
@@ -208,29 +267,54 @@ endif
 # Default Directories
 #####################################################################
 
-# Base dir
-ifdef PWD
-BASEDIR:=$(shell $(PWD))
-else
-BASEDIR=.
-endif
-
 # set the prefix directory where to install everything
 ifndef PREFIXINSTALLDIR
 ifdef inlinux
-export PREFIXINSTALLDIR=/usr
+PREFIXINSTALLDIR=/usr
 else
-export PREFIXINSTALLDIR=/pp
+PREFIXINSTALLDIR=/pp
 endif
 endif
+export PREFIXINSTALLDIR
 
+# Where to place the resulting zip files
+ifndef DESTZIPDIR
+DESTZIPDIR:=$(BASEDIR)
+endif
+export DESTZIPDIR
 
+#####################################################################
+# Redirection
+#####################################################################
 
+ifndef REDIRFILE
+REDIRFILE=log
+endif
+
+ifdef REDIR
+ifndef inlinux
+override FPC=redir -eo $(FPC)
+endif
+# set the verbosity to max
+override FPCOPT+=-va
+override REDIR:= >> $(REDIRFILE)
+endif
 
 #####################################################################
-# Users rules
+# Standard rules
+#####################################################################
+
+#####################################################################
+# Local Makefile
 #####################################################################
 
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
+
+#####################################################################
+# Users rules
+#####################################################################
 
 # For linux by default no graph tests
 ifdef inlinux
@@ -319,11 +403,26 @@ else
 EXERETVAL=No EXCFILE variable defined
 endif
 
-ifeq ($(EXERETVAL),0)
+ifdef REEFILE
+ifeq ($(wildcard $(REEFILE)*),$(REEFILE))
+EXPECTEDRETVAL:=$(strip $(shell cat $(REEFILE)))
+else
+EXPECTEDRETVAL=0
+endif
+endif
+
+ifeq ($(EXERETVAL),$(EXPECTEDRETVAL))
+ifeq ($(EXPECTEDRETVAL),0)
 testexecsuccess:
 	@echo "Test for exec $(FILE) success (runs without error)"
 	@echo "Test for $(FILE) success (runs without error)" >> $(LOG)
 else
+testexecsuccess:
+	@echo "Test for exec $(FILE) success (gives correct error $(EXERETVAL))"
+	@echo "Test for $(FILE) success (gives correct error $(EXERETVAL))" >> $(LOG)
+endif
+else
+ifeq ($(EXPECTEDRETVAL),0)
 testexecsuccess:
 	@echo "Test for exec $(FILE) fails exec error $(EXERETVAL)"
 	@echo "Test for exec $(FILE) fails exec error $(EXERETVAL)" >> $(LOG)
@@ -335,6 +434,19 @@ ifdef LONGLOG
 	cat $(FILE).elg >> $(LONGLOG)
 	@echo $(FILE) >> ex_fail
 endif
+else
+testexecsuccess:
+	@echo "Test for exec $(FILE) fails exec error $(EXERETVAL) ($(EXPECTEDRETVAL) expected)"
+	@echo "Test for exec $(FILE) fails exec error $(EXERETVAL) ($(EXPECTEDRETVAL) expected)" >> $(LOG)
+	@echo "Running $(FILE) fails with error $(EXERETVAL) ($(EXPECTEDRETVAL) expected)" >> faillist
+ifdef LONGLOG
+	@echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" >> $(LONGLOG)
+	@echo "Test for exec $(FILE) fails exec error $(EXERETVAL) ($(EXPECTEDRETVAL) expected)" >> $(LONGLOG)
+	@echo "" >> $(LONGLOG)
+	cat $(FILE).elg >> $(LONGLOG)
+	@echo $(FILE) >> ex_fail
+endif
+endif
 endif
 
 ifeq ($(wildcard $(FILE)$(EXEEXT)),$(FILE)$(EXEEXT))
@@ -350,7 +462,7 @@ else
 endif
 endif
 	cp -f retcode $(FILE).exc
-	$(MAKE) testexecsuccess 'FILE=$(FILE)' 'EXCFILE=$(FILE).exc'
+	$(MAKE) testexecsuccess 'FILE=$(FILE)' 'EXCFILE=$(FILE).exc' 'REEFILE=$(FILE).ree'
 else
 testexec:
 ifeq ($(wildcard $(FILE)$(PPUEXT)),$(FILE)$(PPUEXT))
@@ -362,7 +474,6 @@ ifeq ($(wildcard $(FILE).dll),$(FILE).dll)
 	@echo "DLL" > $(FILE).elg
 else
 	@echo "No exefile $(FILE)$(EXEEXT)"
-	@echo $(FILE) >> faillist
 ifdef LONGLOG
 	@echo "No exefile $(FILE)$(EXEEXT) was generated" >> $(LONGLOG)
 endif

+ 31 - 5
tests/Makefile.fpc

@@ -97,11 +97,26 @@ else
 EXERETVAL=No EXCFILE variable defined
 endif
 
-ifeq ($(EXERETVAL),0)
+ifdef REEFILE
+ifeq ($(wildcard $(REEFILE)*),$(REEFILE))
+EXPECTEDRETVAL:=$(strip $(shell cat $(REEFILE)))
+else
+EXPECTEDRETVAL=0
+endif
+endif
+
+ifeq ($(EXERETVAL),$(EXPECTEDRETVAL))
+ifeq ($(EXPECTEDRETVAL),0)
 testexecsuccess:
         @echo "Test for exec $(FILE) success (runs without error)"
         @echo "Test for $(FILE) success (runs without error)" >> $(LOG)
 else
+testexecsuccess:
+        @echo "Test for exec $(FILE) success (gives correct error $(EXERETVAL))"
+        @echo "Test for $(FILE) success (gives correct error $(EXERETVAL))" >> $(LOG)
+endif
+else
+ifeq ($(EXPECTEDRETVAL),0)
 testexecsuccess:
         @echo "Test for exec $(FILE) fails exec error $(EXERETVAL)"
         @echo "Test for exec $(FILE) fails exec error $(EXERETVAL)" >> $(LOG)
@@ -113,6 +128,19 @@ ifdef LONGLOG
         cat $(FILE).elg >> $(LONGLOG)
         @echo $(FILE) >> ex_fail
 endif
+else
+testexecsuccess:
+        @echo "Test for exec $(FILE) fails exec error $(EXERETVAL) ($(EXPECTEDRETVAL) expected)"
+        @echo "Test for exec $(FILE) fails exec error $(EXERETVAL) ($(EXPECTEDRETVAL) expected)" >> $(LOG)
+        @echo "Running $(FILE) fails with error $(EXERETVAL) ($(EXPECTEDRETVAL) expected)" >> faillist
+ifdef LONGLOG
+        @echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" >> $(LONGLOG)
+        @echo "Test for exec $(FILE) fails exec error $(EXERETVAL) ($(EXPECTEDRETVAL) expected)" >> $(LONGLOG)
+        @echo "" >> $(LONGLOG)
+        cat $(FILE).elg >> $(LONGLOG)
+        @echo $(FILE) >> ex_fail
+endif
+endif
 endif
 
 ifeq ($(wildcard $(FILE)$(EXEEXT)),$(FILE)$(EXEEXT))
@@ -128,7 +156,7 @@ else
 endif
 endif
         cp -f retcode $(FILE).exc
-        $(MAKE) testexecsuccess 'FILE=$(FILE)' 'EXCFILE=$(FILE).exc'
+        $(MAKE) testexecsuccess 'FILE=$(FILE)' 'EXCFILE=$(FILE).exc' 'REEFILE=$(FILE).ree'
 else
 testexec:
 ifeq ($(wildcard $(FILE)$(PPUEXT)),$(FILE)$(PPUEXT))
@@ -140,7 +168,6 @@ ifeq ($(wildcard $(FILE).dll),$(FILE).dll)
         @echo "DLL" > $(FILE).elg
 else
         @echo "No exefile $(FILE)$(EXEEXT)"
-        @echo $(FILE) >> faillist
 ifdef LONGLOG
         @echo "No exefile $(FILE)$(EXEEXT) was generated" >> $(LONGLOG)
 endif
@@ -327,5 +354,4 @@ info :
         @echo run \'make allexec\' to test also if the executables
         @echo created behave like the should
         @echo run \'make tesiexec\' to test executables
-        @echo that require interactive mode
-
+        @echo that require interactive mode

+ 1 - 0
tests/tbs/tbs0306.ree

@@ -0,0 +1 @@
+217