mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Update '-list' option (#2457)
'-list' option is used to print all sub-tests. But some test do not support it at all. And all test do not display it the same way, making it quite complicated for external tools to extract them. That CL clean the usage so that tests: - Print the sub-tests list with either '-list' (to prevent breaking legacy usage) or '--list' (to match other options) - Do not print anything else when the option is used
This commit is contained in:
@@ -35,6 +35,7 @@ std::string gCompilationProgram = DEFAULT_COMPILATION_PROGRAM;
|
||||
bool gDisableSPIRVValidation = false;
|
||||
std::string gSPIRVValidator = DEFAULT_SPIRV_VALIDATOR;
|
||||
unsigned gNumWorkerThreads;
|
||||
bool gListTests = false;
|
||||
|
||||
void helpInfo()
|
||||
{
|
||||
@@ -49,6 +50,8 @@ void helpInfo()
|
||||
spir-v Use SPIR-V offline compilation
|
||||
--num-worker-threads <num>
|
||||
Select parallel execution with the specified number of worker threads.
|
||||
--list
|
||||
List sub-tests
|
||||
|
||||
For offline compilation (binary and spir-v modes) only:
|
||||
--compilation-cache-mode <cache-mode>
|
||||
@@ -104,6 +107,11 @@ int parseCustomParam(int argc, const char *argv[], const char *ignore)
|
||||
// option and print its own help.
|
||||
helpInfo();
|
||||
}
|
||||
else if (!strcmp(argv[i], "--list") || !strcmp(argv[i], "-list"))
|
||||
{
|
||||
delArg++;
|
||||
gListTests = true;
|
||||
}
|
||||
else if (!strcmp(argv[i], "--compilation-mode"))
|
||||
{
|
||||
delArg++;
|
||||
|
||||
@@ -40,6 +40,7 @@ extern std::string gCompilationCachePath;
|
||||
extern std::string gCompilationProgram;
|
||||
extern bool gDisableSPIRVValidation;
|
||||
extern std::string gSPIRVValidator;
|
||||
extern bool gListTests;
|
||||
|
||||
extern int parseCustomParam(int argc, const char *argv[],
|
||||
const char *ignore = 0);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <cassert>
|
||||
#include <deque>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
@@ -169,6 +170,19 @@ void version_expected_info(const char *test_name, const char *api_name,
|
||||
"reports %s version %s)\n",
|
||||
test_name, api_name, expected_version, api_name, device_version);
|
||||
}
|
||||
|
||||
static void list_tests(int testNum, test_definition testList[])
|
||||
{
|
||||
std::set<std::string> names;
|
||||
for (int i = 0; i < testNum; i++)
|
||||
{
|
||||
names.insert(testList[i].name);
|
||||
}
|
||||
for (const auto &name : names)
|
||||
{
|
||||
log_info("\t%s\n", name.c_str());
|
||||
}
|
||||
}
|
||||
int runTestHarnessWithCheck(int argc, const char *argv[], int testNum,
|
||||
test_definition testList[],
|
||||
int forceNoContextCreation,
|
||||
@@ -258,10 +272,13 @@ int runTestHarnessWithCheck(int argc, const char *argv[], int testNum,
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Special case: just list the tests */
|
||||
if ((argc > 1)
|
||||
&& (!strcmp(argv[1], "-list") || !strcmp(argv[1], "-h")
|
||||
|| !strcmp(argv[1], "--help")))
|
||||
if (gListTests)
|
||||
{
|
||||
list_tests(testNum, testList);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
if ((argc > 1) && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))
|
||||
{
|
||||
char *fileName = getenv("CL_CONFORMANCE_RESULTS_FILENAME");
|
||||
|
||||
@@ -284,10 +301,7 @@ int runTestHarnessWithCheck(int argc, const char *argv[], int testNum,
|
||||
|
||||
log_info("\n");
|
||||
log_info("Test names:\n");
|
||||
for (int i = 0; i < testNum; i++)
|
||||
{
|
||||
log_info("\t%s\n", testList[i].name);
|
||||
}
|
||||
list_tests(testNum, testList);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -284,6 +284,11 @@ int main( int argc, const char **argv )
|
||||
|
||||
static int ParseArgs( int argc, const char **argv )
|
||||
{
|
||||
if (gListTests)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
gArgList = (const char **)calloc( argc, sizeof( char*) );
|
||||
|
||||
if( NULL == gArgList )
|
||||
|
||||
@@ -112,6 +112,35 @@ int main(int argc, const char **argv)
|
||||
int error;
|
||||
|
||||
argc = parseCustomParam(argc, argv);
|
||||
if (gListTests)
|
||||
{
|
||||
for (unsigned dst = 0; dst < kTypeCount; dst++)
|
||||
{
|
||||
for (unsigned src = 0; src < kTypeCount; src++)
|
||||
{
|
||||
for (unsigned sat = 0; sat < 2; sat++)
|
||||
{
|
||||
// skip illegal saturated conversions to float type
|
||||
if (gSaturationNames[sat] == std::string("_sat")
|
||||
&& (gTypeNames[dst] == std::string("float")
|
||||
|| gTypeNames[dst] == std::string("half")
|
||||
|| gTypeNames[dst] == std::string("double")))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (unsigned rnd = 0; rnd < kRoundingModeCount; rnd++)
|
||||
{
|
||||
vlog("\t%s\n",
|
||||
(std::string(gTypeNames[dst])
|
||||
+ gSaturationNames[sat] + gRoundingModeNames[rnd]
|
||||
+ "_" + gTypeNames[src])
|
||||
.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (argc == -1)
|
||||
{
|
||||
return 1;
|
||||
|
||||
@@ -83,13 +83,6 @@ int main (int argc, const char **argv )
|
||||
if( (error = ParseArgs( argc, argv )) )
|
||||
goto exit;
|
||||
|
||||
if (gIsEmbedded) {
|
||||
vlog( "\tProfile: Embedded\n" );
|
||||
}else
|
||||
{
|
||||
vlog( "\tProfile: Full\n" );
|
||||
}
|
||||
|
||||
fflush( stdout );
|
||||
error = runTestHarnessWithCheck(
|
||||
argCount, argList, test_registry::getInstance().num_tests(),
|
||||
@@ -114,6 +107,10 @@ exit:
|
||||
|
||||
static int ParseArgs( int argc, const char **argv )
|
||||
{
|
||||
if (gListTests)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int i;
|
||||
argList = (const char **)calloc(argc, sizeof(char *));
|
||||
if( NULL == argList )
|
||||
@@ -217,6 +214,16 @@ static int ParseArgs( int argc, const char **argv )
|
||||
vlog( "*** It gives warm fuzzy feelings and then nevers calls. ***\n\n" );
|
||||
vlog( "*** Wimpy Reduction Factor: %-27u ***\n\n", gWimpyReductionFactor);
|
||||
}
|
||||
|
||||
if (gIsEmbedded)
|
||||
{
|
||||
vlog("\tProfile: Embedded\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
vlog("\tProfile: Full\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -384,6 +384,8 @@ int main(int argc, const char *argv[])
|
||||
error = ParseArgs(argc, argv);
|
||||
if (error) return error;
|
||||
|
||||
if (!gListTests)
|
||||
{
|
||||
// This takes a while, so prevent the machine from going to sleep.
|
||||
PreventSleep();
|
||||
atexit(ResumeSleep);
|
||||
@@ -397,8 +399,9 @@ int main(int argc, const char *argv[])
|
||||
if (gWimpyMode) vlog(" ");
|
||||
if (!gSkipCorrectnessTesting) vlog("\t max_ulps");
|
||||
|
||||
vlog("\n-------------------------------------------------------------------"
|
||||
"----------------------------------------\n");
|
||||
vlog("\n---------------------------------------------------------------"
|
||||
"--------------------------------------------\n");
|
||||
}
|
||||
|
||||
gMTdata = MTdataHolder(gRandomSeed);
|
||||
|
||||
@@ -425,6 +428,10 @@ int main(int argc, const char *argv[])
|
||||
|
||||
static int ParseArgs(int argc, const char **argv)
|
||||
{
|
||||
if (gListTests)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// We only pass test names to runTestHarnessWithCheck, hence global command
|
||||
// line options defined by the harness cannot be used by the user.
|
||||
// To respect the implementation details of runTestHarnessWithCheck,
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
log_info("1st part, non gl-sharing objects...\n");
|
||||
gTestRounding = true;
|
||||
return runTestHarness(argc, argv, test_registry::getInstance().num_tests(),
|
||||
test_registry::getInstance().definitions(), false, 0);
|
||||
|
||||
@@ -1104,17 +1104,16 @@ int main(int argc, const char* argv[])
|
||||
if (gQueue)
|
||||
{
|
||||
int error = clFinish(gQueue);
|
||||
if (error) {
|
||||
if (error)
|
||||
{
|
||||
log_error("clFinish failed: %d\n", error);
|
||||
}
|
||||
}
|
||||
|
||||
if (clReleaseCommandQueue(gQueue) != CL_SUCCESS)
|
||||
log_error("clReleaseCommandQueue\n");
|
||||
if(clReleaseContext(gContext)!= CL_SUCCESS)
|
||||
}
|
||||
if (gContext && clReleaseContext(gContext) != CL_SUCCESS)
|
||||
log_error("clReleaseContext\n");
|
||||
|
||||
|
||||
free(argList);
|
||||
remove(gFileName);
|
||||
return err;
|
||||
|
||||
@@ -630,7 +630,8 @@ int main(int argc, const char* argv[])
|
||||
s_wimpy_mode = true;
|
||||
}
|
||||
|
||||
if (s_wimpy_mode) {
|
||||
if (s_wimpy_mode && !gListTests)
|
||||
{
|
||||
log_info("\n");
|
||||
log_info("*** WARNING: Testing in Wimpy mode! ***\n");
|
||||
log_info("*** Wimpy mode is not sufficient to verify correctness. ***\n");
|
||||
|
||||
@@ -6713,6 +6713,14 @@ cl_device_id get_platform_device (cl_device_type device_type, cl_uint choosen_de
|
||||
return devices[choosen_device_index];
|
||||
}
|
||||
|
||||
static void ListTests()
|
||||
{
|
||||
for (unsigned int i = 0; i < (sizeof(spir_suites) / sizeof(sub_suite)); i++)
|
||||
{
|
||||
log_info("\t%s\n", spir_suites[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Parses the command line parameters and set the
|
||||
@@ -6761,7 +6769,7 @@ static int ParseCommandLine (int argc, const char *argv[],
|
||||
/* Process the command line arguments */
|
||||
|
||||
/* Special case: just list the tests */
|
||||
if( ( argc > 1 ) && (!strcmp( argv[ 1 ], "-list" ) || !strcmp( argv[ 1 ], "-h" ) || !strcmp( argv[ 1 ], "--help" )))
|
||||
if ((argc > 1) && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))
|
||||
{
|
||||
log_info( "Usage: %s [<suite name>] [pid<num>] [id<num>] [<device type>] [w32] [no-unzip]\n", argv[0] );
|
||||
log_info( "\t<suite name>\tOne or more of: (default all)\n");
|
||||
@@ -6771,10 +6779,12 @@ static int ParseCommandLine (int argc, const char *argv[],
|
||||
log_info( "\tw32\t\tIndicates device address bits is 32.\n" );
|
||||
log_info( "\tno-unzip\t\tDo not extract test files from Zip; use existing.\n" );
|
||||
|
||||
for( unsigned int i = 0; i < (sizeof(spir_suites) / sizeof(sub_suite)); i++ )
|
||||
{
|
||||
log_info( "\t\t%s\n", spir_suites[i].name );
|
||||
ListTests();
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-list"))
|
||||
{
|
||||
ListTests();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -216,6 +216,7 @@ int main(int argc, const char *argv[])
|
||||
{
|
||||
gReSeed = 1;
|
||||
bool modifiedSpvBinariesPath = false;
|
||||
bool listTests = false;
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
int argsRemoveNum = 0;
|
||||
if (argv[i] == spvBinariesPathArg) {
|
||||
@@ -241,8 +242,11 @@ int main(int argc, const char *argv[])
|
||||
argc -= argsRemoveNum;
|
||||
--i;
|
||||
}
|
||||
listTests |= (argv[i] == std::string("--list")
|
||||
|| argv[i] == std::string("-list"));
|
||||
}
|
||||
if (modifiedSpvBinariesPath == false) {
|
||||
if (modifiedSpvBinariesPath == false && !listTests)
|
||||
{
|
||||
printUsage();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user