Print_formatter refactor

Change-Id: Icb03697281b009c853d91a63d5d21ffcde545a8f
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2019-05-23 13:11:12 +02:00
committed by sys_ocldev
parent 7392856a8c
commit f2a8fc7ea9
11 changed files with 55 additions and 73 deletions

View File

@@ -23,7 +23,7 @@ using namespace iOpenCL;
// -------------------- Base Fixture ------------------------
class PrintFormatterTest : public testing::Test {
public:
PrintFormatter *printFormatter;
std::unique_ptr<PrintFormatter> printFormatter;
std::string format;
uint8_t buffer;
@@ -50,7 +50,7 @@ class PrintFormatterTest : public testing::Test {
program = std::make_unique<MockProgram>(*device->getExecutionEnvironment());
kernel = new MockKernel(program.get(), *kernelInfo, *device);
printFormatter = new PrintFormatter(*kernel, *data);
printFormatter = std::unique_ptr<PrintFormatter>(new PrintFormatter(static_cast<uint8_t *>(data->getUnderlyingBuffer()), PrintFormatter::maxPrintfOutputLength, is32bit, kernelInfo->patchInfo.stringDataMap));
underlyingBuffer[0] = 0;
underlyingBuffer[1] = 0;
@@ -59,7 +59,6 @@ class PrintFormatterTest : public testing::Test {
}
void TearDown() override {
delete printFormatter;
delete data;
delete kernel;
delete device;
@@ -751,6 +750,7 @@ TEST_F(PrintFormatterTest, GivenPrintfFormatWhenPointerThenInsertAddress) {
}
TEST_F(PrintFormatterTest, GivenPrintfFormatWhenPointerWith32BitKernelThenPrint32BitPointer) {
printFormatter.reset(new PrintFormatter(static_cast<uint8_t *>(data->getUnderlyingBuffer()), PrintFormatter::maxPrintfOutputLength, true, kernelInfo->patchInfo.stringDataMap));
auto stringIndex = injectFormatString("%p");
storeData(stringIndex);
kernelInfo->gpuPointerSize = 4;