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 years ago
parent
commit
db5d26f132
3 changed files with 173 additions and 35 deletions
  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))
 override PATH:=$(subst \,/,$(PATH))
 
 
 # Search for PWD and determine also if we are under linux
 # 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),)
 ifeq ($(PWD),)
-PWD=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
 ifeq ($(PWD),)
 ifeq ($(PWD),)
 nopwd:
 nopwd:
 	@echo You need the GNU utils package to use this Makefile!
 	@echo You need the GNU utils package to use this Makefile!
@@ -52,47 +52,105 @@ else
 EXEEXT=.exe
 EXEEXT=.exe
 endif
 endif
 
 
-# The path which is search separated by spaces
+# The path which is searched separated by spaces
 ifdef inlinux
 ifdef inlinux
 SEARCHPATH=$(subst :, ,$(PATH))
 SEARCHPATH=$(subst :, ,$(PATH))
 else
 else
 SEARCHPATH=$(subst ;, ,$(PATH))
 SEARCHPATH=$(subst ;, ,$(PATH))
 endif
 endif
 
 
+# Base dir
+ifdef PWD
+BASEDIR:=$(shell $(PWD))
+else
+BASEDIR=.
+endif
+
 #####################################################################
 #####################################################################
 # FPC version/target Detection
 # FPC version/target Detection
 #####################################################################
 #####################################################################
 
 
 # What compiler to use ?
 # What compiler to use ?
 ifndef FPC
 ifndef FPC
+# Compatibility with old makefiles
+ifdef PP
+FPC=$(PP)
+else
 ifdef inOS2
 ifdef inOS2
-export FPC=ppos2$(EXEEXT)
+FPC=ppos2
 else
 else
-export FPC=ppc386$(EXEEXT)
+FPC=ppc386
+endif
 endif
 endif
 endif
 endif
+override FPC:=$(subst $(EXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(EXEEXT)
 
 
 # Target OS
 # Target OS
 ifndef OS_TARGET
 ifndef OS_TARGET
-export OS_TARGET=$(shell $(FPC) -iTO)
+OS_TARGET:=$(shell $(FPC) -iTO)
 endif
 endif
 
 
 # Source OS
 # Source OS
 ifndef OS_SOURCE
 ifndef OS_SOURCE
-export OS_SOURCE=$(shell $(FPC) -iSO)
+OS_SOURCE:=$(shell $(FPC) -iSO)
 endif
 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
 endif
 
 
 # FPC version
 # FPC version
 ifndef FPC_VERSION
 ifndef FPC_VERSION
-export FPC_VERSION=$(shell $(FPC) -iV)
+FPC_VERSION:=$(shell $(FPC) -iV)
 endif
 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
 # User Settings
@@ -134,7 +192,8 @@ ASMEXT=.s
 SMARTEXT=.sl
 SMARTEXT=.sl
 STATICLIBEXT=.a
 STATICLIBEXT=.a
 SHAREDLIBEXT=.so
 SHAREDLIBEXT=.so
-PACKAGESUFFIX=
+RSTEXT=.rst
+FPCMADE=fpcmade
 
 
 # Go32v1
 # Go32v1
 ifeq ($(OS_TARGET),go32v1)
 ifeq ($(OS_TARGET),go32v1)
@@ -144,17 +203,17 @@ ASMEXT=.s1
 SMARTEXT=.sl1
 SMARTEXT=.sl1
 STATICLIBEXT=.a1
 STATICLIBEXT=.a1
 SHAREDLIBEXT=.so1
 SHAREDLIBEXT=.so1
-PACKAGESUFFIX=v1
+FPCMADE=fpcmade.v1
 endif
 endif
 
 
 # Go32v2
 # Go32v2
 ifeq ($(OS_TARGET),go32v2)
 ifeq ($(OS_TARGET),go32v2)
-PACKAGESUFFIX=go32
+FPCMADE=fpcmade.dos
 endif
 endif
 
 
 # Linux
 # Linux
 ifeq ($(OS_TARGET),linux)
 ifeq ($(OS_TARGET),linux)
-PACKAGESUFFIX=linux
+FPCMADE=fpcmade.lnx
 endif
 endif
 
 
 # Win32
 # Win32
@@ -165,7 +224,7 @@ ASMEXT=.sw
 SMARTEXT=.slw
 SMARTEXT=.slw
 STATICLIBEXT=.aw
 STATICLIBEXT=.aw
 SHAREDLIBEXT=.dll
 SHAREDLIBEXT=.dll
-PACKAGESUFFIX=win32
+FPCMADE=fpcmade.w32
 endif
 endif
 
 
 # OS/2
 # OS/2
@@ -176,7 +235,7 @@ OEXT=.oo2
 SMARTEXT=.so
 SMARTEXT=.so
 STATICLIBEXT=.ao2
 STATICLIBEXT=.ao2
 SHAREDLIBEXT=.dll
 SHAREDLIBEXT=.dll
-PACKAGESUFFIX=os2
+FPCMADE=fpcmade.os2
 endif
 endif
 
 
 # library prefix
 # library prefix
@@ -208,29 +267,54 @@ endif
 # Default Directories
 # Default Directories
 #####################################################################
 #####################################################################
 
 
-# Base dir
-ifdef PWD
-BASEDIR:=$(shell $(PWD))
-else
-BASEDIR=.
-endif
-
 # set the prefix directory where to install everything
 # set the prefix directory where to install everything
 ifndef PREFIXINSTALLDIR
 ifndef PREFIXINSTALLDIR
 ifdef inlinux
 ifdef inlinux
-export PREFIXINSTALLDIR=/usr
+PREFIXINSTALLDIR=/usr
 else
 else
-export PREFIXINSTALLDIR=/pp
+PREFIXINSTALLDIR=/pp
 endif
 endif
 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
 # For linux by default no graph tests
 ifdef inlinux
 ifdef inlinux
@@ -319,11 +403,26 @@ else
 EXERETVAL=No EXCFILE variable defined
 EXERETVAL=No EXCFILE variable defined
 endif
 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:
 testexecsuccess:
 	@echo "Test for exec $(FILE) success (runs without error)"
 	@echo "Test for exec $(FILE) success (runs without error)"
 	@echo "Test for $(FILE) success (runs without error)" >> $(LOG)
 	@echo "Test for $(FILE) success (runs without error)" >> $(LOG)
 else
 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:
 testexecsuccess:
 	@echo "Test for exec $(FILE) fails exec error $(EXERETVAL)"
 	@echo "Test for exec $(FILE) fails exec error $(EXERETVAL)"
 	@echo "Test for exec $(FILE) fails exec error $(EXERETVAL)" >> $(LOG)
 	@echo "Test for exec $(FILE) fails exec error $(EXERETVAL)" >> $(LOG)
@@ -335,6 +434,19 @@ ifdef LONGLOG
 	cat $(FILE).elg >> $(LONGLOG)
 	cat $(FILE).elg >> $(LONGLOG)
 	@echo $(FILE) >> ex_fail
 	@echo $(FILE) >> ex_fail
 endif
 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
 endif
 
 
 ifeq ($(wildcard $(FILE)$(EXEEXT)),$(FILE)$(EXEEXT))
 ifeq ($(wildcard $(FILE)$(EXEEXT)),$(FILE)$(EXEEXT))
@@ -350,7 +462,7 @@ else
 endif
 endif
 endif
 endif
 	cp -f retcode $(FILE).exc
 	cp -f retcode $(FILE).exc
-	$(MAKE) testexecsuccess 'FILE=$(FILE)' 'EXCFILE=$(FILE).exc'
+	$(MAKE) testexecsuccess 'FILE=$(FILE)' 'EXCFILE=$(FILE).exc' 'REEFILE=$(FILE).ree'
 else
 else
 testexec:
 testexec:
 ifeq ($(wildcard $(FILE)$(PPUEXT)),$(FILE)$(PPUEXT))
 ifeq ($(wildcard $(FILE)$(PPUEXT)),$(FILE)$(PPUEXT))
@@ -362,7 +474,6 @@ ifeq ($(wildcard $(FILE).dll),$(FILE).dll)
 	@echo "DLL" > $(FILE).elg
 	@echo "DLL" > $(FILE).elg
 else
 else
 	@echo "No exefile $(FILE)$(EXEEXT)"
 	@echo "No exefile $(FILE)$(EXEEXT)"
-	@echo $(FILE) >> faillist
 ifdef LONGLOG
 ifdef LONGLOG
 	@echo "No exefile $(FILE)$(EXEEXT) was generated" >> $(LONGLOG)
 	@echo "No exefile $(FILE)$(EXEEXT) was generated" >> $(LONGLOG)
 endif
 endif

+ 31 - 5
tests/Makefile.fpc

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