From efe885c4467c369f5c4aa634fb472f4f649f6019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Sun, 9 Mar 2025 10:54:58 +0100 Subject: [PATCH] * Introduce stInvalid test status --- tests/utils/tsdb.pp | 19 +++++++----- tests/utils/tsstring.pp | 1 + tests/utils/tstypes.pp | 69 +++++++++++++++++++++++++++++++++++------ 3 files changed, 73 insertions(+), 16 deletions(-) diff --git a/tests/utils/tsdb.pp b/tests/utils/tsdb.pp index 50104493a8..4f0b14d1b5 100644 --- a/tests/utils/tsdb.pp +++ b/tests/utils/tsdb.pp @@ -636,10 +636,13 @@ const var Qry : TSQLQuery; ST : TTestStatus; + S : string; begin - Qry:=CreateQuery(Format(SQLSelectRunData,[aID])); - Verbose(V_SQL,'GetRunData: '+Format(SQLSelectRunData,[aID])); + + S:=Format(SQLSelectRunData,[aID]); + Qry:=CreateQuery(S); + Verbose(V_SQL,'GetRunData: '+s); try Qry.Open; Result:=Not Qry.IsEmpty; @@ -666,7 +669,7 @@ begin aData.TestsRevision:=FieldByName('TU_TESTSREVISION').AsString; aData.RTLRevision:=FieldByName('TU_RTLREVISION').AsString; aData.PackagesRevision:=FieldByName('TU_PACKAGESREVISION').AsString; - for ST in TTestStatus do + for ST in TValidTestStatus do aData.StatusCount[ST]:=FieldByName(SQLField[ST]).AsInteger; end; finally @@ -1017,13 +1020,15 @@ Const var Qry : TSQLQuery; + S : String; begin Result:=Default(TTestResultData); Result.TestID:=aTestID; Result.PlatformID:=aPlatformID; - Qry:=CreateQuery(Format(SQLSelect,[aTestID,aPlatformID])); - Verbose(V_SQL,'GetLastTestResult: '+Format(SQLSelect,[aTestID,aPlatformID])); + S:=Format(SQLSelect,[aTestID,aPlatformID]); + Qry:=CreateQuery(S); + Verbose(V_SQL,'GetLastTestResult: '+s); try Qry.Open; If not Qry.IsEmpty then @@ -1084,7 +1089,7 @@ end; function TTestSQL.UpdateTestRun(aData: TTestRunData): Boolean; var Qry : string; - I : TTestStatus; + I : TValidTestStatus; Procedure AddTo(S : String); @@ -1096,7 +1101,7 @@ var begin Qry:=''; - for i:=low(TTestStatus) to high(TTestStatus) do + for I in TValidTestStatus do AddTo(format('%s=%d',[SQLField[i],aData.StatusCount[i]])); qry:='UPDATE TESTRUN SET '+Qry+' WHERE TU_ID='+format('%d',[aData.RunID]); ExecuteQuery(Qry,False); diff --git a/tests/utils/tsstring.pp b/tests/utils/tsstring.pp index 12a161c53b..1dfd45a4b5 100644 --- a/tests/utils/tsstring.pp +++ b/tests/utils/tsstring.pp @@ -23,6 +23,7 @@ const Bools : Array[Boolean] of string = ('f','t'); const + invalid_status = 'invalid'; failed_to_compile = 'Failed to compile '; success_compilation_failed = 'Success, compilation failed '; failed_compilation_successful = 'Failed, compilation successful '; diff --git a/tests/utils/tstypes.pp b/tests/utils/tstypes.pp index 204bcd6d6e..04847262f1 100644 --- a/tests/utils/tstypes.pp +++ b/tests/utils/tstypes.pp @@ -28,6 +28,7 @@ uses Type TTestStatus = ( + stInvalid, stFailedToCompile, stSuccessCompilationFailed, stFailedCompilationsuccessful, @@ -52,6 +53,7 @@ Const LastStatus = stskippingRunTest; TestOK : Array[TTestStatus] of Boolean = ( + False, // stInvalid False, // stFailedToCompile, True, // stSuccessCompilationFailed, False, // stFailedCompilationsuccessful, @@ -70,7 +72,29 @@ Const False // stskippingRunTest ); + TestFailed : Array[TTestStatus] of Boolean = ( + False, // stInvalid + True, // stFailedToCompile, + False, // stSuccessCompilationFailed, + True, // stFailedCompilationsuccessful, + False, // stSuccessfullyCompiled, + True, // stFailedToRun, + False, // stKnownRunProblem, + False, // stSuccessFullyRun, + False, // stSkippingGraphTest, + False, // stSkippingInteractiveTest, + False, // stSkippingKnownBug, + False, // stSkippingCompilerVersionTooLow, + False, // stSkippingCompilerVersionTooHigh, + False, // stSkippingOtherCpu, + False, // stSkippingOtherTarget, + False, // stSkippingRunUnit, + False // stskippingRunTest + ); + + TestSkipped : Array[TTestStatus] of Boolean = ( + False, // stInvalid False, // stFailedToCompile, False, // stSuccessCompilationFailed, False, // stFailedCompilationsuccessful, @@ -90,6 +114,7 @@ Const ); ExpectRun : Array[TTestStatus] of Boolean = ( + False, // stInvalid False, // stFailedToCompile, False, // stSuccessCompilationFailed, False, // stFailedCompilationsuccessful, @@ -109,6 +134,7 @@ Const ); StatusText : Array[TTestStatus] of String = ( + invalid_status, failed_to_compile, success_compilation_failed, failed_compilation_successful , @@ -128,6 +154,7 @@ Const ); SQLField : Array[TTestStatus] of String = ( + '', 'TU_FAILEDTOCOMPILE', 'TU_SUCCESSFULLYFAILED', 'TU_FAILEDTOFAIL', @@ -162,6 +189,8 @@ Const faction_compare_both_with_next = 10; Type + + TValidTestStatus = FirstStatus .. LastStatus; TCharSet = set of char; TVerboseLevel=(V_Abort,V_Error,V_Warning,V_Normal,V_Debug,V_SQL); @@ -258,6 +287,7 @@ Type StatusCount : Array[TTestStatus] of Integer; Function GetField(const aField : String) : String; function FailedCount: Integer; + function SkippedCount : Integer; function OKCount: Integer; function TotalCount: Integer; end; @@ -282,24 +312,45 @@ uses sysutils; { TTestRunData } function TTestRunData.OKCount : Integer; -begin - Result:=StatusCount[stSuccessCompilationFailed] + - StatusCount[stSUCCESSFULLYCOMPILED] + - StatusCount[stSUCCESSFULLYRUN] -end; +var + TS : TTestStatus; + +begin + Result:=0; + for TS:=FirstStatus to LastStatus do + if TestOK[TS] then + Inc(Result,StatusCount[TS]); +end; function TTestRunData.FailedCount : Integer; +var + TS : TTestStatus; begin - Result:=StatusCount[stFAILEDTOCOMPILE] + - StatusCount[stFAILEDTORUN] + - StatusCount[stFailedCompilationsuccessful]; + Result:=0; + for TS:=FirstStatus to LastStatus do + if TestFailed[TS] then + Inc(Result,StatusCount[TS]); +end; + +function TTestRunData.SkippedCount: Integer; +var + TS : TTestStatus; +begin + Result:=0; + for TS:=FirstStatus to LastStatus do + if TestSkipped[TS] then + Inc(Result,StatusCount[TS]); end; function TTestRunData.TotalCount: Integer; +var + TS : TTestStatus; begin - Result:=OKCount+FailedCount; + Result:=0; + for TS:=FirstStatus to LastStatus do + Result:=Result+StatusCount[TS]; end;