mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-26 00:39:03 +00:00
cl21: Fix test spirv_new - define test cache path (#378)
* Fix test spirv_new - define test cache path * Fix test spirv_new - review fixes * Fix end of array detection
This commit is contained in:
committed by
Kévin Petit
parent
f24b072595
commit
284680936d
@@ -31,6 +31,8 @@ const std::string slash = "/";
|
|||||||
|
|
||||||
const std::string spvExt = ".spv";
|
const std::string spvExt = ".spv";
|
||||||
std::string gAddrWidth = "";
|
std::string gAddrWidth = "";
|
||||||
|
std::string spvBinariesPath = "spirv_bin";
|
||||||
|
std::string spvBinariesPathArg = "--spirv-binaries-path";
|
||||||
|
|
||||||
std::vector<unsigned char> readBinary(const char *file_name)
|
std::vector<unsigned char> readBinary(const char *file_name)
|
||||||
{
|
{
|
||||||
@@ -58,7 +60,7 @@ std::vector<unsigned char> readBinary(const char *file_name)
|
|||||||
|
|
||||||
std::vector<unsigned char> readSPIRV(const char *file_name)
|
std::vector<unsigned char> readSPIRV(const char *file_name)
|
||||||
{
|
{
|
||||||
std::string full_name_str = gCompilationCachePath + slash + file_name + spvExt + gAddrWidth;
|
std::string full_name_str = spvBinariesPath + slash + file_name + spvExt + gAddrWidth;
|
||||||
return readBinary(full_name_str.c_str());
|
return readBinary(full_name_str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +99,7 @@ static int offline_get_program_with_il(clProgramWrapper &prog,
|
|||||||
cl_int err = 0;
|
cl_int err = 0;
|
||||||
std::string outputTypeStr = "binary";
|
std::string outputTypeStr = "binary";
|
||||||
std::string defaultScript = std::string("..") + slash + std::string("spv_to_binary.py");
|
std::string defaultScript = std::string("..") + slash + std::string("spv_to_binary.py");
|
||||||
std::string outputFilename = gCompilationCachePath + slash + std::string(prog_name);
|
std::string outputFilename = spvBinariesPath + slash + std::string(prog_name);
|
||||||
std::string sourceFilename = outputFilename + spvExt;
|
std::string sourceFilename = outputFilename + spvExt;
|
||||||
|
|
||||||
std::string scriptArgs =
|
std::string scriptArgs =
|
||||||
@@ -174,9 +176,40 @@ test_status checkAddressWidth(cl_device_id id)
|
|||||||
return TEST_PASS;
|
return TEST_PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printUsage() {
|
||||||
|
log_info("Reading SPIR-V files from default '%s' path.\n", spvBinariesPath.c_str());
|
||||||
|
log_info("In case you want to set other directory use '%s' argument.\n", spvBinariesPathArg.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
int main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
gReSeed = 1;
|
gReSeed = 1;
|
||||||
|
bool modifiedSpvBinariesPath = false;
|
||||||
|
for (int i = 0; i < argc; ++i) {
|
||||||
|
int argsRemoveNum = 0;
|
||||||
|
if (argv[i] == spvBinariesPathArg) {
|
||||||
|
if (i + 1 == argc) {
|
||||||
|
log_error("Missing value for '%s' argument.\n", spvBinariesPathArg.c_str());
|
||||||
|
return TEST_FAIL;
|
||||||
|
} else {
|
||||||
|
spvBinariesPath = std::string(argv[i + 1]);
|
||||||
|
argsRemoveNum += 2;
|
||||||
|
modifiedSpvBinariesPath = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argsRemoveNum > 0) {
|
||||||
|
for (int j = i; j < (argc - argsRemoveNum); ++j)
|
||||||
|
argv[j] = argv[j + argsRemoveNum];
|
||||||
|
|
||||||
|
argc -= argsRemoveNum;
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (modifiedSpvBinariesPath == false) {
|
||||||
|
printUsage();
|
||||||
|
}
|
||||||
|
|
||||||
return runTestHarnessWithCheck(argc, argv,
|
return runTestHarnessWithCheck(argc, argv,
|
||||||
spirvTestsRegistry::getInstance().getNumTests(),
|
spirvTestsRegistry::getInstance().getNumTests(),
|
||||||
spirvTestsRegistry::getInstance().getTestDefinitions(),
|
spirvTestsRegistry::getInstance().getTestDefinitions(),
|
||||||
|
|||||||
Reference in New Issue
Block a user