浏览代码

Merged revisions 149-150 via svnmerge from
/trunk

git-svn-id: branches/fixes_2_0@364 -

peter 20 年之前
父节点
当前提交
b4089ca3c6
共有 2 个文件被更改,包括 40 次插入19 次删除
  1. 35 18
      tests/utils/dbdigest.pp
  2. 5 1
      tests/utils/dbtests.pp

+ 35 - 18
tests/utils/dbdigest.pp

@@ -146,12 +146,8 @@ Const
 
 Var
   StatusCount : Array[TTestStatus] of Integer;
-  UnknownLines,
-  unexpected_run : Integer;
-  next_should_be_run : boolean;
+  UnknownLines : integer;
 
-var
-  prevline : string;
 
 Procedure ExtractTestFileName(Var Line : string);
 
@@ -167,7 +163,6 @@ Function Analyse(Var Line : string; Var Status : TTestStatus) : Boolean;
 
 Var
   TS : TTestStatus;
-  Found : Boolean;
 
 begin
   Result:=False;
@@ -198,7 +193,9 @@ TConfigOpt = (
   coDate,
   coSubmitter,
   coMachine,
-  coComment
+  coComment,
+  coTestSrcDir,
+  coVerbose
  );
 
 Const
@@ -215,11 +212,13 @@ ConfigStrings : Array [TConfigOpt] of string = (
   'date',
   'submitter',
   'machine',
-  'comment'
+  'comment',
+  'testsrcdir',
+  'verbose'
 );
 
 ConfigOpts : Array[TConfigOpt] of char
-           = ('d','h','u','p','l','o','c','v','t','s','m','C');
+           = ('d','h','u','p','l','o','c','v','t','s','m','C','S','V');
 
 Var
   TestOS,
@@ -236,7 +235,8 @@ Var
   TestDate : TDateTime;
 
 Procedure SetOpt (O : TConfigOpt; Value : string);
-
+var
+  year,month,day,min,hour : word;
 begin
   Case O of
     coDatabaseName : DatabaseName:=Value;
@@ -247,10 +247,31 @@ begin
     coOS           : TestOS:=Value;
     coCPU          : TestCPU:=Value;
     coVersion      : TestVersion:=Value;
-    coDate         : TestDate:=StrToDate(Value);
+    coDate         : 
+      begin
+        { Formated like YYYYMMDDhhmm }
+	if Length(value)=12 then
+	  begin
+	    year:=StrToInt(Copy(value,1,4));
+	    month:=StrToInt(Copy(value,5,2));
+	    day:=StrToInt(Copy(Value,7,2));
+	    hour:=StrToInt(Copy(Value,9,2));
+	    min:=StrToInt(Copy(Value,11,2));
+	    TestDate:=EncodeDate(year,month,day)+EncodeTime(hour,min,0,0);
+	  end
+	else
+	  Verbose(V_Error,'Error in date format, use YYYYMMDDhhmm');  
+      end;
     coSubmitter    : Submitter:=Value;
     coMachine      : Machine:=Value;
     coComment      : Comment:=Value;
+    coVerbose      : DoVerbose:=true;
+    coTestSrcDir   :
+      begin
+        TestSrcDir:=Value;
+	if (TestSrcDir<>'') and (TestSrcDir[length(TestSrcDir)]<>'/') then
+	  TestSrcDir:=TestSrcDir+'/';
+      end;	  
   end;
 end;
 
@@ -259,8 +280,7 @@ Function ProcessOption(S: String) : Boolean;
 Var
   N : String;
   I : Integer;
-  Found : Boolean;
-  co,o : TConfigOpt;
+  co : TConfigOpt;
 
 begin
   Verbose(V_DEBUG,'Processing option: '+S);
@@ -274,10 +294,7 @@ begin
       begin
       Result:=CompareText(ConfigStrings[co],N)=0;
       If Result then
-        begin
-        o:=co;
         Break;
-        end;
       end;
     end;
  If Result then
@@ -320,7 +337,7 @@ Procedure ProcessCommandLine;
 
 Var
   I : Integer;
-  O,V : String;
+  O : String;
   c,co : TConfigOpt;
   Found : Boolean;
 
@@ -452,7 +469,7 @@ procedure UpdateTestRun;
     qry:='UPDATE TESTRUN SET ';
     for i:=low(TTestStatus) to high(TTestStatus) do
       qry:=qry+format('%s=%d, ',[SQLField[i],StatusCount[i]]);
-    qry:=qry+format('TU_SUBMITTER="%s", TU_MACHINE="%s", TU_COMMENT="%s"',[Submitter,Machine,Comment]);
+    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)
   end;

+ 5 - 1
tests/utils/dbtests.pp

@@ -48,6 +48,9 @@ Function  IDQuery(Qry : String) : Integer;
 Function  EscapeSQL( S : String) : String;
 Function SQLDate(D : TDateTime) : String;
 
+var
+  TestSrcDir : string;
+  
 Implementation
 
 Uses
@@ -257,7 +260,8 @@ Var
 
 begin
   Result:=-1;
-  If FileExists(Name) and GetConfig(Name,Info) then
+  If FileExists(TestSrcDir+Name) and
+     GetConfig(TestSrcDir+Name,Info) then
     begin
     If RunQuery(Format(SInsertTest,[ExtractFileName(Name),Name]),Res) then
       begin