Files
compute-runtime/unit_tests/offline_compiler/decoder/mock/mock_encoder.h
Chodor, Jaroslaw 2e5ef30009 ocloc - checksum recalculation during reassembly
Resolves: NEO-2696

Change-Id: I2c049ac511e437679df9b58d00e4fb8d995bbe3e
2019-06-19 09:57:04 +02:00

48 lines
1.4 KiB
C++

/*
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "offline_compiler/decoder/binary_encoder.h"
#include "runtime/helpers/hash.h"
#include <map>
#include <string>
struct MockEncoder : public BinaryEncoder {
MockEncoder() : MockEncoder("", ""){};
MockEncoder(const std::string &dump, const std::string &elf)
: BinaryEncoder(dump, elf) {
setMessagePrinter(MessagePrinter{true});
};
bool copyBinaryToBinary(const std::string &srcFileName, std::ostream &outBinary, uint32_t *binaryLength) override {
auto it = filesMap.find(srcFileName);
if (it == filesMap.end()) {
return false;
}
outBinary.write(it->second.c_str(), it->second.size());
if (binaryLength != nullptr) {
*binaryLength = static_cast<uint32_t>(it->second.size());
}
return true;
}
using BinaryEncoder::addPadding;
using BinaryEncoder::calculatePatchListSizes;
using BinaryEncoder::copyBinaryToBinary;
using BinaryEncoder::createElf;
using BinaryEncoder::elfName;
using BinaryEncoder::encode;
using BinaryEncoder::pathToDump;
using BinaryEncoder::processBinary;
using BinaryEncoder::processKernel;
using BinaryEncoder::write;
using BinaryEncoder::writeDeviceBinary;
std::map<std::string, std::string> filesMap;
};