1 /*
2 * Copyright (C) 2021 Intel Corporation
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #include "shared/source/compiler_interface/compiler_options/compiler_options.h"
9 #include "shared/test/common/test_macros/test.h"
10
11 #include "opencl/test/unit_test/offline_compiler/mock/mock_offline_compiler.h"
12 #include "opencl/test/unit_test/offline_compiler/offline_compiler_tests.h"
13
14 #include "gmock/gmock.h"
15
16 using namespace NEO;
17
18 using MockOfflineCompilerBdwTests = ::testing::Test;
19
BDWTEST_F(MockOfflineCompilerBdwTests,givenDebugOptionAndBdwThenInternalOptionShouldNotContainKernelDebugEnable)20 BDWTEST_F(MockOfflineCompilerBdwTests, givenDebugOptionAndBdwThenInternalOptionShouldNotContainKernelDebugEnable) {
21 std::vector<std::string> argv = {
22 "ocloc",
23 "-q",
24 "-options",
25 "-g",
26 "-file",
27 "test_files/copybuffer.cl",
28 "-device",
29 "bdw"};
30
31 auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
32 ASSERT_NE(nullptr, mockOfflineCompiler);
33 mockOfflineCompiler->initialize(argv.size(), argv);
34
35 std::string internalOptions = mockOfflineCompiler->internalOptions;
36
37 EXPECT_THAT(internalOptions, Not(::testing::HasSubstr("-cl-kernel-debug-enable")));
38 }
39
BDWTEST_F(MockOfflineCompilerBdwTests,GivenBdwWhenParseDebugSettingsThenContainsHasBufferOffsetArg)40 BDWTEST_F(MockOfflineCompilerBdwTests, GivenBdwWhenParseDebugSettingsThenContainsHasBufferOffsetArg) {
41 MockOfflineCompiler mockOfflineCompiler;
42 mockOfflineCompiler.deviceName = "bdw";
43 mockOfflineCompiler.initHardwareInfo(mockOfflineCompiler.deviceName);
44
45 mockOfflineCompiler.parseDebugSettings();
46
47 std::string internalOptions = mockOfflineCompiler.internalOptions;
48 size_t found = internalOptions.find(NEO::CompilerOptions::hasBufferOffsetArg.data());
49 EXPECT_EQ(std::string::npos, found);
50 }
51