* Introduce stInvalid test status

This commit is contained in:
Michaël Van Canneyt 2025-03-09 10:54:58 +01:00
parent 17ed4b4d6c
commit efe885c446
3 changed files with 73 additions and 16 deletions

View File

@ -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);

View File

@ -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 ';

View File

@ -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;