peter 25 years ago
parent
commit
25bc00bb42
7 changed files with 131 additions and 37 deletions
  1. 116 27
      tests/Makefile
  2. 5 0
      tests/Makefile.fpc
  3. 0 2
      tests/tbs/tbs0304.pp
  4. 0 1
      tests/test/testexc2.pp
  5. 9 5
      tests/test/testin64.pp
  6. 0 2
      tests/webtbs/tbug735.pp
  7. 1 0
      tests/webtbs/tbug935.pp

+ 116 - 27
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
+
+# Target CPU
+ifndef CPU_TARGET
+CPU_TARGET:=$(shell $(FPC) -iTP)
 endif
 endif
 
 
-# FPC_CPU
-ifndef FPC_CPU
-export FPC_CPU=$(shell $(FPC) -iTP)
+# 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,56 @@ 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
+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
 endif
+# set the verbosity to max
+override FPCOPT+=-va
+override REDIR:= >> $(REDIRFILE)
 endif
 endif
 
 
+#####################################################################
+# Standard rules
+#####################################################################
 
 
+#####################################################################
+# Local Makefile
+#####################################################################
 
 
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
 
 
 #####################################################################
 #####################################################################
 # Users rules
 # Users rules
 #####################################################################
 #####################################################################
 
 
+.PHONY: all units tests cont_tests
 
 
 # For linux by default no graph tests
 # For linux by default no graph tests
 ifdef inlinux
 ifdef inlinux
@@ -250,6 +336,9 @@ endif
 
 
 all : info
 all : info
 
 
+units :
+	$(MAKE) -C units
+
 tests : clean all_compilations
 tests : clean all_compilations
 
 
 cont_tests : all_compilations
 cont_tests : all_compilations
@@ -616,4 +705,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

+ 5 - 0
tests/Makefile.fpc

@@ -10,6 +10,8 @@ none=1
 exts=1
 exts=1
 
 
 [rules]
 [rules]
+.PHONY: all units tests cont_tests
+
 # For linux by default no graph tests
 # For linux by default no graph tests
 ifdef inlinux
 ifdef inlinux
 NOGRAPH=1
 NOGRAPH=1
@@ -28,6 +30,9 @@ endif
 
 
 all : info
 all : info
 
 
+units :
+	$(MAKE) -C units
+
 tests : clean all_compilations
 tests : clean all_compilations
 
 
 cont_tests : all_compilations
 cont_tests : all_compilations

+ 0 - 2
tests/tbs/tbs0304.pp

@@ -9,9 +9,7 @@ asm
    MOV  AX,B
    MOV  AX,B
    CMP  AX,[CB]
    CMP  AX,[CB]
    JZ   @@10
    JZ   @@10
-   CLI
    MOV  [CB],AX
    MOV  [CB],AX
-   STI
 @@10:
 @@10:
 end;
 end;
 
 

+ 0 - 1
tests/test/testexc2.pp

@@ -17,7 +17,6 @@ var
    i : longint;
    i : longint;
 
 
 begin
 begin
-   d;
    for i:=1 to 20 do
    for i:=1 to 20 do
      try
      try
         d;
         d;

+ 9 - 5
tests/test/testin64.pp

@@ -27,8 +27,11 @@ var
    q1,q3,q4 : qword;
    q1,q3,q4 : qword;
 
 
 begin
 begin
-   if (q4 div q3) div (q2 div q1)<>(q2 div q1) div (q4 div q3) then
-     writeln;
+   q1:=1;
+   q3:=1;
+   q4:=1;
+   if not((q4 div q3) div (q2 div q1)<>(q2 div q1) div (q4 div q3)) then
+     writeln('Error :(');
    q:=q-q;
    q:=q-q;
    q:=q-(q*q);
    q:=q-(q*q);
    q:=(q*q)-(q*q);
    q:=(q*q)-(q*q);
@@ -83,10 +86,11 @@ begin
    q:=(q*q)*(q*q);
    q:=(q*q)*(q*q);
    q:=((q*q)*(q*q))*((q*q)*(q*q));
    q:=((q*q)*(q*q))*((q*q)*(q*q));
 
 
-   write(q);
-   write(i);
+   writeln(q);
+   writeln(i);
+{ test can't be interactive (PFV)
    read(q);
    read(q);
-   read(i);
+   read(i); }
    str(q,s);
    str(q,s);
    str(i,s);
    str(i,s);
 end.
 end.

+ 0 - 2
tests/webtbs/tbug735.pp

@@ -14,9 +14,7 @@ asm
    MOV  AX,B
    MOV  AX,B
    CMP  AX,[CB]
    CMP  AX,[CB]
    JZ   @OK
    JZ   @OK
-   CLI
    MOV  [CB],AX
    MOV  [CB],AX
-   STI
    CALL DoIt
    CALL DoIt
 @OK:      { <-- creates labels with same name }
 @OK:      { <-- creates labels with same name }
 end;
 end;

+ 1 - 0
tests/webtbs/tbug935.pp

@@ -1,3 +1,4 @@
+{$inline on}
 
 
 procedure test(v:boolean);
 procedure test(v:boolean);