mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-24 15:59:03 +00:00
Move printing sub-test information into test harness (#421)
This removes all the duplicated code from each test, and moves it to test harness so that we have single place where this information is printed. Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
This commit is contained in:
committed by
Kévin Petit
parent
19951a2a14
commit
03650057bb
@@ -43,6 +43,8 @@
|
||||
|
||||
int gTestsPassed = 0;
|
||||
int gTestsFailed = 0;
|
||||
int gFailCount;
|
||||
int gTestCount;
|
||||
cl_uint gRandomSeed = 0;
|
||||
cl_uint gReSeed = 0;
|
||||
|
||||
@@ -567,6 +569,37 @@ static int saveResultsToJson( const char *fileName, const char *suiteName, test_
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void print_results( int failed, int count, const char* name )
|
||||
{
|
||||
if( count < failed )
|
||||
{
|
||||
count = failed;
|
||||
}
|
||||
|
||||
if( failed == 0 )
|
||||
{
|
||||
if( count > 1 )
|
||||
{
|
||||
log_info( "PASSED %d of %d %ss.\n", count, count, name );
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info( "PASSED %s.\n", name );
|
||||
}
|
||||
}
|
||||
else if( failed > 0 )
|
||||
{
|
||||
if( count > 1 )
|
||||
{
|
||||
log_error( "FAILED %d of %d %ss.\n", failed, count, name );
|
||||
}
|
||||
else
|
||||
{
|
||||
log_error( "FAILED %s.\n", name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id device, int testNum,
|
||||
test_definition testList[], int forceNoContextCreation,
|
||||
cl_command_queue_properties queueProps, int num_elements )
|
||||
@@ -616,28 +649,8 @@ int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id dev
|
||||
callTestFunctions( testList, selectedTestList, resultTestList, testNum, device,
|
||||
forceNoContextCreation, num_elements, queueProps );
|
||||
|
||||
if( gTestsFailed == 0 )
|
||||
{
|
||||
if( gTestsPassed > 1 )
|
||||
{
|
||||
log_info("PASSED %d of %d tests.\n", gTestsPassed, gTestsPassed);
|
||||
}
|
||||
else if( gTestsPassed > 0 )
|
||||
{
|
||||
log_info("PASSED test.\n");
|
||||
}
|
||||
}
|
||||
else if( gTestsFailed > 0 )
|
||||
{
|
||||
if( gTestsFailed+gTestsPassed > 1 )
|
||||
{
|
||||
log_error("FAILED %d of %d tests.\n", gTestsFailed, gTestsFailed+gTestsPassed);
|
||||
}
|
||||
else
|
||||
{
|
||||
log_error("FAILED test.\n");
|
||||
}
|
||||
}
|
||||
print_results( gFailCount, gTestCount, "sub-test" );
|
||||
print_results( gTestsFailed, gTestsFailed + gTestsPassed, "test" );
|
||||
|
||||
char *filename = getenv( "CL_CONFORMANCE_RESULTS_FILENAME" );
|
||||
if( filename != NULL )
|
||||
|
||||
@@ -64,6 +64,8 @@ typedef enum test_status
|
||||
TEST_SKIP = 2,
|
||||
} test_status;
|
||||
|
||||
extern int gFailCount;
|
||||
extern int gTestCount;
|
||||
extern cl_uint gReSeed;
|
||||
extern cl_uint gRandomSeed;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user