test: moved bugtestcase to runtest project

git-svn-id: trunk@10558 -
This commit is contained in:
vincents 2007-02-01 14:30:50 +00:00
parent f060c5cd2a
commit 5c89a11221
9 changed files with 83 additions and 103 deletions

4
.gitattributes vendored
View File

@ -2838,9 +2838,7 @@ test/bugs/7462/expected.txt svneol=native#text/plain
test/bugs/7462/unit1.lfm svneol=native#text/plain test/bugs/7462/unit1.lfm svneol=native#text/plain
test/bugs/7462/unit1.lrs svneol=native#text/plain test/bugs/7462/unit1.lrs svneol=native#text/plain
test/bugs/7462/unit1.pas svneol=native#text/plain test/bugs/7462/unit1.pas svneol=native#text/plain
test/bugs/bugtestcase.pas svneol=native#text/plain test/bugtestcase.pas svneol=native#text/plain
test/bugs/runbugtestcases.lpi svneol=native#text/plain
test/bugs/runbugtestcases.lpr svneol=native#text/plain
test/hello.ahk svneol=native#text/plain test/hello.ahk svneol=native#text/plain
test/readme.txt svneol=native#text/plain test/readme.txt svneol=native#text/plain
test/runtests.lpi svneol=native#text/plain test/runtests.lpi svneol=native#text/plain

View File

@ -1,60 +0,0 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="5"/>
<General>
<SessionStorage Value="InIDEConfig"/>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=".exe"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="3">
<Item1>
<PackageName Value="LCL"/>
</Item1>
<Item2>
<PackageName Value="FPCUnitTestRunner"/>
</Item2>
<Item3>
<PackageName Value="FCL"/>
</Item3>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="runbugtestcases.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="runbugtestcases"/>
</Unit0>
<Unit1>
<Filename Value="bugtestcase.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BugTestCase"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</CONFIG>

View File

@ -1,13 +0,0 @@
program runbugtestcases;
{$mode objfpc}{$H+}
uses
Interfaces, Forms, GuiTestRunner, BugTestCase;
begin
Application.Initialize;
Application.CreateForm(TGuiTestRunner, TestRunner);
Application.Run;
end.

View File

@ -1,3 +1,21 @@
{ $Id$}
{ Copyright (C) 2007 Vincent Snijders
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.
}
unit BugTestCase; unit BugTestCase;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
@ -5,7 +23,8 @@ unit BugTestCase;
interface interface
uses uses
Classes, SysUtils, Math, process, fileutil, fpcunit, testutils, testregistry; Classes, SysUtils, Math, process, fileutil, fpcunit, testutils, testregistry,
TestGlobals;
type type
@ -15,9 +34,6 @@ type
private private
FPath: string; FPath: string;
FProjectFile: string; FProjectFile: string;
protected
procedure SetUp; override;
procedure TearDown; override;
public public
constructor Create(APath, ATestName: string); reintroduce; constructor Create(APath, ATestName: string); reintroduce;
class function CreateSuite(Path: string) : TTestSuite; class function CreateSuite(Path: string) : TTestSuite;
@ -28,9 +44,6 @@ type
procedure HeaptrcLog; procedure HeaptrcLog;
end; end;
var
Compiler: string;
implementation implementation
const const
@ -103,7 +116,7 @@ var
begin begin
AssertTrue('Project file '+ FProjectFile + ' does not exist', AssertTrue('Project file '+ FProjectFile + ' does not exist',
FileExists(FProjectFile)); FileExists(FProjectFile));
LazarusDir := ExpandFileName(ExtractFilePath(ParamStr(0)) + '../../'); LazarusDir := ExpandFileName(ExtractFilePath(ParamStr(0)) + '../');
LazBuildPath := LazarusDir + 'lazbuild' + GetExeExt; LazBuildPath := LazarusDir + 'lazbuild' + GetExeExt;
AssertTrue(LazBuildPath + ' does not exist', FileExists(LazBuildPath)); AssertTrue(LazBuildPath + ' does not exist', FileExists(LazBuildPath));
LazBuild := TProcess.Create(nil); LazBuild := TProcess.Create(nil);
@ -186,14 +199,6 @@ begin
end; end;
procedure TBugTestCase.SetUp;
begin
end;
procedure TBugTestCase.TearDown;
begin
end;
constructor TBugTestCase.Create(APath, ATestName: string); constructor TBugTestCase.Create(APath, ATestName: string);
begin begin
CreateWithName(ATestName); CreateWithName(ATestName);
@ -217,15 +222,18 @@ procedure GatherTests;
var var
ProgPath: string; ProgPath: string;
SearchRec: TSearchRec; SearchRec: TSearchRec;
BugsTestSuite: TTestSuite;
begin begin
ProgPath := ExtractFilePath(ParamStr(0)); BugsTestSuite := TTestSuite.Create('Bugs');
GetTestRegistry.AddTest(BugsTestSuite);
ProgPath := ExtractFilePath(ParamStr(0)) + 'bugs' + pathdelim;
if FindFirst(ProgPath+'*', faAnyFile, SearchRec)=0 then if FindFirst(ProgPath+'*', faAnyFile, SearchRec)=0 then
repeat repeat
if (SearchRec.Attr and (faDirectory + faHidden)=faDirectory) and if (SearchRec.Attr and (faDirectory + faHidden)=faDirectory) and
(SearchRec.Name<>'.') and (SearchRec.Name<>'..') and (SearchRec.Name<>'.') and (SearchRec.Name<>'..') and
(SearchRec.Name<>'.svn') (SearchRec.Name<>'.svn')
then then
GetTestRegistry.AddTest( BugsTestSuite.AddTest(
TBugTestCase.CreateSuite(ProgPath+SearchRec.Name)); TBugTestCase.CreateSuite(ProgPath+SearchRec.Name));
until FindNext(SearchRec)<>0; until FindNext(SearchRec)<>0;
FindClose(SearchRec); FindClose(SearchRec);

View File

@ -32,7 +32,7 @@
<PackageName Value="FCL"/> <PackageName Value="FCL"/>
</Item3> </Item3>
</RequiredPackages> </RequiredPackages>
<Units Count="3"> <Units Count="4">
<Unit0> <Unit0>
<Filename Value="runtests.lpr"/> <Filename Value="runtests.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@ -48,6 +48,11 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="FPCUnitProject1"/> <UnitName Value="FPCUnitProject1"/>
</Unit2> </Unit2>
<Unit3>
<Filename Value="bugtestcase.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="BugTestCase"/>
</Unit3>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -1,4 +1,4 @@
{ $Id: $} { $Id$}
{ Copyright (C) 2006 Vincent Snijders { Copyright (C) 2006 Vincent Snijders
This source is free software; you can redistribute it and/or modify it under This source is free software; you can redistribute it and/or modify it under
@ -21,7 +21,8 @@ program runtests;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
uses uses
Classes, TestLpi, consoletestrunner; Classes, consoletestrunner,
testglobals, TestLpi, BugTestCase;
type type

View File

@ -32,7 +32,7 @@
<PackageName Value="FCL"/> <PackageName Value="FCL"/>
</Item3> </Item3>
</RequiredPackages> </RequiredPackages>
<Units Count="2"> <Units Count="3">
<Unit0> <Unit0>
<Filename Value="runtestsgui.lpr"/> <Filename Value="runtestsgui.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@ -43,6 +43,11 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="TestLpi"/> <UnitName Value="TestLpi"/>
</Unit1> </Unit1>
<Unit2>
<Filename Value="testglobals.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="testglobals"/>
</Unit2>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -1,9 +1,29 @@
{ $Id$}
{ Copyright (C) 2006 Vincent Snijders
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.
}
program runtestsgui; program runtestsgui;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
uses uses
Interfaces, Forms, GuiTestRunner, TestLpi; Interfaces, Forms,
GuiTestRunner,
TestLpi, BugTestCase;
begin begin
Application.Title:='Run Lazarus tests'; Application.Title:='Run Lazarus tests';

View File

@ -1,3 +1,21 @@
{ $Id$}
{ Copyright (C) 2006 Vincent Snijders
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.
}
unit TestLpi; unit TestLpi;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
@ -5,7 +23,8 @@ unit TestLpi;
interface interface
uses uses
Classes, SysUtils, fpcunit, testregistry, process, FileUtil; Classes, SysUtils, fpcunit, testregistry, process, FileUtil,
TestGlobals;
type type
@ -24,9 +43,6 @@ type
procedure TestRun; procedure TestRun;
end; end;
var
Compiler: string;
implementation implementation
var var