Browse Source

+ Patch from Graeme Geldenhuys: New testlistener

git-svn-id: trunk@3997 -
michael 19 years ago
parent
commit
358b453f7b
3 changed files with 88 additions and 58 deletions
  1. 64 41
      fcl/fpcunit/Makefile
  2. 1 1
      fcl/fpcunit/Makefile.fpc
  3. 23 16
      fcl/fpcunit/demo/consolerunner/testrunner.pp

+ 64 - 41
fcl/fpcunit/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/04/23]
+# 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-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 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,121 +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
+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
@@ -463,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
@@ -581,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
@@ -698,6 +707,9 @@ endif
 ifeq ($(FULL_TARGET),arm-wince)
 override COMPILER_TARGETDIR+=.
 endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_TARGETDIR+=.
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_TARGETDIR+=.
 endif
@@ -1022,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
@@ -1554,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
@@ -2186,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.
+