fix test kernel attributes when api fcts are failing (#1449)

test_error returns the err given as the first argument. As the
run_test function returns a bool, we end up returning true (meaning
pass) when an api function fails.
Instead return explicitly false (meaning fail).
This commit is contained in:
Romaric Jodin
2022-09-01 07:56:10 +02:00
committed by GitHub
parent f94c135755
commit 2dc2533130

View File

@@ -275,16 +275,16 @@ static bool run_test(cl_context context, cl_device_id deviceID,
clKernelWrapper kernel;
cl_int err = create_single_kernel_helper(context, &program, &kernel, 1,
&kernel_src, "test_kernel");
test_error(err, "create_single_kernel_helper");
test_error_ret(err, "create_single_kernel_helper", false);
// Get the size of the kernel attribute string returned
size_t size = 0;
err = clGetKernelInfo(kernel, CL_KERNEL_ATTRIBUTES, 0, nullptr, &size);
test_error(err, "clGetKernelInfo");
test_error_ret(err, "clGetKernelInfo", false);
std::vector<char> attributes(size);
err = clGetKernelInfo(kernel, CL_KERNEL_ATTRIBUTES, attributes.size(),
attributes.data(), nullptr);
test_error(err, "clGetKernelInfo");
test_error_ret(err, "clGetKernelInfo", false);
std::string attribute_string(attributes.data());
attribute_string.erase(
std::remove(attribute_string.begin(), attribute_string.end(), ' '),