mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 23:08:05 +02:00
tests: add --compiler command line parameter for console test runner
git-svn-id: trunk@9938 -
This commit is contained in:
parent
9ac129d1e1
commit
9ff0b4344f
@ -3,13 +3,14 @@ program runtests;
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
custapp, Classes, SysUtils, fpcunit, testregistry,
|
||||
dom, testreport, xmlreporter, xmlwrite,
|
||||
custapp, Classes, SysUtils, fpcunit, testregistry, testreport,
|
||||
xmlreporter, xmlwrite,
|
||||
TestLpi;
|
||||
|
||||
const
|
||||
ShortOpts = 'alh';
|
||||
Longopts: array[1..5] of string = ('all', 'list', 'format:', 'suite:', 'help');
|
||||
Longopts: array[1..6] of string =
|
||||
('all', 'list', 'format:', 'suite:', 'compiler:', 'help');
|
||||
Version = 'Version 0.1';
|
||||
|
||||
type
|
||||
@ -97,16 +98,17 @@ var
|
||||
writeln('Usage: ');
|
||||
writeln(' --format=latex output as latex source (only list implemented)');
|
||||
{$IFNDEF VER2_0}
|
||||
writeln(' --format=plain output as plain ASCII source');
|
||||
writeln(' --format=plain output as plain ASCII source');
|
||||
{$ENDIF}
|
||||
writeln(' --format=xml output as XML source (default)');
|
||||
writeln;
|
||||
writeln(' -l or --list show a list of registered tests');
|
||||
writeln(' -a or --all run all tests');
|
||||
writeln(' --suite=MyTestSuiteName run single test suite class');
|
||||
writeln(' --compiler=<ppcxxx> use ppcxxx to build test projects');
|
||||
writeln;
|
||||
writeln('The results can be redirected to an xml file,');
|
||||
writeln('for example: ./testrunner --all > results.xml');
|
||||
writeln('for example: ', ParamStr(0),' --all > results.xml');
|
||||
end;
|
||||
|
||||
//get the format parameter
|
||||
@ -132,6 +134,9 @@ var
|
||||
Write(GetSuiteAsXML(GetTestRegistry));
|
||||
end;
|
||||
|
||||
if HasOption('compiler') then
|
||||
Compiler := GetOptionValue('compiler');
|
||||
|
||||
//run the tests
|
||||
if HasOption('a', 'all') then
|
||||
doTestRun(GetTestRegistry)
|
||||
|
@ -25,6 +25,9 @@ type
|
||||
procedure TestRun;
|
||||
end;
|
||||
|
||||
var
|
||||
Compiler: string;
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
@ -87,7 +90,6 @@ var
|
||||
begin
|
||||
Result := TTestSuite.Create('Examples');
|
||||
SearchMask := ExamplesDir + '*.lpi';
|
||||
writeln(stdout, SearchMask+LineEnding);
|
||||
if FindFirst(SearchMask,faAnyFile,FileInfo)=0 then begin
|
||||
repeat
|
||||
if RightStr(FileInfo.Name,4)='.lpi' then
|
||||
@ -108,7 +110,10 @@ begin
|
||||
try
|
||||
LazBuild.Options := [poNewConsole];
|
||||
LazBuild.ShowWindow := swoHIDE;
|
||||
LazBuild.CommandLine := LazBuildPath + ' ' + FPath;
|
||||
LazBuild.CommandLine := LazBuildPath;
|
||||
if Compiler<>'' then
|
||||
LazBuild.CommandLine := LazBuild.CommandLine + ' --compiler='+Compiler;
|
||||
LazBuild.CommandLine := LazBuild.CommandLine + ' ' + FPath;
|
||||
LazBuild.CurrentDirectory := ExtractFileDir(FPath);
|
||||
LazBuild.Execute;
|
||||
LazBuild.WaitOnExit;
|
||||
|
Loading…
Reference in New Issue
Block a user