mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 11:09:19 +02:00
* Add RelSrcDir setting with a default value of "tests", to specify in which directory the test-sources reside, relative to the TestSrcDir
git-svn-id: trunk@9886 -
This commit is contained in:
parent
319a2cdba2
commit
f83f7785ad
@ -75,6 +75,7 @@ TConfigOpt = (
|
|||||||
coMachine,
|
coMachine,
|
||||||
coComment,
|
coComment,
|
||||||
coTestSrcDir,
|
coTestSrcDir,
|
||||||
|
coRelSrcDir,
|
||||||
coVerbose
|
coVerbose
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -95,11 +96,12 @@ ConfigStrings : Array [TConfigOpt] of string = (
|
|||||||
'machine',
|
'machine',
|
||||||
'comment',
|
'comment',
|
||||||
'testsrcdir',
|
'testsrcdir',
|
||||||
|
'relsrcdir',
|
||||||
'verbose'
|
'verbose'
|
||||||
);
|
);
|
||||||
|
|
||||||
ConfigOpts : Array[TConfigOpt] of char
|
ConfigOpts : Array[TConfigOpt] of char
|
||||||
= ('d','h','u','p','l','o','c','a','v','t','s','m','C','S','V');
|
= ('d','h','u','p','l','o','c','a','v','t','s','m','C','S','r','V');
|
||||||
|
|
||||||
Var
|
Var
|
||||||
TestOS,
|
TestOS,
|
||||||
@ -155,6 +157,14 @@ begin
|
|||||||
if (TestSrcDir<>'') and (TestSrcDir[length(TestSrcDir)]<>'/') then
|
if (TestSrcDir<>'') and (TestSrcDir[length(TestSrcDir)]<>'/') then
|
||||||
TestSrcDir:=TestSrcDir+'/';
|
TestSrcDir:=TestSrcDir+'/';
|
||||||
end;
|
end;
|
||||||
|
coRelSrcDir :
|
||||||
|
begin
|
||||||
|
RelSrcDir:=Value;
|
||||||
|
if (RelSrcDir<>'') and (RelSrcDir[length(RelSrcDir)]<>'/') then
|
||||||
|
RelSrcDir:=RelSrcDir+'/';
|
||||||
|
if (RelSrcDir<>'') and (RelSrcDir[1]='/') then
|
||||||
|
RelSrcDir:=copy(RelSrcDir,2,length(RelSrcDir)-1);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -194,6 +204,9 @@ Var
|
|||||||
I : Integer;
|
I : Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
// Set the default value for old digests without RelSrcDir to the rtl/compiler
|
||||||
|
// testsuite
|
||||||
|
RelSrcDir:='tests/';
|
||||||
If Not FileExists(FN) Then
|
If Not FileExists(FN) Then
|
||||||
Exit;
|
Exit;
|
||||||
Verbose(V_DEBUG,'Parsing config file: '+FN);
|
Verbose(V_DEBUG,'Parsing config file: '+FN);
|
||||||
|
@ -50,6 +50,7 @@ Function EscapeSQL( S : String) : String;
|
|||||||
Function SQLDate(D : TDateTime) : String;
|
Function SQLDate(D : TDateTime) : String;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
RelSrcDir,
|
||||||
TestSrcDir : string;
|
TestSrcDir : string;
|
||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
@ -287,7 +288,7 @@ begin
|
|||||||
path := '.';
|
path := '.';
|
||||||
end;
|
end;
|
||||||
if upper(ClassName[1])<>'T' then exit;
|
if upper(ClassName[1])<>'T' then exit;
|
||||||
FileName := lowercase(TestSrcDir+Path+DirectorySeparator+copy(ClassName,2,length(classname)));
|
FileName := lowercase(TestSrcDir+RelSrcDir+Path+DirectorySeparator+copy(ClassName,2,length(classname)));
|
||||||
if FileExists(FileName+'.pas') then
|
if FileExists(FileName+'.pas') then
|
||||||
FileName := FileName + '.pas'
|
FileName := FileName + '.pas'
|
||||||
else if FileExists(FileName+'.pp') then
|
else if FileExists(FileName+'.pp') then
|
||||||
@ -341,8 +342,8 @@ Var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=-1;
|
Result:=-1;
|
||||||
If (FileExists(TestSrcDir+Name) and
|
If (FileExists(TestSrcDir+RelSrcDir+Name) and
|
||||||
GetConfig(TestSrcDir+Name,Info)) or
|
GetConfig(TestSrcDir+RelSrcDir+Name,Info)) or
|
||||||
GetUnitTestConfig(Name,Info) then
|
GetUnitTestConfig(Name,Info) then
|
||||||
begin
|
begin
|
||||||
If RunQuery(Format(SInsertTest,[Name]),Res) then
|
If RunQuery(Format(SInsertTest,[Name]),Res) then
|
||||||
|
Loading…
Reference in New Issue
Block a user