Browse Source

* 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 -
joost 17 years ago
parent
commit
f83f7785ad
2 changed files with 20 additions and 6 deletions
  1. 15 2
      tests/utils/dbdigest.pp
  2. 5 4
      tests/utils/dbtests.pp

+ 15 - 2
tests/utils/dbdigest.pp

@@ -75,6 +75,7 @@ TConfigOpt = (
   coMachine,
   coComment,
   coTestSrcDir,
+  coRelSrcDir,
   coVerbose
  );
 
@@ -95,11 +96,12 @@ ConfigStrings : Array [TConfigOpt] of string = (
   'machine',
   'comment',
   'testsrcdir',
+  'relsrcdir',
   'verbose'
 );
 
 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
   TestOS,
@@ -154,7 +156,15 @@ begin
         TestSrcDir:=Value;
 	if (TestSrcDir<>'') and (TestSrcDir[length(TestSrcDir)]<>'/') then
 	  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;
 
@@ -194,6 +204,9 @@ Var
   I : Integer;
 
 begin
+  // Set the default value for old digests without RelSrcDir to the rtl/compiler
+  // testsuite
+  RelSrcDir:='tests/';
   If Not FileExists(FN) Then
     Exit;
   Verbose(V_DEBUG,'Parsing config file: '+FN);

+ 5 - 4
tests/utils/dbtests.pp

@@ -50,8 +50,9 @@ Function  EscapeSQL( S : String) : String;
 Function SQLDate(D : TDateTime) : String;
 
 var
+  RelSrcDir,
   TestSrcDir : string;
-  
+
 Implementation
 
 Uses
@@ -287,7 +288,7 @@ begin
     path := '.';
     end;
   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
     FileName := FileName + '.pas'
   else if FileExists(FileName+'.pp') then
@@ -341,8 +342,8 @@ Var
 
 begin
   Result:=-1;
-  If (FileExists(TestSrcDir+Name) and
-     GetConfig(TestSrcDir+Name,Info)) or
+  If (FileExists(TestSrcDir+RelSrcDir+Name) and
+     GetConfig(TestSrcDir+RelSrcDir+Name,Info)) or
      GetUnitTestConfig(Name,Info) then
     begin
     If RunQuery(Format(SInsertTest,[Name]),Res) then