Browse Source

--- Merging r14771 into 'tests/utils':
U tests/utils/dbtests.pp
U tests/utils/dbdigest.pp
--- Merging r14774 into 'tests/utils':
C tests/utils/Makefile
--- Merging r14777 into 'tests/utils':
G tests/utils/dbdigest.pp
--- Merging r14778 into 'tests/utils':
U tests/utils/testfail.pp
U tests/utils/fptime.pp
Summary of conflicts:
Text conflicts: 1

# revisions: 14771,14774,14777,14778
------------------------------------------------------------------------
r14771 | pierre | 2010-01-22 16:33:34 +0100 (Fri, 22 Jan 2010) | 1 line
Changed paths:
M /trunk/tests/utils/dbdigest.pp
M /trunk/tests/utils/dbtests.pp

+ Add explicit Port for mysql connection
------------------------------------------------------------------------
------------------------------------------------------------------------
r14774 | pierre | 2010-01-22 17:03:40 +0100 (Fri, 22 Jan 2010) | 1 line
Changed paths:
M /trunk/tests/utils/Makefile

+ Update for correct cleaning of dbdigest executable
------------------------------------------------------------------------
------------------------------------------------------------------------
r14777 | pierre | 2010-01-23 00:09:02 +0100 (Sat, 23 Jan 2010) | 1 line
Changed paths:
M /trunk/tests/utils/dbdigest.pp

* Add some additional fields to testrun table
------------------------------------------------------------------------
------------------------------------------------------------------------
r14778 | pierre | 2010-01-23 00:32:51 +0100 (Sat, 23 Jan 2010) | 1 line
Changed paths:
M /trunk/tests/utils/fptime.pp
M /trunk/tests/utils/testfail.pp

* remove two warnings
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_4@16435 -

marco 14 years ago
parent
commit
d882d666f9
6 changed files with 110 additions and 23 deletions
  1. 1 1
      tests/Makefile
  2. 1 1
      tests/utils/Makefile
  3. 90 10
      tests/utils/dbdigest.pp
  4. 17 10
      tests/utils/dbtests.pp
  5. 1 0
      tests/utils/fptime.pp
  6. 0 1
      tests/utils/testfail.pp

+ 1 - 1
tests/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/08/25]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/11/23]
 #
 default: allexectests
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux

+ 1 - 1
tests/utils/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/08/25]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/11/23]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux

+ 90 - 10
tests/utils/dbdigest.pp

@@ -65,6 +65,7 @@ TConfigOpt = (
   soHost,
   coUserName,
   coPassword,
+  coPort,
   coLogFile,
   coOS,
   coCPU,
@@ -79,6 +80,17 @@ TConfigOpt = (
   coVerbose
  );
 
+{ Additional options only for dbdigest.cfg file }
+
+TConfigAddOpt = (
+  coCompilerDate,
+  coCompilerFullVersion,
+  coSvnCompilerRevision,
+  coSvnTestsRevision,
+  coSvnRTLRevision,
+  coSvnPackagesRevision
+ );
+
 Const
 
 ConfigStrings : Array [TConfigOpt] of string = (
@@ -86,6 +98,7 @@ ConfigStrings : Array [TConfigOpt] of string = (
   'host',
   'username',
   'password',
+  'port',
   'logfile',
   'os',
   'cpu',
@@ -100,8 +113,26 @@ ConfigStrings : Array [TConfigOpt] of string = (
   'verbose'
 );
 
+ConfigAddStrings : Array [TConfigAddOpt] of string = (
+  'compilerdate',
+  'compilerfullversion',
+  'svncompilerrevision',
+  'svntestsrevision',
+  'svntlrevision',
+  'svnpackagesrevision'
+ );
+
+ConfigAddCols : Array [TConfigAddOpt] of string = (
+  'TU_COMPILERDATE',
+  'TU_COMPILERFULLVERSION',
+  'TU_SVNCOMPILERREVIVISION',
+  'TU_SVNTESTSREVISION',
+  'TU_SVNRTLREVISION',
+  'TU_SVNPACKAGESREVISION'
+ );
+
 ConfigOpts : Array[TConfigOpt] of char
-           = ('d','h','u','p','l','o','c','a','v','t','s','m','C','S','r','V');
+           = ('d','h','u','p','P','l','o','c','a','v','t','s','m','C','S','r','V');
 
 Var
   TestOS,
@@ -112,11 +143,36 @@ Var
   HostName,
   UserName,
   Password,
+  Port,
   LogFileName,
   Submitter,
   Machine,
   Comment : String;
   TestDate : TDateTime;
+  TestCompilerDate,
+  TestCompilerFullVersion,
+  TestSvnCompilerRevision,
+  TestSvnTestsRevision,
+  TestSvnRTLRevision,
+  TestSvnPackagesRevision : String;
+
+Procedure SetAddOpt (O : TConfigAddOpt; Value : string);
+begin
+  Case O of
+    coCompilerDate:
+      TestCompilerDate:=Value;
+    coCompilerFullVersion:
+      TestCompilerFullVersion:=Value;
+    coSvnCompilerRevision:
+      TestSvnCompilerRevision:=Value;
+    coSvnTestsRevision:
+      TestSvnTestsRevision:=Value;
+    coSvnRTLRevision:
+      TestSvnRTLRevision:=Value;
+    coSvnPackagesRevision:
+      TestSvnPackagesRevision:=Value;
+  end;
+end;
 
 Procedure SetOpt (O : TConfigOpt; Value : string);
 var
@@ -127,12 +183,13 @@ begin
     soHost         : HostName:=Value;
     coUserName     : UserName:=Value;
     coPassword     : Password:=Value;
+    coPort         : Port:=Value;
     coLogFile      : LogFileName:=Value;
     coOS           : TestOS:=Value;
     coCPU          : TestCPU:=Value;
     coCategory     : TestCategory:=Value;
     coVersion      : TestVersion:=Value;
-    coDate         : 
+    coDate         :
       begin
         { Formated like YYYYMMDDhhmm }
 	if Length(value)=12 then
@@ -145,7 +202,7 @@ begin
 	    TestDate:=EncodeDate(year,month,day)+EncodeTime(hour,min,0,0);
 	  end
 	else
-	  Verbose(V_Error,'Error in date format, use YYYYMMDDhhmm');  
+	  Verbose(V_Error,'Error in date format, use YYYYMMDDhhmm');
       end;
     coSubmitter    : Submitter:=Value;
     coMachine      : Machine:=Value;
@@ -174,6 +231,7 @@ Var
   N : String;
   I : Integer;
   co : TConfigOpt;
+  coa : TConfigAddOpt;
 
 begin
   Verbose(V_DEBUG,'Processing option: '+S);
@@ -187,13 +245,22 @@ begin
       begin
       Result:=CompareText(ConfigStrings[co],N)=0;
       If Result then
-        Break;
+        begin
+          SetOpt(co,S);
+          Exit;
+        end;
+      end;
+    For coa:=low(TConfigAddOpt) to high(TConfigAddOpt) do
+      begin
+      Result:=CompareText(ConfigAddStrings[coa],N)=0;
+      If Result then
+        begin
+          SetAddOpt(coa,S);
+          Exit;
+        end;
       end;
     end;
- If Result then
-   SetOpt(co,S)
- else
-   Verbose(V_ERROR,'Unknown option : '+n+S);
+  Verbose(V_ERROR,'Unknown option : '+n+S);
 end;
 
 Procedure ProcessConfigfile(FN : String);
@@ -362,7 +429,7 @@ begin
               TestLog:=GetExecuteLog(Line);
               if pos(failed_to_compile,TestLog)=1 then
                 TestLog:=GetLog(Line);
-            end  
+            end
           else
             TestLog:='';
           AddTestResult(ID,TestRunID,Ord(TS),TestOK[TS],TestSkipped[TS],TestLog);
@@ -386,6 +453,19 @@ procedure UpdateTestRun;
     qry:='UPDATE TESTRUN SET ';
     for i:=low(TTestStatus) to high(TTestStatus) do
       qry:=qry+format('%s=%d, ',[SQLField[i],StatusCount[i]]);
+    if TestCompilerDate<>'' then
+      qry:=qry+format('%s="%s", ',[ConfigAddCols[coCompilerDate],EscapeSQL(TestCompilerDate)]);
+    if TestCompilerFullVersion<>'' then
+      qry:=qry+format('%s="%s", ',[ConfigAddCols[coCompilerFullVersion],EscapeSQL(TestCompilerFullVersion)]);
+    if TestSvnCompilerRevision<>'' then
+      qry:=qry+format('%s="%s", ',[ConfigAddCols[coSvnCompilerRevision],EscapeSQL(TestSvnCompilerRevision)]);
+    if TestSvnTestsRevision<>'' then
+      qry:=qry+format('%s="%s", ',[ConfigAddCols[coSvnTestsRevision],EscapeSQL(TestSvnTestsRevision)]);
+    if TestSvnRTLRevision<>'' then
+      qry:=qry+format('%s="%s", ',[ConfigAddCols[coSvnRTLRevision],EscapeSQL(TestSvnRTLRevision)]);
+    if TestSvnPackagesRevision<>'' then
+      qry:=qry+format('%s="%s", ',[ConfigAddCols[coSvnPackagesRevision],EscapeSQL(TestSvnPackagesRevision)]);
+
     qry:=qry+format('TU_SUBMITTER="%s", TU_MACHINE="%s", TU_COMMENT="%s", TU_DATE="%s"',[Submitter,Machine,Comment,SqlDate(TestDate)]);
     qry:=qry+' WHERE TU_ID='+format('%d',[TestRunID]);
     RunQuery(Qry,res)
@@ -397,7 +477,7 @@ begin
   ProcessCommandLine;
   If LogFileName<>'' then
     begin
-    ConnectToDatabase(DatabaseName,HostName,UserName,Password);
+    ConnectToDatabase(DatabaseName,HostName,UserName,Password,Port);
     GetIDs;
     ProcessFile(LogFileName);
     UpdateTestRun;

+ 17 - 10
tests/utils/dbtests.pp

@@ -10,7 +10,7 @@ Uses
   mysql4,
 {$else}
   mysql,
-{$endif}  
+{$endif}
   testu;
 
 { ---------------------------------------------------------------------
@@ -40,7 +40,7 @@ Function CleanTestRun(ID : Integer) : Boolean;
 Type
   TQueryResult = PMYSQL_RES;
 
-Function  ConnectToDatabase(DatabaseName,Host,User,Password : String) : Boolean;
+Function  ConnectToDatabase(DatabaseName,Host,User,Password,Port : String) : Boolean;
 Procedure DisconnectDatabase;
 Function  RunQuery (Qry : String; Var res : TQueryResult) : Boolean ;
 Procedure FreeQueryResult (Res : TQueryResult);
@@ -67,19 +67,26 @@ Var
   Connection : TMYSQL;
 
 
-Function ConnectToDatabase(DatabaseName,Host,User,Password : String) : Boolean;
+Function ConnectToDatabase(DatabaseName,Host,User,Password,Port : String) : Boolean;
 
 Var
   S : String;
-
+  PortNb : longint;
+  Error : word;
 begin
-  Verbose(V_DEBUG,'Connection params : '+DatabaseName+' '+Host+' '+User+' '+Password);
-{$ifdef ver1_0}  
+  Verbose(V_DEBUG,'Connection params : '+DatabaseName+' '+Host+' '+User+' '+Password+' '+Port);
+  if Port<>'' then
+    begin
+      Val(Port,PortNb,Error);
+      if Error<>0 then
+        PortNb:=0;
+    end;
+{$ifdef ver1_0}
   Result:=mysql_connect(@Connection,PChar(Host),PChar(User),PChar(Password))<>Nil;
-{$else}  
+{$else}
   mysql_init(@Connection);
-  Result:=mysql_real_connect(@Connection,PChar(Host),PChar(User),PChar(Password),Nil,0,Nil,0)<>Nil;
-{$endif}  
+  Result:=mysql_real_connect(@Connection,PChar(Host),PChar(User),PChar(Password),Nil,PortNb,Nil,0)<>Nil;
+{$endif}
   If Not Result then
     begin
     S:=Strpas(mysql_error(@connection));
@@ -294,7 +301,7 @@ begin
   else if FileExists(FileName+'.pp') then
     FileName := FileName + '.pp'
   else exit;
-  
+
   Verbose(V_Debug,'Reading '+FileName);
   assign(t,FileName);
   {$I-}

+ 1 - 0
tests/utils/fptime.pp

@@ -5,6 +5,7 @@ var
   ps : ansistring;
   sticks : int64;
 begin
+  ps:='';
   if paramcount>0 then
     begin
       for i:=2 to paramcount do

+ 0 - 1
tests/utils/testfail.pp

@@ -49,7 +49,6 @@ end;
 
 procedure RunFail;
 var
-  outname,
   TestExe : string;
 begin
   TestExe:=ForceExtension(FailName,ExeExt);