Переглянути джерело

* Merged revisions 3997-3998

git-svn-id: branches/fixes_2_0@3999 -
michael 19 роки тому
батько
коміт
70a7fb2b7f

+ 1 - 0
.gitattributes

@@ -717,6 +717,7 @@ fcl/fpcunit/tests/frameworktest.pp svneol=native#text/plain
 fcl/fpcunit/tests/suitetest.pp svneol=native#text/plain
 fcl/fpcunit/testutils.pp svneol=native#text/plain
 fcl/fpcunit/ubmockobject.pp svneol=native#text/plain
+fcl/fpcunit/xmlreporter.pas svneol=native#text/plain
 fcl/freebsd/syncobjs.pp svneol=native#text/plain
 fcl/go32v2/custapp.inc svneol=native#text/plain
 fcl/go32v2/eventlog.inc svneol=native#text/plain

+ 98 - 54
fcl/fpcunit/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/02/06]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/06/12]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince powerpc64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince arm-gba powerpc64-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
@@ -233,118 +233,124 @@ PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/ext
 override PACKAGE_NAME=fcl
 PACKAGEDIR_MAIN:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))))
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+override TARGET_UNITS+=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_EXAMPLEDIRS+=exampletests
@@ -382,6 +388,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_EXAMPLEDIRS+=exampletests
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
@@ -457,6 +466,9 @@ endif
 ifeq ($(FULL_TARGET),arm-wince)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_EXAMPLEDIRS+=exampletests
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override TARGET_EXAMPLEDIRS+=exampletests
 endif
@@ -497,6 +509,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override COMPILER_OPTIONS+=-S2h
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_OPTIONS+=-S2h
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override COMPILER_OPTIONS+=-S2h
 endif
@@ -572,6 +587,9 @@ endif
 ifeq ($(FULL_TARGET),arm-wince)
 override COMPILER_OPTIONS+=-S2h
 endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_OPTIONS+=-S2h
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_OPTIONS+=-S2h
 endif
@@ -611,6 +629,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override COMPILER_TARGETDIR+=../$(OS_TARGET)
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_TARGETDIR+=../$(OS_TARGET)
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 override COMPILER_TARGETDIR+=../$(OS_TARGET)
 endif
@@ -686,6 +707,9 @@ endif
 ifeq ($(FULL_TARGET),arm-wince)
 override COMPILER_TARGETDIR+=../$(OS_TARGET)
 endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_TARGETDIR+=../$(OS_TARGET)
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_TARGETDIR+=../$(OS_TARGET)
 endif
@@ -897,6 +921,7 @@ STATICLIBEXT=.a
 SHAREDLIBEXT=.so
 SHAREDLIBPREFIX=libfp
 STATICLIBPREFIX=libp
+IMPORTLIBPREFIX=libimp
 RSTEXT=.rst
 ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
 ifeq ($(OS_TARGET),go32v1)
@@ -1009,6 +1034,11 @@ EXEEXT=
 HASSHAREDLIB=1
 SHORTSUFFIX=dwn
 endif
+ifeq ($(OS_TARGET),gba)
+EXEEXT=.gba
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gba
+endif
 else
 ifeq ($(OS_TARGET),go32v1)
 PPUEXT=.pp1
@@ -1329,12 +1359,17 @@ endif
 endif
 export ZIPPROG
 ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
 TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(TARPROG),)
 TARPROG= __missing_command_TARPROG
 else
 TARPROG:=$(firstword $(TARPROG))
 endif
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
 endif
 export TARPROG
 ASNAME=$(BINUTILSPREFIX)as
@@ -1458,6 +1493,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 REQUIRE_PACKAGES_RTL=1
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 REQUIRE_PACKAGES_RTL=1
 endif
@@ -1533,6 +1571,9 @@ endif
 ifeq ($(FULL_TARGET),arm-wince)
 REQUIRE_PACKAGES_RTL=1
 endif
+ifeq ($(FULL_TARGET),arm-gba)
+REQUIRE_PACKAGES_RTL=1
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
 endif
@@ -1568,6 +1609,9 @@ endif
 ifneq ($(OS_TARGET),$(OS_SOURCE))
 override FPCOPT+=-T$(OS_TARGET)
 endif
+ifneq ($(CPU_TARGET),$(CPU_SOURCE))
+override FPCOPT+=-P$(CPU_TARGET)
+endif
 ifeq ($(OS_SOURCE),openbsd)
 override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
 endif
@@ -1602,14 +1646,15 @@ override FPCOPT+=-gl
 override FPCOPTDEF+=DEBUG
 endif
 ifdef RELEASE
+ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
 ifeq ($(CPU_TARGET),i386)
 FPCCPUOPT:=-OG2p3
-else
+endif
 ifeq ($(CPU_TARGET),powerpc)
 FPCCPUOPT:=-O1r
-else
-FPCCPUOPT:=
 endif
+else
+FPCCPUOPT:=-O2
 endif
 override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
 override FPCOPTDEF+=RELEASE
@@ -1618,9 +1663,7 @@ ifdef STRIP
 override FPCOPT+=-Xs
 endif
 ifdef OPTIMIZE
-ifeq ($(CPU_TARGET),i386)
-override FPCOPT+=-OG2p3
-endif
+override FPCOPT+=-O2
 endif
 ifdef VERBOSE
 override FPCOPT+=-vwni
@@ -1664,11 +1707,6 @@ override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
 override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
 endif
 endif
-ifeq ($(OS_TARGET),linux)
-ifeq ($(FPC_VERSION),1.0.6)
-override FPCOPTDEF+=HASUNIX
-endif
-endif
 ifdef CREATESHARED
 override FPCOPT+=-Cg
 ifeq ($(CPU_TARGET),i386)
@@ -1725,7 +1763,7 @@ ifneq ($(TARGET_EXAMPLES),)
 HASEXAMPLES=1
 override EXAMPLESOURCEFILES:=$(wildcard $(addsuffix .pp,$(TARGET_EXAMPLES)) $(addsuffix .pas,$(TARGET_EXAMPLES)) $(addsuffix .lpr,$(TARGET_EXAMPLES)) $(addsuffix .dpr,$(TARGET_EXAMPLES)))
 override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(TARGET_EXAMPLES))
-override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(TARGET_EXAMPLES)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES)))
+override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(TARGET_EXAMPLES)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES)))
 override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
 ifeq ($(OS_TARGET),os2)
 override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES))
@@ -1819,7 +1857,7 @@ ifdef INSTALL_BUILDUNIT
 override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
 endif
 ifdef INSTALLPPUFILES
-override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
 ifneq ($(UNITTARGETDIRPREFIX),)
 override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
 override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
@@ -1889,7 +1927,7 @@ ifdef CLEAN_UNITS
 override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
 endif
 ifdef CLEANPPUFILES
-override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
 ifdef DEBUGSYMEXT
 override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
 endif
@@ -2090,6 +2128,9 @@ endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
+ifeq ($(FULL_TARGET),i386-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
+endif
 ifeq ($(FULL_TARGET),i386-emx)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
@@ -2165,6 +2206,9 @@ endif
 ifeq ($(FULL_TARGET),arm-wince)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif
+ifeq ($(FULL_TARGET),arm-gba)
+TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 TARGET_EXAMPLEDIRS_EXAMPLETESTS=1
 endif

+ 1 - 1
fcl/fpcunit/Makefile.fpc

@@ -6,7 +6,7 @@
 main=fcl
 
 [target]
-units=fpcunit  testregistry  testreport testutils testdecorator ubmockobject
+units=fpcunit testregistry testreport testutils testdecorator ubmockobject xmlreporter
 exampledirs=exampletests
 
 [compiler]

+ 23 - 16
fcl/fpcunit/demo/consolerunner/testrunner.pp

@@ -1,5 +1,3 @@
-{$mode objfpc}
-{$h+}
 {
     This file is part of the Free Component Library (FCL)
     Copyright (c) 2004 by Dean Zobec, Michael Van Canneyt
@@ -12,28 +10,33 @@
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
+}
 program testrunner;
+
+{$mode objfpc}
+{$h+}
+
 uses
-  custapp, classes, SysUtils, fpcunit, suiteconfig, testreport, testregistry;
+  custapp, Classes, SysUtils, fpcunit, suiteconfig, xmlreporter, testregistry;
+
 
-Const
+const
   ShortOpts = 'alh';
-  Longopts : Array[1..5] of String = (
+  Longopts: Array[1..5] of String = (
     'all','list','format:','suite:','help');
-  Version = 'Version 0.1';
+  Version = 'Version 0.2';
 
-Type
+
+type
   TTestRunner = Class(TCustomApplication)
   private
     FXMLResultsWriter: TXMLResultsWriter;
   protected
-    procedure DoRun ; Override;
-    procedure doTestRun(aTest: TTest); virtual;
+    procedure   DoRun ; Override;
+    procedure   doTestRun(aTest: TTest); virtual;
   public
     constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
+    destructor  Destroy; override;
   end;
 
 
@@ -43,11 +46,13 @@ begin
   FXMLResultsWriter := TXMLResultsWriter.Create;
 end;
 
+
 destructor TTestRunner.Destroy;
 begin
   FXMLResultsWriter.Free;
 end;
 
+
 procedure TTestRunner.doTestRun(aTest: TTest);
 var
   testResult: TTestResult;
@@ -55,7 +60,6 @@ begin
   testResult := TTestResult.Create;
   try
     testResult.AddListener(FXMLResultsWriter);
-    FXMLResultsWriter.WriteHeader;
     aTest.Run(testResult);
     FXMLResultsWriter.WriteResult(testResult);
   finally
@@ -63,6 +67,7 @@ begin
   end;
 end;
 
+
 procedure TTestRunner.DoRun;
 var
   I : Integer;
@@ -119,13 +124,15 @@ begin
 end;
 
 
-Var
-  App : TTestRunner;
+var
+  App: TTestRunner;
+
 
 begin
-  App:=TTestRunner.Create(Nil);
+  App := TTestRunner.Create(nil);
   App.Initialize;
   App.Title := 'FPCUnit Console Test Case runner.';
   App.Run;
   App.Free;
 end.
+

+ 213 - 0
fcl/fpcunit/xmlreporter.pas

@@ -0,0 +1,213 @@
+{
+  Copyright (C) 2006 Graeme Geldenhuys <[email protected]>
+
+  This source is free software; you can redistribute it and/or modify it under
+  the terms of the GNU General Public License as published by the Free
+  Software Foundation; either version 2 of the License, or (at your option)
+  any later version.
+
+  This code is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+  details.
+
+  A copy of the GNU General Public License is available on the World Wide Web
+  at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing
+  to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+  MA 02111-1307, USA.
+  
+
+  Purpose:
+    This unit contains a XML TestListener for use with the fpcUnit testing
+    framework.  It uses the XMLWrite unit, which is part of FPC, to generate
+    the XML document. The benefit of using the XMLWrite unit, is that the
+    data generated is valid XML, with resevered characters correctly escaped.
+    This allows the XML document to be further processed with XSTL etc without
+    any issues.
+
+}
+
+unit xmlreporter;
+
+{$mode objfpc}{$H+}
+
+interface
+uses
+  Classes
+  ,SysUtils
+  ,fpcUnit
+  ,TestUtils
+  ,dom
+  ,XMLWrite
+  ;
+  
+
+type
+  { XML Test Listner }
+  TXMLResultsWriter = class(TNoRefCountObject, ITestListener)
+  private
+    FDoc: TXMLDocument;
+    { These TDOMNodes are for easy access and a bit of optimization }
+    FResults: TDOMNode;
+    FListing: TDOMNode;
+    FFailures: TDOMNode;
+    FErrors: TDOMNode;
+    { Converts the actual test results into XML nodes. This gets called
+      by the public method WriteResult. }
+    procedure   TestResultAsXML(pTestResult: TTestResult);
+    { This gets called in the class constructor and sets up the starting nodes }
+    procedure   WriteHeader;
+  public
+    constructor Create;
+    destructor  Destroy; override;
+    procedure   WriteResult(aResult: TTestResult);
+
+    { ITestListener interface requirements }
+    procedure   AddFailure(ATest: TTest; AFailure: TTestFailure);
+    procedure   AddError(ATest: TTest; AError: TTestFailure);
+    procedure   StartTest(ATest: TTest);
+    procedure   EndTest(ATest: TTest);
+    
+    { A public property to the internal XML document }
+    property    Document: TXMLDocument read FDoc;
+  end;
+
+
+implementation
+
+
+{ TXMLResultsWriter }
+
+procedure TXMLResultsWriter.TestResultAsXML(pTestResult: TTestResult);
+var
+  i: longint;
+  n, lResults: TDOMNode;
+begin
+  lResults := FDoc.FindNode('TestResults');
+  n := FDoc.CreateElement('NumberOfRunnedTests');
+  n.AppendChild(FDoc.CreateTextNode(IntToStr(pTestResult.RunTests)));
+  lResults.AppendChild(n);
+
+  n := FDoc.CreateElement('NumberOfErrors');
+  n.AppendChild(FDoc.CreateTextNode(IntToStr(pTestResult.NumberOfErrors)));
+  lResults.AppendChild(n);
+
+  n := FDoc.CreateElement('NumberOfFailures');
+  n.AppendChild(FDoc.CreateTextNode(IntToStr(pTestResult.NumberOfFailures)));
+  lResults.AppendChild(n);
+  
+  if pTestResult.NumberOfErrors <> 0 then
+  begin
+    for i := 0 to pTestResult.Errors.Count - 1 do
+      AddError(nil, TTestFailure(pTestResult.Errors.Items[i]));
+  end;
+
+  if pTestResult.NumberOfFailures <> 0 then
+  begin
+    for i := 0 to pTestResult.Failures.Count - 1 do
+      AddFailure(nil, TTestFailure(pTestResult.Failures.Items[i]));
+  end;
+end;
+
+
+procedure TXMLResultsWriter.WriteHeader;
+begin
+  FResults := FDoc.CreateElement('TestResults');
+  FResults.AppendChild(FDoc.CreateComment(' Generated using FPCUnit on '
+      + FormatDateTime('yyyy-mm-dd hh:mm ', Now) ));
+  FDoc.AppendChild(FResults);
+  FListing := FDoc.CreateElement('TestListing');
+  FResults.AppendChild(FListing);
+end;
+
+
+constructor TXMLResultsWriter.Create;
+begin
+  FDoc        := TXMLDocument.Create;
+  FResults    := nil;
+  FFailures   := nil;
+  FErrors     := nil;
+  WriteHeader;
+end;
+
+
+destructor TXMLResultsWriter.Destroy;
+begin
+  FDoc.Free;
+  inherited Destroy;
+end;
+
+
+procedure TXMLResultsWriter.WriteResult(aResult: TTestResult);
+begin
+  TestResultAsXML(aResult);
+end;
+
+
+procedure TXMLResultsWriter.AddFailure(ATest: TTest; AFailure: TTestFailure);
+var
+  n: TDOMElement;
+begin
+  { Try and find the node first }
+  if not Assigned(FFailures) then
+    FFailures := FDoc.FindNode('ListOfFailures');
+  { If we couldn't find it, create it }
+  if not Assigned(FFailures) then
+  begin
+    FFailures := FDoc.CreateElement('ListOfFailures');
+    FResults.AppendChild(FFailures);
+  end;
+  
+  n := FDoc.CreateElement('Failure');
+  n.AppendChild(FDoc.CreateElement('Message')         ).AppendChild(FDoc.CreateTextNode(AFailure.AsString));
+  n.AppendChild(FDoc.CreateElement('ExceptionClass')  ).AppendChild(FDoc.CreateTextNode(AFailure.ExceptionClassName));
+  n.AppendChild(FDoc.CreateElement('ExceptionMessage')).AppendChild(FDoc.CreateTextNode(AFailure.ExceptionMessage));
+  FFailures.AppendChild(n);
+end;
+
+
+procedure TXMLResultsWriter.AddError(ATest: TTest; AError: TTestFailure);
+var
+  n: TDOMElement;
+begin
+  { Try and find the node first }
+  if not Assigned(FErrors) then
+    FErrors := FDoc.FindNode('ListOfErrors');
+  { If we couldn't find it, create it }
+  if not Assigned(FErrors) then
+  begin
+    FErrors := FDoc.CreateElement('ListOfErrors');
+    FResults.AppendChild(FErrors);
+  end;
+
+  n := FDoc.CreateElement('Error');
+  n.AppendChild(FDoc.CreateElement('Message')         ).AppendChild(FDoc.CreateTextNode(AError.AsString));
+  n.AppendChild(FDoc.CreateElement('ExceptionClass')  ).AppendChild(FDoc.CreateTextNode(AError.ExceptionClassName));
+  n.AppendChild(FDoc.CreateElement('ExceptionMessage')).AppendChild(FDoc.CreateTextNode(AError.ExceptionMessage));
+  n.AppendChild(FDoc.CreateElement('SourceUnitName')  ).AppendChild(FDoc.CreateTextNode(AError.SourceUnitName));
+  n.AppendChild(FDoc.CreateElement('LineNumber')      ).AppendChild(FDoc.CreateTextNode(IntToStr(AError.LineNumber)));
+  n.AppendChild(FDoc.CreateElement('FailedMethodName')).AppendChild(FDoc.CreateTextNode(AError.FailedMethodName));
+  FErrors.AppendChild(n);
+end;
+
+
+procedure TXMLResultsWriter.StartTest(ATest: TTest);
+var
+  n: TDOMElement;
+begin
+  if not Assigned(FListing) then
+    exit;
+  n := FDoc.CreateElement('Test');
+  n['Name'] := ATest.TestSuiteName + '.' + ATest.TestName;
+  FListing.AppendChild(n);
+end;
+
+
+procedure TXMLResultsWriter.EndTest(ATest: TTest);
+begin
+  { do nothing }
+end;
+
+
+end.
+