2020-04-07 12:03:16 +02:00
|
|
|
/*
|
2023-01-02 11:14:39 +00:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2020-04-07 12:03:16 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2023-07-07 12:09:44 +00:00
|
|
|
#include "shared/source/built_ins/built_ins.h"
|
2020-04-07 12:03:16 +02:00
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
|
|
|
|
#include "shared/source/gmm_helper/gmm_helper.h"
|
|
|
|
|
#include "shared/source/gmm_helper/gmm_interface.h"
|
2021-10-06 11:43:42 +00:00
|
|
|
#include "shared/source/helpers/api_specific_config.h"
|
2023-03-10 12:28:11 +00:00
|
|
|
#include "shared/source/os_interface/product_helper.h"
|
2023-07-07 12:09:44 +00:00
|
|
|
#include "shared/source/utilities/const_stringref.h"
|
2020-04-07 12:03:16 +02:00
|
|
|
#include "shared/source/utilities/debug_settings_reader.h"
|
2022-12-22 11:31:28 +00:00
|
|
|
#include "shared/source/utilities/logger.h"
|
2022-08-17 10:17:02 +00:00
|
|
|
#include "shared/test/common/base_ult_config_listener.h"
|
2021-09-17 15:06:15 +00:00
|
|
|
#include "shared/test/common/helpers/custom_event_listener.h"
|
2023-02-14 10:19:05 +00:00
|
|
|
#include "shared/test/common/helpers/default_hw_info.h"
|
2021-01-21 13:10:13 +01:00
|
|
|
#include "shared/test/common/helpers/default_hw_info.inl"
|
2023-02-22 15:45:07 +00:00
|
|
|
#include "shared/test/common/helpers/gtest_helpers.h"
|
2021-10-06 11:43:42 +00:00
|
|
|
#include "shared/test/common/helpers/kernel_binary_helper.h"
|
2021-01-21 13:10:13 +01:00
|
|
|
#include "shared/test/common/helpers/memory_leak_listener.h"
|
|
|
|
|
#include "shared/test/common/helpers/test_files.h"
|
|
|
|
|
#include "shared/test/common/helpers/ult_hw_config.inl"
|
2021-09-17 15:06:15 +00:00
|
|
|
#include "shared/test/common/libult/global_environment.h"
|
2022-01-14 13:51:20 +00:00
|
|
|
#include "shared/test/common/libult/signal_utils.h"
|
2021-05-21 10:22:13 +00:00
|
|
|
#include "shared/test/common/mocks/mock_gmm_client_context.h"
|
2021-01-21 13:10:13 +01:00
|
|
|
#include "shared/test/common/mocks/mock_sip.h"
|
|
|
|
|
#include "shared/test/common/test_macros/test_checks_shared.h"
|
2022-08-17 10:17:02 +00:00
|
|
|
#include "shared/test/common/test_stats.h"
|
|
|
|
|
#include "shared/test/common/tests_configuration.h"
|
2020-04-07 12:03:16 +02:00
|
|
|
|
2022-06-29 12:15:26 +00:00
|
|
|
#include "hw_cmds_default.h"
|
2022-05-19 01:52:41 +00:00
|
|
|
#include "test_files_setup.h"
|
2020-04-07 12:03:16 +02:00
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <limits.h>
|
|
|
|
|
#include <mutex>
|
|
|
|
|
#include <sstream>
|
|
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
|
const char *fSeparator = "\\";
|
|
|
|
|
#else
|
|
|
|
|
const char *fSeparator = "/";
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
TEST(Should, pass) { EXPECT_TRUE(true); }
|
|
|
|
|
|
2023-02-22 15:45:07 +00:00
|
|
|
TEST(Helper, MemoryZeroed) {
|
|
|
|
|
|
|
|
|
|
uint8_t nonZero[] = {1, 0, 0};
|
|
|
|
|
uint8_t nonZero2[] = {0, 0, 0, 0, 1};
|
|
|
|
|
uint8_t zero[] = {0, 0, 0, 0, 0, 0};
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(memoryZeroed(nonZero, sizeof(nonZero)));
|
|
|
|
|
EXPECT_FALSE(memoryZeroed(nonZero2, sizeof(nonZero2)));
|
|
|
|
|
EXPECT_TRUE(memoryZeroed(zero, sizeof(zero)));
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-07 12:03:16 +02:00
|
|
|
namespace NEO {
|
|
|
|
|
extern const char *hardwarePrefix[];
|
|
|
|
|
extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT];
|
|
|
|
|
|
|
|
|
|
extern bool useMockGmm;
|
|
|
|
|
extern TestMode testMode;
|
|
|
|
|
extern const char *executionDirectorySuffix;
|
|
|
|
|
|
|
|
|
|
std::thread::id tempThreadID;
|
|
|
|
|
|
|
|
|
|
namespace MockSipData {
|
|
|
|
|
extern std::unique_ptr<MockSipKernel> mockSipKernel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace PagaFaultManagerTestConfig {
|
|
|
|
|
bool disabled = false;
|
|
|
|
|
}
|
|
|
|
|
} // namespace NEO
|
|
|
|
|
|
|
|
|
|
using namespace NEO;
|
|
|
|
|
|
2021-12-28 22:17:46 +00:00
|
|
|
extern PRODUCT_FAMILY productFamily;
|
2021-10-26 15:25:20 +00:00
|
|
|
extern GFXCORE_FAMILY renderCoreFamily;
|
2020-04-07 12:03:16 +02:00
|
|
|
bool generateRandomInput = false;
|
|
|
|
|
|
|
|
|
|
void applyWorkarounds() {
|
|
|
|
|
{
|
|
|
|
|
std::ofstream f;
|
|
|
|
|
const std::string fileName("_tmp_");
|
|
|
|
|
f.open(fileName, std::ofstream::binary);
|
|
|
|
|
f.close();
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::mutex mtx;
|
|
|
|
|
std::unique_lock<std::mutex> stateLock(mtx);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
std::stringstream ss("1");
|
|
|
|
|
int val;
|
|
|
|
|
ss >> val;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-04 15:00:09 +00:00
|
|
|
// intialize rand
|
2020-04-07 12:03:16 +02:00
|
|
|
srand(static_cast<unsigned int>(time(nullptr)));
|
|
|
|
|
|
2023-01-04 15:00:09 +00:00
|
|
|
// Create at least on thread to prevent false memory leaks in tests using threads
|
2020-04-07 12:03:16 +02:00
|
|
|
std::thread t([&]() {
|
|
|
|
|
});
|
|
|
|
|
tempThreadID = t.get_id();
|
|
|
|
|
t.join();
|
|
|
|
|
|
2023-01-04 15:00:09 +00:00
|
|
|
// Create FileLogger to prevent false memory leaks
|
2020-04-07 12:03:16 +02:00
|
|
|
{
|
2022-05-16 14:06:56 +00:00
|
|
|
NEO::fileLoggerInstance();
|
2020-04-07 12:03:16 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string getHardwarePrefix() {
|
|
|
|
|
std::string s = hardwarePrefix[defaultHwInfo->platform.eProductFamily];
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string getRunPath(char *argv0) {
|
|
|
|
|
std::string res(argv0);
|
|
|
|
|
|
|
|
|
|
auto pos = res.rfind(fSeparator);
|
|
|
|
|
if (pos != std::string::npos)
|
|
|
|
|
res = res.substr(0, pos);
|
|
|
|
|
|
|
|
|
|
if (res == "." || pos == std::string::npos) {
|
2020-05-20 23:01:05 +02:00
|
|
|
char *cwd;
|
2020-04-07 12:03:16 +02:00
|
|
|
#if defined(__linux__)
|
2020-05-20 23:01:05 +02:00
|
|
|
cwd = getcwd(nullptr, 0);
|
2020-04-07 12:03:16 +02:00
|
|
|
#else
|
2020-05-20 23:01:05 +02:00
|
|
|
cwd = _getcwd(nullptr, 0);
|
2020-04-07 12:03:16 +02:00
|
|
|
#endif
|
2020-05-20 23:01:05 +02:00
|
|
|
res = cwd;
|
|
|
|
|
free(cwd);
|
2020-04-07 12:03:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-07 12:09:44 +00:00
|
|
|
void registerMockSpirvBuiltinsInEmbeddedStorage() {
|
|
|
|
|
const std::array<ConstStringRef, 11> builtinIntermediateNames{"copy_buffer_to_buffer.builtin_kernel.bc",
|
|
|
|
|
"copy_buffer_rect.builtin_kernel.bc",
|
|
|
|
|
"fill_buffer.builtin_kernel.bc",
|
|
|
|
|
"copy_buffer_to_image3d.builtin_kernel.bc",
|
|
|
|
|
"copy_image3d_to_buffer.builtin_kernel.bc",
|
|
|
|
|
"copy_image_to_image1d.builtin_kernel.bc",
|
|
|
|
|
"copy_image_to_image2d.builtin_kernel.bc",
|
|
|
|
|
"copy_image_to_image3d.builtin_kernel.bc",
|
|
|
|
|
"fill_image1d.builtin_kernel.bc",
|
|
|
|
|
"fill_image2d.builtin_kernel.bc",
|
|
|
|
|
"fill_image3d.builtin_kernel.bc"};
|
|
|
|
|
auto &storageRegistry = EmbeddedStorageRegistry::getInstance();
|
|
|
|
|
for (auto builtinIntermediateName : builtinIntermediateNames) {
|
|
|
|
|
std::string resource = "__mock_spirv_resource";
|
|
|
|
|
storageRegistry.store(builtinIntermediateName.str(), createBuiltinResource(resource.data(), resource.size() + 1));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-07 12:03:16 +02:00
|
|
|
int main(int argc, char **argv) {
|
|
|
|
|
int retVal = 0;
|
|
|
|
|
bool useDefaultListener = false;
|
2022-02-01 09:20:45 +00:00
|
|
|
bool enableAbrt = true;
|
2022-01-14 13:51:20 +00:00
|
|
|
bool enableAlarm = true;
|
2022-02-01 09:20:45 +00:00
|
|
|
bool enableSegv = true;
|
2021-11-05 14:10:48 +00:00
|
|
|
bool showTestStats = false;
|
2022-05-05 02:32:45 +00:00
|
|
|
bool dumpTestStats = false;
|
|
|
|
|
std::string dumpTestStatsFileName = "";
|
2020-04-07 12:03:16 +02:00
|
|
|
applyWorkarounds();
|
|
|
|
|
|
|
|
|
|
#if defined(__linux__)
|
|
|
|
|
if (getenv("IGDRCL_TEST_SELF_EXEC") == nullptr) {
|
|
|
|
|
std::string wd = getRunPath(argv[0]);
|
2021-05-07 00:07:45 +00:00
|
|
|
char *ldLibraryPath = getenv("LD_LIBRARY_PATH");
|
|
|
|
|
|
|
|
|
|
if (ldLibraryPath == nullptr) {
|
|
|
|
|
setenv("LD_LIBRARY_PATH", wd.c_str(), 1);
|
|
|
|
|
} else {
|
|
|
|
|
std::string ldLibraryPathConcat = wd + ":" + std::string(ldLibraryPath);
|
|
|
|
|
setenv("LD_LIBRARY_PATH", ldLibraryPathConcat.c_str(), 1);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-07 12:03:16 +02:00
|
|
|
setenv("IGDRCL_TEST_SELF_EXEC", wd.c_str(), 1);
|
|
|
|
|
execv(argv[0], argv);
|
|
|
|
|
printf("FATAL ERROR: cannot self-exec test: %s!, errno: %d\n", argv[0], errno);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-09-02 16:12:59 +02:00
|
|
|
::testing::InitGoogleTest(&argc, argv);
|
2020-04-07 12:03:16 +02:00
|
|
|
HardwareInfo hwInfoForTests = DEFAULT_TEST_PLATFORM::hwInfo;
|
|
|
|
|
|
|
|
|
|
uint32_t euPerSubSlice = 0;
|
|
|
|
|
uint32_t sliceCount = 0;
|
|
|
|
|
uint32_t subSlicePerSliceCount = 0;
|
2020-10-06 01:51:38 -07:00
|
|
|
int32_t revId = -1;
|
2020-04-07 12:03:16 +02:00
|
|
|
int dieRecovery = 0;
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i < argc; ++i) {
|
|
|
|
|
if (!strcmp("--disable_default_listener", argv[i])) {
|
|
|
|
|
useDefaultListener = false;
|
|
|
|
|
} else if (!strcmp("--enable_default_listener", argv[i])) {
|
|
|
|
|
useDefaultListener = true;
|
|
|
|
|
} else if (!strcmp("--disable_alarm", argv[i])) {
|
2022-01-14 13:51:20 +00:00
|
|
|
enableAlarm = false;
|
2021-11-05 14:10:48 +00:00
|
|
|
} else if (!strcmp("--show_test_stats", argv[i])) {
|
|
|
|
|
showTestStats = true;
|
2022-05-05 02:32:45 +00:00
|
|
|
} else if (!strcmp("--dump_test_stats", argv[i])) {
|
|
|
|
|
dumpTestStats = true;
|
|
|
|
|
++i;
|
|
|
|
|
dumpTestStatsFileName = std::string(argv[i]);
|
2023-01-04 15:00:09 +00:00
|
|
|
} else if (!strcmp("--disable_pagefaulting_tests", argv[i])) { // disable tests which raise page fault signal during execution
|
2020-04-07 12:03:16 +02:00
|
|
|
NEO::PagaFaultManagerTestConfig::disabled = true;
|
|
|
|
|
} else if (!strcmp("--tbx", argv[i])) {
|
|
|
|
|
if (testMode == TestMode::AubTests) {
|
|
|
|
|
testMode = TestMode::AubTestsWithTbx;
|
|
|
|
|
}
|
|
|
|
|
initialHardwareTag = 0;
|
|
|
|
|
} else if (!strcmp("--rev_id", argv[i])) {
|
|
|
|
|
++i;
|
|
|
|
|
if (i < argc) {
|
|
|
|
|
revId = atoi(argv[i]);
|
|
|
|
|
}
|
|
|
|
|
} else if (!strcmp("--product", argv[i])) {
|
|
|
|
|
++i;
|
|
|
|
|
if (i < argc) {
|
|
|
|
|
if (::isdigit(argv[i][0])) {
|
|
|
|
|
int productValue = atoi(argv[i]);
|
|
|
|
|
if (productValue > 0 && productValue < IGFX_MAX_PRODUCT && hardwarePrefix[productValue] != nullptr) {
|
|
|
|
|
productFamily = static_cast<PRODUCT_FAMILY>(productValue);
|
|
|
|
|
} else {
|
|
|
|
|
productFamily = IGFX_UNKNOWN;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
productFamily = IGFX_UNKNOWN;
|
|
|
|
|
for (int j = 0; j < IGFX_MAX_PRODUCT; j++) {
|
|
|
|
|
if (hardwarePrefix[j] == nullptr)
|
|
|
|
|
continue;
|
|
|
|
|
if (strcmp(hardwarePrefix[j], argv[i]) == 0) {
|
|
|
|
|
productFamily = static_cast<PRODUCT_FAMILY>(j);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (productFamily == IGFX_UNKNOWN) {
|
|
|
|
|
std::cout << "unknown or unsupported product family has been set: " << argv[i] << std::endl;
|
|
|
|
|
return -1;
|
|
|
|
|
} else {
|
|
|
|
|
std::cout << "product family: " << hardwarePrefix[productFamily] << " (" << productFamily << ")" << std::endl;
|
|
|
|
|
}
|
|
|
|
|
hwInfoForTests = *hardwareInfoTable[productFamily];
|
|
|
|
|
}
|
|
|
|
|
} else if (!strcmp("--slices", argv[i])) {
|
|
|
|
|
++i;
|
|
|
|
|
if (i < argc) {
|
|
|
|
|
sliceCount = atoi(argv[i]);
|
|
|
|
|
}
|
|
|
|
|
} else if (!strcmp("--subslices", argv[i])) {
|
|
|
|
|
++i;
|
|
|
|
|
if (i < argc) {
|
|
|
|
|
subSlicePerSliceCount = atoi(argv[i]);
|
|
|
|
|
}
|
|
|
|
|
} else if (!strcmp("--eu_per_ss", argv[i])) {
|
|
|
|
|
++i;
|
|
|
|
|
if (i < argc) {
|
|
|
|
|
euPerSubSlice = atoi(argv[i]);
|
|
|
|
|
}
|
|
|
|
|
} else if (!strcmp("--die_recovery", argv[i])) {
|
|
|
|
|
++i;
|
|
|
|
|
if (i < argc) {
|
|
|
|
|
dieRecovery = atoi(argv[i]) ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
} else if (!strcmp("--generate_random_inputs", argv[i])) {
|
|
|
|
|
generateRandomInput = true;
|
|
|
|
|
} else if (!strcmp("--read-config", argv[i]) && (testMode == TestMode::AubTests || testMode == TestMode::AubTestsWithTbx)) {
|
|
|
|
|
if (DebugManager.registryReadAvailable()) {
|
2021-10-06 11:43:42 +00:00
|
|
|
DebugManager.setReaderImpl(SettingsReader::create(ApiSpecificConfig::getRegistryPath()));
|
2020-04-07 12:03:16 +02:00
|
|
|
DebugManager.injectSettingsFromReader();
|
|
|
|
|
}
|
|
|
|
|
} else if (!strcmp("--dump_buffer_format", argv[i]) && testMode == TestMode::AubTests) {
|
|
|
|
|
++i;
|
|
|
|
|
std::string dumpBufferFormat(argv[i]);
|
|
|
|
|
std::transform(dumpBufferFormat.begin(), dumpBufferFormat.end(), dumpBufferFormat.begin(), ::toupper);
|
|
|
|
|
DebugManager.flags.AUBDumpBufferFormat.set(dumpBufferFormat);
|
|
|
|
|
} else if (!strcmp("--dump_image_format", argv[i]) && testMode == TestMode::AubTests) {
|
|
|
|
|
++i;
|
|
|
|
|
std::string dumpImageFormat(argv[i]);
|
|
|
|
|
std::transform(dumpImageFormat.begin(), dumpImageFormat.end(), dumpImageFormat.begin(), ::toupper);
|
|
|
|
|
DebugManager.flags.AUBDumpImageFormat.set(dumpImageFormat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
productFamily = hwInfoForTests.platform.eProductFamily;
|
|
|
|
|
renderCoreFamily = hwInfoForTests.platform.eRenderCoreFamily;
|
|
|
|
|
PLATFORM &platform = hwInfoForTests.platform;
|
2020-10-06 01:51:38 -07:00
|
|
|
if (revId != -1) {
|
|
|
|
|
platform.usRevId = revId;
|
|
|
|
|
} else {
|
|
|
|
|
revId = platform.usRevId;
|
|
|
|
|
}
|
2020-04-07 12:03:16 +02:00
|
|
|
|
2023-02-28 13:26:21 +00:00
|
|
|
adjustHwInfoForTests(hwInfoForTests, euPerSubSlice, sliceCount, subSlicePerSliceCount, dieRecovery);
|
2020-04-07 12:03:16 +02:00
|
|
|
|
2023-01-03 11:46:57 +00:00
|
|
|
binaryNameSuffix.append(hardwarePrefix[hwInfoForTests.platform.eProductFamily]);
|
2020-06-10 12:47:58 +02:00
|
|
|
|
|
|
|
|
std::string testBinaryFiles = getRunPath(argv[0]);
|
|
|
|
|
testBinaryFiles.append("/");
|
|
|
|
|
testBinaryFiles.append(binaryNameSuffix);
|
|
|
|
|
testBinaryFiles.append("/");
|
2020-09-24 08:09:02 -07:00
|
|
|
testBinaryFiles.append(std::to_string(revId));
|
|
|
|
|
testBinaryFiles.append("/");
|
2020-06-10 12:47:58 +02:00
|
|
|
testBinaryFiles.append(testFiles);
|
|
|
|
|
testFiles = testBinaryFiles;
|
|
|
|
|
|
2022-05-19 01:52:41 +00:00
|
|
|
std::string nClFiles = NEO_SHARED_TEST_FILES_DIR;
|
|
|
|
|
nClFiles.append("/");
|
|
|
|
|
clFiles = nClFiles;
|
|
|
|
|
|
2022-05-20 17:24:17 +00:00
|
|
|
std::string executionDirectory("shared/");
|
|
|
|
|
executionDirectory += hardwarePrefix[productFamily];
|
2020-04-07 12:03:16 +02:00
|
|
|
executionDirectory += NEO::executionDirectorySuffix; // _aub for aub_tests, empty otherwise
|
2020-09-24 08:09:02 -07:00
|
|
|
executionDirectory += "/";
|
|
|
|
|
executionDirectory += std::to_string(revId);
|
2020-04-07 12:03:16 +02:00
|
|
|
|
2023-07-07 12:09:44 +00:00
|
|
|
registerMockSpirvBuiltinsInEmbeddedStorage();
|
|
|
|
|
|
2020-04-07 12:03:16 +02:00
|
|
|
#ifdef WIN32
|
|
|
|
|
#include <direct.h>
|
|
|
|
|
if (_chdir(executionDirectory.c_str())) {
|
|
|
|
|
std::cout << "chdir into " << executionDirectory << " directory failed.\nThis might cause test failures." << std::endl;
|
|
|
|
|
}
|
|
|
|
|
#elif defined(__linux__)
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
if (chdir(executionDirectory.c_str()) != 0) {
|
|
|
|
|
std::cout << "chdir into " << executionDirectory << " directory failed.\nThis might cause test failures." << std::endl;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
defaultHwInfo = std::make_unique<HardwareInfo>();
|
|
|
|
|
*defaultHwInfo = hwInfoForTests;
|
|
|
|
|
|
|
|
|
|
auto &listeners = ::testing::UnitTest::GetInstance()->listeners();
|
|
|
|
|
if (useDefaultListener == false) {
|
|
|
|
|
auto defaultListener = listeners.default_result_printer();
|
|
|
|
|
|
|
|
|
|
auto customEventListener = new CCustomEventListener(defaultListener, hardwarePrefix[productFamily]);
|
|
|
|
|
|
|
|
|
|
listeners.Release(defaultListener);
|
|
|
|
|
listeners.Append(customEventListener);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
listeners.Append(new MemoryLeakListener);
|
2021-09-20 14:29:22 +00:00
|
|
|
listeners.Append(new BaseUltConfigListener);
|
2020-04-07 12:03:16 +02:00
|
|
|
|
|
|
|
|
gEnvironment = reinterpret_cast<TestEnvironment *>(::testing::AddGlobalTestEnvironment(new TestEnvironment));
|
|
|
|
|
|
|
|
|
|
MockCompilerDebugVars fclDebugVars;
|
|
|
|
|
MockCompilerDebugVars igcDebugVars;
|
|
|
|
|
|
2020-11-25 15:11:11 +01:00
|
|
|
std::string builtInsFileName;
|
|
|
|
|
if (TestChecks::supportsImages(defaultHwInfo)) {
|
|
|
|
|
builtInsFileName = KernelBinaryHelper::BUILT_INS_WITH_IMAGES;
|
|
|
|
|
} else {
|
|
|
|
|
builtInsFileName = KernelBinaryHelper::BUILT_INS;
|
|
|
|
|
}
|
|
|
|
|
retrieveBinaryKernelFilename(fclDebugVars.fileName, builtInsFileName + "_", ".bc");
|
2022-10-04 18:31:33 +00:00
|
|
|
retrieveBinaryKernelFilename(igcDebugVars.fileName, builtInsFileName + "_", ".bin");
|
2020-04-07 12:03:16 +02:00
|
|
|
|
|
|
|
|
gEnvironment->setMockFileNames(fclDebugVars.fileName, igcDebugVars.fileName);
|
|
|
|
|
gEnvironment->setDefaultDebugVars(fclDebugVars, igcDebugVars, hwInfoForTests);
|
|
|
|
|
|
2022-01-14 13:51:20 +00:00
|
|
|
int sigOut = setAlarm(enableAlarm);
|
2022-02-01 09:20:45 +00:00
|
|
|
if (sigOut != 0) {
|
2022-01-14 13:51:20 +00:00
|
|
|
return sigOut;
|
2022-02-01 09:20:45 +00:00
|
|
|
}
|
2020-04-07 12:03:16 +02:00
|
|
|
|
2022-02-01 09:20:45 +00:00
|
|
|
sigOut = setSegv(enableSegv);
|
|
|
|
|
if (sigOut != 0) {
|
|
|
|
|
return sigOut;
|
2020-04-07 12:03:16 +02:00
|
|
|
}
|
|
|
|
|
|
2022-02-01 09:20:45 +00:00
|
|
|
sigOut = setAbrt(enableAbrt);
|
|
|
|
|
if (sigOut != 0) {
|
|
|
|
|
return sigOut;
|
2020-04-07 12:03:16 +02:00
|
|
|
}
|
2022-02-01 09:20:45 +00:00
|
|
|
|
2020-04-07 12:03:16 +02:00
|
|
|
if (useMockGmm) {
|
2021-06-28 17:36:16 +00:00
|
|
|
GmmHelper::createGmmContextWrapperFunc = GmmClientContext::create<MockGmmClientContext>;
|
2020-04-07 12:03:16 +02:00
|
|
|
} else {
|
|
|
|
|
GmmInterface::initialize(nullptr, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-10 12:47:58 +02:00
|
|
|
NEO::MockSipData::mockSipKernel.reset(new NEO::MockSipKernel());
|
|
|
|
|
|
2020-04-07 12:03:16 +02:00
|
|
|
retVal = RUN_ALL_TESTS();
|
|
|
|
|
|
2022-05-05 02:32:45 +00:00
|
|
|
if (showTestStats) {
|
|
|
|
|
std::cout << getTestStats() << std::endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dumpTestStats) {
|
|
|
|
|
std::ofstream dumpTestStatsFile;
|
|
|
|
|
dumpTestStatsFile.open(dumpTestStatsFileName);
|
|
|
|
|
dumpTestStatsFile << getTestStatsJson();
|
|
|
|
|
dumpTestStatsFile.close();
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-07 12:03:16 +02:00
|
|
|
return retVal;
|
|
|
|
|
}
|