Implement negative tests for cl_device_id API functions (#2495)

Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
Co-authored-by: Chetankumar Mistry <chetan.mistry@arm.com>
This commit is contained in:
Michael Rizkalla
2025-12-02 17:34:45 +00:00
committed by GitHub
parent 0c064ac017
commit 011caecb57
6 changed files with 607 additions and 2 deletions

View File

@@ -58,6 +58,13 @@ void helpInfo()
with a very small subset of the tests. This option should not be used
for conformance submission (default: disabled).
--invalid-object-scenarios=<option_1>,<option_2>....
Specify different scenarios to use when
testing for object validity. Options can be:
nullptr To use a nullptr (default)
valid_object_wrong_type To use a valid_object which is not the correct type
NOTE: valid_object_wrong_type option is not required for OpenCL conformance.
For offline compilation (binary and spir-v modes) only:
--compilation-cache-mode <cache-mode>
Specify a compilation caching mode:
@@ -104,6 +111,7 @@ int parseCustomParam(int argc, const char *argv[], const char *ignore)
}
delArg = 0;
size_t i_object_length = strlen("--invalid-object-scenarios=");
if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
{
@@ -264,6 +272,32 @@ int parseCustomParam(int argc, const char *argv[], const char *ignore)
return -1;
}
}
else if (!strncmp(argv[i],
"--invalid-object-scenarios=", i_object_length))
{
if (strlen(argv[i]) > i_object_length)
{
delArg++;
gInvalidObject = 0;
std::string invalid_objects(argv[i]);
if (invalid_objects.find("nullptr") != std::string::npos)
{
gInvalidObject |= InvalidObject::Nullptr;
}
if (invalid_objects.find("valid_object_wrong_type")
!= std::string::npos)
{
gInvalidObject |= InvalidObject::ValidObjectWrongType;
}
}
else
{
log_error("Program argument for --invalid-object-scenarios was "
"not specified.\n");
return -1;
}
}
// cleaning parameters from argv tab
for (int j = i; j < argc - delArg; j++) argv[j] = argv[j + delArg];