2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2022-04-15 19:13:33 +08:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-02-27 23:17:08 +08:00
|
|
|
#include "shared/offline_compiler/source/offline_compiler.h"
|
2021-05-21 18:22:13 +08:00
|
|
|
#include "shared/source/os_interface/os_inc_base.h"
|
2021-01-21 20:10:13 +08:00
|
|
|
#include "shared/test/common/helpers/test_files.h"
|
2021-05-21 18:22:13 +08:00
|
|
|
#include "shared/test/common/mocks/mock_compilers.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
|
|
|
#include "gtest/gtest.h"
|
2022-04-15 19:13:33 +08:00
|
|
|
#include "mock/mock_iga_dll_guard.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
class Environment : public ::testing::Environment {
|
|
|
|
public:
|
2018-04-18 00:11:50 +08:00
|
|
|
Environment(const std::string &devicePrefix, const std::string &familyNameWithType)
|
2022-04-15 19:13:33 +08:00
|
|
|
: devicePrefix(devicePrefix), familyNameWithType(familyNameWithType) {
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2022-05-10 01:40:30 +08:00
|
|
|
void SetInputFileName( // NOLINT(readability-identifier-naming)
|
2017-12-21 07:45:38 +08:00
|
|
|
const std::string filename) {
|
|
|
|
|
2018-04-24 19:06:49 +08:00
|
|
|
retrieveBinaryKernelFilename(igcDebugVars.fileName, filename + "_", ".gen");
|
|
|
|
retrieveBinaryKernelFilename(fclDebugVars.fileName, filename + "_", ".bc");
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
NEO::setIgcDebugVars(igcDebugVars);
|
|
|
|
NEO::setFclDebugVars(fclDebugVars);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetUp() override {
|
2022-04-15 19:13:33 +08:00
|
|
|
mockIgaDllGuard.enable();
|
2017-12-21 07:45:38 +08:00
|
|
|
mockCompilerGuard.Enable();
|
|
|
|
SetInputFileName("copybuffer");
|
|
|
|
}
|
|
|
|
|
|
|
|
void TearDown() override {
|
|
|
|
mockCompilerGuard.Disable();
|
2022-04-15 19:13:33 +08:00
|
|
|
mockIgaDllGuard.disable();
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
NEO::MockCompilerDebugVars igcDebugVars;
|
|
|
|
NEO::MockCompilerDebugVars fclDebugVars;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
void (*igcSetDebugVarsFPtr)(NEO::MockCompilerDebugVars &debugVars);
|
|
|
|
void (*fclSetDebugVarsFPtr)(NEO::MockCompilerDebugVars &debugVars);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
NEO::MockCompilerEnableGuard mockCompilerGuard;
|
2022-04-15 19:13:33 +08:00
|
|
|
NEO::MockIgaDllGuard mockIgaDllGuard;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
const std::string devicePrefix;
|
2018-04-18 00:11:50 +08:00
|
|
|
const std::string familyNameWithType;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|