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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user