Refactor per platform extra settings in ocloc

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
Related-To: NEO-6382
This commit is contained in:
Kamil Kopryk
2021-10-26 15:25:20 +00:00
committed by Compute-Runtime-Automation
parent 515130dbe8
commit 03540d5301
35 changed files with 359 additions and 138 deletions

View File

@ -0,0 +1,14 @@
#
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(TESTS_BDW)
set(IGDRCL_SRCS_offline_compiler_tests_bdw
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/offline_compiler_tests_bdw.cpp
)
target_sources(ocloc_tests PRIVATE ${IGDRCL_SRCS_offline_compiler_tests_bdw})
endif()

View File

@ -0,0 +1,50 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/compiler_interface/compiler_options/compiler_options.h"
#include "opencl/test/unit_test/offline_compiler/mock/mock_offline_compiler.h"
#include "opencl/test/unit_test/offline_compiler/offline_compiler_tests.h"
#include "test.h"
#include "gmock/gmock.h"
using namespace NEO;
using MockOfflineCompilerBdwTests = ::testing::Test;
BDWTEST_F(MockOfflineCompilerBdwTests, givenDebugOptionAndBdwThenInternalOptionShouldNotContainKernelDebugEnable) {
std::vector<std::string> argv = {
"ocloc",
"-q",
"-options",
"-g",
"-file",
"test_files/copybuffer.cl",
"-device",
"bdw"};
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
ASSERT_NE(nullptr, mockOfflineCompiler);
mockOfflineCompiler->initialize(argv.size(), argv);
std::string internalOptions = mockOfflineCompiler->internalOptions;
EXPECT_THAT(internalOptions, Not(::testing::HasSubstr("-cl-kernel-debug-enable")));
}
BDWTEST_F(MockOfflineCompilerBdwTests, GivenBdwWhenParseDebugSettingsThenContainsHasBufferOffsetArg) {
MockOfflineCompiler mockOfflineCompiler;
mockOfflineCompiler.deviceName = "bdw";
mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName);
mockOfflineCompiler.parseDebugSettings();
std::string internalOptions = mockOfflineCompiler.internalOptions;
size_t found = internalOptions.find(NEO::CompilerOptions::hasBufferOffsetArg.data());
EXPECT_EQ(std::string::npos, found);
}