mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
SPIR-V tests for scalar printf - fix for Windows OS (#2358)
This commit is contained in:
committed by
GitHub
parent
42b4bca510
commit
051b82b7e9
@@ -94,7 +94,6 @@ struct StreamGrabber
|
|||||||
results.clear();
|
results.clear();
|
||||||
results.resize(filesize);
|
results.resize(filesize);
|
||||||
is.read(&results[0], filesize);
|
is.read(&results[0], filesize);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,6 +105,16 @@ struct StreamGrabber
|
|||||||
bool acquired = false;
|
bool acquired = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void normalize_strings(std::string& input)
|
||||||
|
{
|
||||||
|
// Normalize line endings: replace \r\n with \n
|
||||||
|
size_t pos = 0;
|
||||||
|
while ((pos = input.find("\r\n", pos)) != std::string::npos)
|
||||||
|
{
|
||||||
|
input.replace(pos, 2, "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// printf callback, for cl_arm_printf
|
// printf callback, for cl_arm_printf
|
||||||
void CL_CALLBACK printfCallBack(const char* printf_data, size_t len,
|
void CL_CALLBACK printfCallBack(const char* printf_data, size_t len,
|
||||||
size_t final, void* user_data)
|
size_t final, void* user_data)
|
||||||
@@ -162,12 +171,15 @@ static int printf_operands_helper(cl_device_id device,
|
|||||||
test_error(error, "unable to enqueue kernel");
|
test_error(error, "unable to enqueue kernel");
|
||||||
|
|
||||||
std::string results;
|
std::string results;
|
||||||
|
std::string expectedResultsStr(expectedResults);
|
||||||
grabber.get_results(results);
|
grabber.get_results(results);
|
||||||
|
normalize_strings(results);
|
||||||
|
normalize_strings(expectedResultsStr);
|
||||||
|
|
||||||
if (results != std::string(expectedResults))
|
if (results != expectedResultsStr)
|
||||||
{
|
{
|
||||||
log_error("Results do not match.\n");
|
log_error("Results do not match.\n");
|
||||||
log_error("Expected: \n---\n%s---\n", expectedResults);
|
log_error("Expected: \n---\n%s---\n", expectedResultsStr.c_str());
|
||||||
log_error("Got: \n---\n%s---\n", results.c_str());
|
log_error("Got: \n---\n%s---\n", results.c_str());
|
||||||
return TEST_FAIL;
|
return TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user