use test_files from source location in ults

Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
This commit is contained in:
Artur Harasimiuk
2022-05-19 01:52:41 +00:00
committed by Compute-Runtime-Automation
parent 685b9396d4
commit dc78375d46
34 changed files with 246 additions and 215 deletions

View File

@@ -819,9 +819,14 @@ endif()
set(NEO_SCRIPT_PROJECTS_FOLDER "neo scripts") set(NEO_SCRIPT_PROJECTS_FOLDER "neo scripts")
set(NEO_SHARED_BUILTINS_DIR "${NEO_SOURCE_DIR}/shared/source/built_ins/kernels")
set(NEO_SHARED_TEST_FILES_DIR "${NEO_SOURCE_DIR}/shared/test/common/test_files")
set(NEO_OPENCL_TEST_FILES_DIR "${NEO_SOURCE_DIR}/opencl/test/unit_test/test_files")
configure_file(config.h.in ${NEO_BUILD_DIR}/config.h) configure_file(config.h.in ${NEO_BUILD_DIR}/config.h)
configure_file(driver_version.h.in ${NEO_BUILD_DIR}/driver_version.h) # Put Driver version into define configure_file(driver_version.h.in ${NEO_BUILD_DIR}/driver_version.h) # Put Driver version into define
configure_file(lib_names.h.in ${NEO_BUILD_DIR}/lib_names.h) configure_file(lib_names.h.in ${NEO_BUILD_DIR}/lib_names.h)
configure_file(test_files_setup.h.in ${NEO_BUILD_DIR}/test_files_setup.h)
if(BUILD_WITH_L0) if(BUILD_WITH_L0)
add_subdirectory_unique(level_zero) add_subdirectory_unique(level_zero)

View File

@@ -20,7 +20,7 @@ components:
infra: infra:
branch: master branch: master
dest_dir: infra dest_dir: infra
revision: 31ea9daa3f63cf497a221d6a45b58b4542cf8cfa revision: ee8c59b4691c71c36e289126259a644fdbfea559
type: git type: git
internal: internal:
branch: master branch: master

View File

@@ -116,12 +116,7 @@ function(neo_copy_test_files target product)
COMMAND echo deleting and re-creating ${product} cache directory... COMMAND echo deleting and re-creating ${product} cache directory...
COMMAND ${CMAKE_COMMAND} -E remove_directory ${outputdir}/cl_cache COMMAND ${CMAKE_COMMAND} -E remove_directory ${outputdir}/cl_cache
COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir}/cl_cache COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir}/cl_cache
COMMAND echo copying built-in kernel files from ${BUILT_IN_KERNEL_DIR}/kernels to ${outputdir}/test_files
COMMAND ${CMAKE_COMMAND} -E copy_directory ${BUILT_IN_KERNEL_DIR}/kernels ${outputdir}/test_files
COMMAND echo copying test files from ${NEO_SOURCE_DIR}/opencl/test/unit_test/test_files to ${outputdir}/test_files
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NEO_SOURCE_DIR}/opencl/test/unit_test/test_files ${outputdir}/test_files
COMMAND WORKING_DIRECTORY ${TargetDir} COMMAND WORKING_DIRECTORY ${TargetDir}
DEPENDS ${NEO_SOURCE_DIR}/opencl/test/unit_test/test_files
) )
add_dependencies(${target} copy_compiler_files) add_dependencies(${target} copy_compiler_files)
set_target_properties(${target} PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TEST_TARGETS_FOLDER}/${product}") set_target_properties(${target} PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TEST_TARGETS_FOLDER}/${product}")
@@ -130,19 +125,13 @@ endfunction()
function(neo_copy_test_files_with_revision target product revision_id) function(neo_copy_test_files_with_revision target product revision_id)
set(outputdir "${TargetDir}/${product}/${revision_id}") set(outputdir "${TargetDir}/${product}/${revision_id}")
add_custom_target(${target}) add_custom_target(${target})
add_dependencies(${target} copy_test_kernel_${product}_${revision_id})
add_custom_command( add_custom_command(
TARGET ${target} TARGET ${target}
POST_BUILD POST_BUILD
COMMAND echo deleting and re-creating ${product} cache directory... COMMAND echo deleting and re-creating ${product} cache directory...
COMMAND ${CMAKE_COMMAND} -E remove_directory ${outputdir}/cl_cache COMMAND ${CMAKE_COMMAND} -E remove_directory ${outputdir}/cl_cache
COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir}/cl_cache COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir}/cl_cache
COMMAND echo copying built-in kernel files from ${BUILT_IN_KERNEL_DIR}/kernels to ${outputdir}/test_files
COMMAND ${CMAKE_COMMAND} -E copy_directory ${BUILT_IN_KERNEL_DIR}/kernels ${outputdir}/test_files
COMMAND echo copying test files from ${NEO_SOURCE_DIR}/opencl/test/unit_test/test_files to ${outputdir}/test_files
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NEO_SOURCE_DIR}/opencl/test/unit_test/test_files ${outputdir}/test_files
COMMAND WORKING_DIRECTORY ${TargetDir} COMMAND WORKING_DIRECTORY ${TargetDir}
DEPENDS ${NEO_SOURCE_DIR}/opencl/test/unit_test/test_files
) )
add_dependencies(${target} copy_compiler_files) add_dependencies(${target} copy_compiler_files)
set_target_properties(${target} PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TEST_TARGETS_FOLDER}/${product}/${revision_id}") set_target_properties(${target} PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TEST_TARGETS_FOLDER}/${product}/${revision_id}")

View File

@@ -14,6 +14,7 @@
#include "shared/source/helpers/hash.h" #include "shared/source/helpers/hash.h"
#include "shared/source/helpers/string.h" #include "shared/source/helpers/string.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/test_files.h"
#include "shared/test/common/libult/global_environment.h" #include "shared/test/common/libult/global_environment.h"
#include "shared/test/common/mocks/mock_builtins.h" #include "shared/test/common/mocks/mock_builtins.h"
#include "shared/test/common/mocks/mock_builtinslib.h" #include "shared/test/common/mocks/mock_builtinslib.h"
@@ -238,7 +239,7 @@ TEST_F(BuiltInTests, WhenBuildingListOfBuiltinsThenBuiltinsHaveBeenGenerated) {
size_t size = 0; size_t size = 0;
for (auto &fileName : getBuiltInFileNames(supportsImages)) { for (auto &fileName : getBuiltInFileNames(supportsImages)) {
appendBuiltInStringFromFile(fileName, size); appendBuiltInStringFromFile(sharedBuiltinsDir + "/" + fileName, size);
ASSERT_NE(0u, size); ASSERT_NE(0u, size);
} }
@@ -1401,7 +1402,7 @@ TEST_F(BuiltInTests, GivenFiledNameWhenLoadingImplKernelFromFileStorageThenValid
}; };
MockFileStorage mockEmbeddedStorage("root"); MockFileStorage mockEmbeddedStorage("root");
BuiltinResourceT br = mockEmbeddedStorage.loadImpl("test_files/copybuffer.cl"); BuiltinResourceT br = mockEmbeddedStorage.loadImpl(clFiles + "copybuffer.cl");
EXPECT_NE(0u, br.size()); EXPECT_NE(0u, br.size());
BuiltinResourceT bnr = mockEmbeddedStorage.loadImpl("unknown.cl"); BuiltinResourceT bnr = mockEmbeddedStorage.loadImpl("unknown.cl");

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020-2021 Intel Corporation * Copyright (C) 2020-2022 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -11,20 +11,20 @@
namespace NEO { namespace NEO {
std::vector<std::string> builtInFileNames = { std::vector<std::string> builtInFileNames = {
"test_files/aux_translation.builtin_kernel", "aux_translation.builtin_kernel",
"test_files/copy_buffer_to_buffer.builtin_kernel", "copy_buffer_to_buffer.builtin_kernel",
"test_files/fill_buffer.builtin_kernel", "fill_buffer.builtin_kernel",
"test_files/copy_buffer_rect.builtin_kernel", "copy_buffer_rect.builtin_kernel",
"test_files/copy_kernel_timestamps.builtin_kernel"}; "copy_kernel_timestamps.builtin_kernel"};
std::vector<std::string> imageBuiltInFileNames = { std::vector<std::string> imageBuiltInFileNames = {
"test_files/fill_image1d.builtin_kernel", "fill_image1d.builtin_kernel",
"test_files/fill_image2d.builtin_kernel", "fill_image2d.builtin_kernel",
"test_files/fill_image3d.builtin_kernel", "fill_image3d.builtin_kernel",
"test_files/copy_image_to_image1d.builtin_kernel", "copy_image_to_image1d.builtin_kernel",
"test_files/copy_image_to_image2d.builtin_kernel", "copy_image_to_image2d.builtin_kernel",
"test_files/copy_image_to_image3d.builtin_kernel", "copy_image_to_image3d.builtin_kernel",
"test_files/copy_buffer_to_image3d.builtin_kernel", "copy_buffer_to_image3d.builtin_kernel",
"test_files/copy_image3d_to_buffer.builtin_kernel"}; "copy_image3d_to_buffer.builtin_kernel"};
} // namespace NEO } // namespace NEO

View File

@@ -1,10 +1,12 @@
/* /*
* Copyright (C) 2020-2021 Intel Corporation * Copyright (C) 2020-2022 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
*/ */
#include "shared/test/common/helpers/test_files.h"
#include "opencl/test/unit_test/built_ins/built_ins_file_names.h" #include "opencl/test/unit_test/built_ins/built_ins_file_names.h"
namespace NEO { namespace NEO {
@@ -21,7 +23,7 @@ std::vector<std::string> getBuiltInFileNames(bool imagesSupport) {
} }
std::string getBuiltInHashFileName(uint64_t hash, bool imagesSupport) { std::string getBuiltInHashFileName(uint64_t hash, bool imagesSupport) {
std::string hashName = "test_files/" + std::to_string(hash); std::string hashName = sharedFiles + "/" + std::to_string(hash);
if (imagesSupport) { if (imagesSupport) {
hashName.append("_images"); hashName.append("_images");
} }

View File

@@ -441,7 +441,7 @@ TEST(EventsTracker, givenTwoEventsWithCommonParentEventThenDumpingProperGraph) {
} }
TEST(EventsTracker, whenCalingCreateDumpStreamThenGettingValidFstreamInstance) { TEST(EventsTracker, whenCalingCreateDumpStreamThenGettingValidFstreamInstance) {
std::string testFileName("test_files\\EventsTracker_testfile.gv"); std::string testFileName("EventsTracker_testfile.gv");
std::shared_ptr<std::ostream> stream = EventsTracker::getEventsTracker().createDumpStream(testFileName); std::shared_ptr<std::ostream> stream = EventsTracker::getEventsTracker().createDumpStream(testFileName);
EXPECT_TRUE(stream->good()); EXPECT_TRUE(stream->good());

View File

@@ -32,6 +32,7 @@
#include "opencl/test/unit_test/ult_config_listener.h" #include "opencl/test/unit_test/ult_config_listener.h"
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "test_files_setup.h"
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>
@@ -335,13 +336,8 @@ int main(int argc, char **argv) {
nBinaryKernelFiles.append(testFiles); nBinaryKernelFiles.append(testFiles);
testFiles = nBinaryKernelFiles; testFiles = nBinaryKernelFiles;
std::string nClFiles = getRunPath(argv[0]); std::string nClFiles = NEO_OPENCL_TEST_FILES_DIR;
nClFiles.append("/"); nClFiles.append("/");
nClFiles.append(hardwarePrefix[productFamily]);
nClFiles.append("/");
nClFiles.append(std::to_string(revId));
nClFiles.append("/");
nClFiles.append(clFiles);
clFiles = nClFiles; clFiles = nClFiles;
std::string executionDirectory(hardwarePrefix[productFamily]); std::string executionDirectory(hardwarePrefix[productFamily]);

View File

@@ -12,9 +12,6 @@ list(GET mt_test_config 3 eu_per_ss)
list(GET mt_test_config 4 revision_id) list(GET mt_test_config 4 revision_id)
add_custom_target(run_${product}_${revision_id}_mt_unit_tests DEPENDS igdrcl_mt_tests) add_custom_target(run_${product}_${revision_id}_mt_unit_tests DEPENDS igdrcl_mt_tests)
if(NOT WIN32)
add_dependencies(run_${product}_${revision_id}_mt_unit_tests copy_test_files_${product}_${revision_id})
endif()
unset(GTEST_OUTPUT) unset(GTEST_OUTPUT)
if(DEFINED GTEST_OUTPUT_DIR) if(DEFINED GTEST_OUTPUT_DIR)

View File

@@ -406,7 +406,7 @@ TEST(DecoderTests, GivenProperStructWhenReadingStructFieldsThenFieldsVectorGetsP
TEST(DecoderTests, GivenProperPatchListFileWhenParsingTokensThenFileIsParsedCorrectly) { TEST(DecoderTests, GivenProperPatchListFileWhenParsingTokensThenFileIsParsedCorrectly) {
MockDecoder decoder; MockDecoder decoder;
decoder.pathToPatch = "test_files/"; decoder.pathToPatch = clFiles;
decoder.parseTokens(); decoder.parseTokens();
EXPECT_EQ(static_cast<uint32_t>(28), (decoder.programHeader.size)); EXPECT_EQ(static_cast<uint32_t>(28), (decoder.programHeader.size));
@@ -532,7 +532,7 @@ TEST(DecoderTests, GivenValidBinaryWithoutPatchTokensWhenProcessingBinaryThenBin
std::stringstream ptmFile; std::stringstream ptmFile;
MockDecoder decoder; MockDecoder decoder;
decoder.pathToPatch = "test_files/"; decoder.pathToPatch = clFiles;
decoder.pathToDump = "non_existing_folder/"; decoder.pathToDump = "non_existing_folder/";
decoder.parseTokens(); decoder.parseTokens();
@@ -583,7 +583,7 @@ TEST(DecoderTests, GivenValidBinaryWhenProcessingBinaryThenProgramAndKernelAndPa
std::vector<char> binary(binaryString.begin(), binaryString.end()); std::vector<char> binary(binaryString.begin(), binaryString.end());
std::stringstream ptmFile; std::stringstream ptmFile;
MockDecoder decoder; MockDecoder decoder;
decoder.pathToPatch = "test_files/"; decoder.pathToPatch = clFiles;
decoder.pathToDump = "non_existing_folder/"; decoder.pathToDump = "non_existing_folder/";
decoder.parseTokens(); decoder.parseTokens();

View File

@@ -6,6 +6,7 @@
*/ */
#include "shared/source/compiler_interface/compiler_options/compiler_options.h" #include "shared/source/compiler_interface/compiler_options/compiler_options.h"
#include "shared/test/common/helpers/test_files.h"
#include "shared/test/common/test_macros/test.h" #include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/helpers/gtest_helpers.h" #include "shared/test/unit_test/helpers/gtest_helpers.h"
@@ -25,7 +26,7 @@ BDWTEST_F(MockOfflineCompilerBdwTests, givenDebugOptionAndBdwThenInternalOptionS
"-options", "-options",
"-g", "-g",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
"bdw"}; "bdw"};

View File

@@ -13,6 +13,7 @@
#include "environment.h" #include "environment.h"
#include "limits.h" #include "limits.h"
#include "test_files_setup.h"
#ifdef WIN32 #ifdef WIN32
const char *fSeparator = "\\"; const char *fSeparator = "\\";
@@ -119,6 +120,10 @@ int main(int argc, char **argv) {
testFiles = nTestFiles; testFiles = nTestFiles;
binaryNameSuffix.append(familyNameWithType); binaryNameSuffix.append(familyNameWithType);
std::string nClFiles = NEO_OPENCL_TEST_FILES_DIR;
nClFiles.append("/");
clFiles = nClFiles;
#ifdef WIN32 #ifdef WIN32
#include <direct.h> #include <direct.h>
if (_chdir(familyNameWithType.c_str())) { if (_chdir(familyNameWithType.c_str())) {

View File

@@ -37,10 +37,11 @@ TEST(OclocApiTests, WhenOclocVersionIsCalledThenCurrentOclocVersionIsReturned) {
} }
TEST(OclocApiTests, WhenGoodArgsAreGivenThenSuccessIsReturned) { TEST(OclocApiTests, WhenGoodArgsAreGivenThenSuccessIsReturned) {
std::string clFileName(clFiles + "copybuffer.cl");
const char *argv[] = { const char *argv[] = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFileName.c_str(),
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
unsigned int argc = sizeof(argv) / sizeof(const char *); unsigned int argc = sizeof(argv) / sizeof(const char *);
@@ -58,10 +59,11 @@ TEST(OclocApiTests, WhenGoodArgsAreGivenThenSuccessIsReturned) {
} }
TEST(OclocApiTests, GivenQuietModeAndValidArgumentsWhenRunningOclocThenSuccessIsReturnedAndBuildSucceededMessageIsNotPrinted) { TEST(OclocApiTests, GivenQuietModeAndValidArgumentsWhenRunningOclocThenSuccessIsReturnedAndBuildSucceededMessageIsNotPrinted) {
std::string clFileName(clFiles + "copybuffer.cl");
const char *argv[] = { const char *argv[] = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFileName.c_str(),
"-q", "-q",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -175,10 +177,11 @@ TEST(OclocApiTests, GivenInvalidQueryWhenQueryingThenErrorIsReturned) {
} }
TEST(OclocApiTests, WhenGoodFamilyNameIsProvidedThenSuccessIsReturned) { TEST(OclocApiTests, WhenGoodFamilyNameIsProvidedThenSuccessIsReturned) {
std::string clFileName(clFiles + "copybuffer.cl");
const char *argv[] = { const char *argv[] = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFileName.c_str(),
"-device", "-device",
NEO::familyName[NEO::DEFAULT_PLATFORM::hwInfo.platform.eRenderCoreFamily]}; NEO::familyName[NEO::DEFAULT_PLATFORM::hwInfo.platform.eRenderCoreFamily]};
unsigned int argc = sizeof(argv) / sizeof(const char *); unsigned int argc = sizeof(argv) / sizeof(const char *);
@@ -268,15 +271,16 @@ TEST(OclocApiTests, givenInputOptionsCalledOptionsWhenCmdlineIsPrintedThenQuotes
} }
TEST(OclocApiTests, givenInvalidInputOptionsAndInternalOptionsFilesWhenCmdlineIsPrintedThenTheyArePrinted) { TEST(OclocApiTests, givenInvalidInputOptionsAndInternalOptionsFilesWhenCmdlineIsPrintedThenTheyArePrinted) {
ASSERT_TRUE(fileExists("test_files/shouldfail.cl")); ASSERT_TRUE(fileExists(clFiles + "shouldfail.cl"));
ASSERT_TRUE(fileExists("test_files/shouldfail_options.txt")); ASSERT_TRUE(fileExists(clFiles + "shouldfail_options.txt"));
ASSERT_TRUE(fileExists("test_files/shouldfail_internal_options.txt")); ASSERT_TRUE(fileExists(clFiles + "shouldfail_internal_options.txt"));
std::string clFileName(clFiles + "shouldfail.cl");
const char *argv[] = { const char *argv[] = {
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/shouldfail.cl", clFileName.c_str(),
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
unsigned int argc = sizeof(argv) / sizeof(const char *); unsigned int argc = sizeof(argv) / sizeof(const char *);
@@ -297,7 +301,9 @@ TEST(OclocApiTests, givenInvalidInputOptionsAndInternalOptionsFilesWhenCmdlineIs
} }
TEST(OclocApiTests, GivenInvalidOptionsAndInternalOptionsCommandArgumentsWhenCmdlineIsPrintedThenTheyAreNotPrinted) { TEST(OclocApiTests, GivenInvalidOptionsAndInternalOptionsCommandArgumentsWhenCmdlineIsPrintedThenTheyAreNotPrinted) {
ASSERT_TRUE(fileExists("test_files/shouldfail.cl")); std::string clFileName(clFiles + "shouldfail.cl");
ASSERT_TRUE(fileExists(clFileName));
const char *argv[] = { const char *argv[] = {
"ocloc", "ocloc",
@@ -307,7 +313,7 @@ TEST(OclocApiTests, GivenInvalidOptionsAndInternalOptionsCommandArgumentsWhenCmd
"-internal_options", "-internal_options",
"-invalid_internal_option", "-invalid_internal_option",
"-file", "-file",
"test_files/shouldfail.cl", clFileName.c_str(),
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
unsigned int argc = sizeof(argv) / sizeof(const char *); unsigned int argc = sizeof(argv) / sizeof(const char *);
@@ -328,14 +334,15 @@ TEST(OclocApiTests, GivenInvalidOptionsAndInternalOptionsCommandArgumentsWhenCmd
} }
TEST(OclocApiTests, givenInvalidOclocOptionsFileWhenCmdlineIsPrintedThenTheyArePrinted) { TEST(OclocApiTests, givenInvalidOclocOptionsFileWhenCmdlineIsPrintedThenTheyArePrinted) {
ASSERT_TRUE(fileExists("test_files/valid_kernel.cl")); ASSERT_TRUE(fileExists(clFiles + "valid_kernel.cl"));
ASSERT_TRUE(fileExists("test_files/valid_kernel_ocloc_options.txt")); ASSERT_TRUE(fileExists(clFiles + "valid_kernel_ocloc_options.txt"));
std::string clFileName(clFiles + "valid_kernel.cl");
const char *argv[] = { const char *argv[] = {
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/valid_kernel.cl", clFileName.c_str(),
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
unsigned int argc = sizeof(argv) / sizeof(const char *); unsigned int argc = sizeof(argv) / sizeof(const char *);

View File

@@ -574,7 +574,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenMutiplePlatformWhenSecon
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
platformTarget}; platformTarget};
@@ -605,7 +605,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenClosedRangeTooExtensiveW
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
configString.str()}; configString.str()};
@@ -710,7 +710,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenTwoPlatformsWhenFatBinar
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
platformsTarget}; platformsTarget};
@@ -764,7 +764,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenPlatformsClosedRangeWhen
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
platformsTarget}; platformsTarget};
@@ -813,7 +813,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenPlatformsOpenRangeToWhen
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
platformsTarget}; platformsTarget};
@@ -862,7 +862,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenPlatformsOpenRangeFromWh
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
platformsTarget}; platformsTarget};
@@ -916,7 +916,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenTwoConfigsWhenFatBinaryB
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
configsTarget}; configsTarget};
@@ -961,7 +961,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenProductConfigOpenRangeFr
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
configsTarget}; configsTarget};
@@ -1006,7 +1006,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenProductConfigOpenRangeTo
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
configsTarget}; configsTarget};
@@ -1059,7 +1059,7 @@ TEST_F(OclocFatBinaryGetTargetConfigsForFatbinary, GivenProductConfigClosedRange
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
configsTarget}; configsTarget};
@@ -1382,7 +1382,7 @@ TEST(OclocFatBinaryHelpersTest, GivenPreviousCompilationErrorWhenBuildingFatbina
const std::vector<std::string> argv = { const std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1410,7 +1410,7 @@ TEST(OclocFatBinaryHelpersTest, GivenPreviousCompilationSuccessAndFailingBuildWh
const std::vector<std::string> argv = { const std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1451,7 +1451,7 @@ TEST(OclocFatBinaryHelpersTest, GivenNonEmptyBuildLogWhenBuildingFatbinaryForTar
const std::vector<std::string> argv = { const std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1488,7 +1488,7 @@ TEST(OclocFatBinaryHelpersTest, GivenQuietModeWhenBuildingFatbinaryForTargetThen
const std::vector<std::string> argv = { const std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-q", "-q",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};

View File

@@ -91,7 +91,7 @@ bool isAnyIrSectionDefined(const SectionHeaders &sectionHeaders) {
} }
TEST_F(MultiCommandTests, WhenBuildingMultiCommandThenSuccessIsReturned) { TEST_F(MultiCommandTests, WhenBuildingMultiCommandThenSuccessIsReturned) {
nameOfFileWithArgs = "test_files/ImAMulitiComandMinimalGoodFile.txt"; nameOfFileWithArgs = "ImAMulitiComandMinimalGoodFile.txt";
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"multi", "multi",
@@ -101,7 +101,7 @@ TEST_F(MultiCommandTests, WhenBuildingMultiCommandThenSuccessIsReturned) {
std::vector<std::string> singleArgs = { std::vector<std::string> singleArgs = {
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -117,7 +117,7 @@ TEST_F(MultiCommandTests, WhenBuildingMultiCommandThenSuccessIsReturned) {
} }
TEST_F(MultiCommandTests, GivenOutputFileWhenBuildingMultiCommandThenSuccessIsReturned) { TEST_F(MultiCommandTests, GivenOutputFileWhenBuildingMultiCommandThenSuccessIsReturned) {
nameOfFileWithArgs = "test_files/ImAMulitiComandMinimalGoodFile.txt"; nameOfFileWithArgs = "ImAMulitiComandMinimalGoodFile.txt";
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"multi", "multi",
@@ -127,7 +127,7 @@ TEST_F(MultiCommandTests, GivenOutputFileWhenBuildingMultiCommandThenSuccessIsRe
std::vector<std::string> singleArgs = { std::vector<std::string> singleArgs = {
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -150,7 +150,7 @@ TEST_F(MultiCommandTests, GivenOutputFileWhenBuildingMultiCommandThenSuccessIsRe
} }
TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWhenBuildingMultiCommandThenSuccessIsReturned) { TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWhenBuildingMultiCommandThenSuccessIsReturned) {
nameOfFileWithArgs = "test_files/ImAMulitiComandMinimalGoodFile.txt"; nameOfFileWithArgs = "ImAMulitiComandMinimalGoodFile.txt";
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"multi", "multi",
@@ -160,7 +160,7 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWhenBuildingMultiCommandThenSuc
std::vector<std::string> singleArgs = { std::vector<std::string> singleArgs = {
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str(), gEnvironment->devicePrefix.c_str(),
"-out_dir", "-out_dir",
@@ -199,7 +199,7 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWithProductConfigValueWhenBuild
} }
} }
nameOfFileWithArgs = "test_files/ImAMulitiComandMinimalGoodFile.txt"; nameOfFileWithArgs = "ImAMulitiComandMinimalGoodFile.txt";
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"multi", "multi",
@@ -209,7 +209,7 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWithProductConfigValueWhenBuild
std::vector<std::string> singleArgs = { std::vector<std::string> singleArgs = {
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
configStr, configStr,
"-out_dir", "-out_dir",
@@ -235,11 +235,11 @@ TEST_F(MultiCommandTests, GivenSpecifiedOutputDirWithProductConfigValueWhenBuild
} }
TEST_F(MultiCommandTests, GivenMissingTextFileWithArgsWhenBuildingMultiCommandThenInvalidFileErrorIsReturned) { TEST_F(MultiCommandTests, GivenMissingTextFileWithArgsWhenBuildingMultiCommandThenInvalidFileErrorIsReturned) {
nameOfFileWithArgs = "test_files/ImANotExistedComandFile.txt"; nameOfFileWithArgs = "ImANotExistedComandFile.txt";
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"multi", "multi",
"test_files/ImANaughtyFile.txt", "ImANaughtyFile.txt",
"-q", "-q",
}; };
@@ -253,7 +253,7 @@ TEST_F(MultiCommandTests, GivenMissingTextFileWithArgsWhenBuildingMultiCommandTh
DebugManager.flags.PrintDebugMessages.set(false); DebugManager.flags.PrintDebugMessages.set(false);
} }
TEST_F(MultiCommandTests, GivenLackOfClFileWhenBuildingMultiCommandThenInvalidFileErrorIsReturned) { TEST_F(MultiCommandTests, GivenLackOfClFileWhenBuildingMultiCommandThenInvalidFileErrorIsReturned) {
nameOfFileWithArgs = "test_files/ImAMulitiComandMinimalGoodFile.txt"; nameOfFileWithArgs = "ImAMulitiComandMinimalGoodFile.txt";
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"multi", "multi",
@@ -263,7 +263,7 @@ TEST_F(MultiCommandTests, GivenLackOfClFileWhenBuildingMultiCommandThenInvalidFi
std::vector<std::string> singleArgs = { std::vector<std::string> singleArgs = {
"-file", "-file",
"test_files/ImANaughtyFile.cl", clFiles + "ImANaughtyFile.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -280,7 +280,7 @@ TEST_F(MultiCommandTests, GivenLackOfClFileWhenBuildingMultiCommandThenInvalidFi
deleteFileWithArgs(); deleteFileWithArgs();
} }
TEST_F(MultiCommandTests, GivenOutputFileListFlagWhenBuildingMultiCommandThenSuccessIsReturned) { TEST_F(MultiCommandTests, GivenOutputFileListFlagWhenBuildingMultiCommandThenSuccessIsReturned) {
nameOfFileWithArgs = "test_files/ImAMulitiComandMinimalGoodFile.txt"; nameOfFileWithArgs = "ImAMulitiComandMinimalGoodFile.txt";
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"multi", "multi",
@@ -292,7 +292,7 @@ TEST_F(MultiCommandTests, GivenOutputFileListFlagWhenBuildingMultiCommandThenSuc
std::vector<std::string> singleArgs = { std::vector<std::string> singleArgs = {
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -342,7 +342,7 @@ TEST(MultiCommandWhiteboxTest, GivenVerboseModeAndDefinedOutputFilenameAndDirect
std::vector<std::string> singleArgs = { std::vector<std::string> singleArgs = {
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-output", "-output",
"SpecialOutputFilename", "SpecialOutputFilename",
"-out_dir", "-out_dir",
@@ -612,7 +612,7 @@ TEST_F(OfflineCompilerTests, Given32BitModeFlagWhenParsingThenInternalOptionsCon
"ocloc", "ocloc",
"compile", "compile",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
flag, flag,
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -636,7 +636,7 @@ TEST_F(OfflineCompilerTests, Given64BitModeFlagWhenParsingThenInternalOptionsCon
"ocloc", "ocloc",
"compile", "compile",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
flag, flag,
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -656,7 +656,7 @@ TEST_F(OfflineCompilerTests, Given32BitModeFlagAnd64BitModeFlagWhenParsingThenEr
"ocloc", "ocloc",
"compile", "compile",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-32", "-32",
"-64", "-64",
"-device", "-device",
@@ -690,7 +690,7 @@ TEST_F(OfflineCompilerTests, GivenFlagStringWhenParsingThenInternalBooleanIsSetA
"ocloc", "ocloc",
"compile", "compile",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
flagString, flagString,
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -719,7 +719,7 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenOfflineCompilerIsCreatedThenSuccessIsR
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -757,7 +757,7 @@ TEST_F(OfflineCompilerTests, givenProperDeviceIdHexAsDeviceArgumentThenSuccessIs
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
deviceString.str()}; deviceString.str()};
@@ -780,7 +780,7 @@ TEST_F(OfflineCompilerTests, givenIncorrectDeviceIdHexThenInvalidDeviceIsReturne
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
"0x0"}; "0x0"};
@@ -797,7 +797,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWithMissingRevisionValueWhenIn
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
"9.1."}; "9.1."};
testing::internal::CaptureStdout(); testing::internal::CaptureStdout();
@@ -812,7 +812,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWithInvalidPatternThenInvalidD
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
"9.1.."}; "9.1.."};
testing::internal::CaptureStdout(); testing::internal::CaptureStdout();
@@ -827,7 +827,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWithMissingMajorValueWhenInval
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
".1.2"}; ".1.2"};
testing::internal::CaptureStdout(); testing::internal::CaptureStdout();
@@ -842,7 +842,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWhenInvalidRevisionValueIsPass
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
"9.0.a"}; "9.0.a"};
testing::internal::CaptureStdout(); testing::internal::CaptureStdout();
@@ -857,7 +857,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWhenInvalidMinorValueIsPassedT
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
"9.a"}; "9.a"};
testing::internal::CaptureStdout(); testing::internal::CaptureStdout();
@@ -872,7 +872,7 @@ TEST_F(OfflineCompilerTests, givenDeviceNumerationWhenPassedValuesAreOutOfRangeT
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
"256.350"}; "256.350"};
testing::internal::CaptureStdout(); testing::internal::CaptureStdout();
@@ -909,7 +909,7 @@ TEST_F(OfflineCompilerTests, givenIncorrectDeviceIdWithIncorrectHexPatternThenIn
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
"0xnonexist"}; "0xnonexist"};
testing::internal::CaptureStdout(); testing::internal::CaptureStdout();
@@ -930,7 +930,7 @@ TEST_F(OfflineCompilerTests, givenDebugOptionThenInternalOptionShouldContainKern
"-options", "-options",
"-g", "-g",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -949,7 +949,7 @@ TEST_F(OfflineCompilerTests, givenDashGInBiggerOptionStringWhenInitializingThenI
"-options", "-options",
"-gNotRealDashGOption", "-gNotRealDashGOption",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -965,7 +965,7 @@ TEST_F(OfflineCompilerTests, givenExcludeIrFromZebinInternalOptionWhenInitIsPerf
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-internal_options", "-internal_options",
"-ze-allow-zebin -ze-exclude-ir-from-zebin", "-ze-allow-zebin -ze-exclude-ir-from-zebin",
"-device", "-device",
@@ -981,7 +981,7 @@ TEST_F(OfflineCompilerTests, givenValidArgumentsAndFclInitFailureWhenInitIsPerfo
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1004,7 +1004,7 @@ TEST_F(OfflineCompilerTests, givenValidArgumentsAndIgcInitFailureWhenInitIsPerfo
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1027,7 +1027,7 @@ TEST_F(OfflineCompilerTests, givenExcludeIrArgumentWhenInitIsPerformedThenIrExcl
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-exclude_ir", "-exclude_ir",
"-internal_options", "-internal_options",
"-ze-allow-zebin", "-ze-allow-zebin",
@@ -1046,7 +1046,7 @@ TEST_F(OfflineCompilerTests, givenExcludeIrArgumentAndExcludeIrFromZebinInternal
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-exclude_ir", "-exclude_ir",
"-internal_options", "-internal_options",
"-ze-allow-zebin -ze-exclude-ir-from-zebin", "-ze-allow-zebin -ze-exclude-ir-from-zebin",
@@ -1068,7 +1068,7 @@ TEST_F(OfflineCompilerTests, givenExcludeIrArgumentWhenCompilingKernelThenIrShou
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-exclude_ir", "-exclude_ir",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1093,7 +1093,7 @@ TEST_F(OfflineCompilerTests, givenLackOfExcludeIrArgumentWhenCompilingKernelThen
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1117,7 +1117,7 @@ TEST_F(OfflineCompilerTests, givenZeroSizeInputFileWhenInitializationIsPerformed
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1137,7 +1137,7 @@ TEST_F(OfflineCompilerTests, givenInvalidIgcOutputWhenCompilingKernelThenOutOfHo
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1160,7 +1160,7 @@ TEST_F(OfflineCompilerTests, givenIgcBuildFailureWhenCompilingKernelThenBuildPro
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1183,7 +1183,7 @@ TEST_F(OfflineCompilerTests, givenInvalidFclOutputWhenCompilingKernelThenOutOfHo
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1206,7 +1206,7 @@ TEST_F(OfflineCompilerTests, givenFclTranslationContextCreationFailureWhenCompil
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1230,7 +1230,7 @@ TEST_F(OfflineCompilerTests, givenFclTranslationContextCreationFailureAndErrorMe
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1254,7 +1254,7 @@ TEST_F(OfflineCompilerTests, givenVariousClStdValuesWhenCompilingSourceThenCorre
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1301,7 +1301,7 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingThenBuildSucceeds) {
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1341,7 +1341,7 @@ TEST_F(OfflineCompilerTests, GivenArgsWhenBuildingWithDeviceConfigValueThenBuild
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
configStr}; configStr};
@@ -1368,7 +1368,7 @@ TEST_F(OfflineCompilerTests, GivenLlvmTextWhenBuildingThenBuildSucceeds) {
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str(), gEnvironment->devicePrefix.c_str(),
"-llvm_text"}; "-llvm_text"};
@@ -1391,7 +1391,7 @@ TEST_F(OfflineCompilerTests, WhenFclNotNeededThenDontLoadIt) {
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str(), gEnvironment->devicePrefix.c_str(),
"-spirv_input"}; "-spirv_input"};
@@ -1407,7 +1407,7 @@ TEST_F(OfflineCompilerTests, WhenParsingBinToCharArrayThenCorrectResult) {
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1451,7 +1451,7 @@ TEST_F(OfflineCompilerTests, GivenCppFileWhenBuildingThenBuildSucceeds) {
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str(), gEnvironment->devicePrefix.c_str(),
"-cpp_file"}; "-cpp_file"};
@@ -1474,7 +1474,7 @@ TEST_F(OfflineCompilerTests, GivenOutputDirWhenBuildingThenBuildSucceeds) {
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str(), gEnvironment->devicePrefix.c_str(),
"-out_dir", "-out_dir",
@@ -1511,7 +1511,7 @@ TEST_F(OfflineCompilerTests, GivenInvalidFileWhenBuildingThenInvalidFileErrorIsR
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/ImANaughtyFile.cl", clFiles + "ImANaughtyFile.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1529,7 +1529,7 @@ TEST_F(OfflineCompilerTests, GivenInvalidFlagWhenBuildingThenInvalidCommandLineE
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-n", "-n",
"test_files/ImANaughtyFile.cl", clFiles + "ImANaughtyFile.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1562,7 +1562,7 @@ TEST_F(OfflineCompilerTests, GivenInvalidOptionsWhenBuildingThenInvalidCommandLi
std::vector<std::string> argvB = { std::vector<std::string> argvB = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/ImANaughtyFile.cl", clFiles + "ImANaughtyFile.cl",
"-device"}; "-device"};
testing::internal::CaptureStdout(); testing::internal::CaptureStdout();
pOfflineCompiler = OfflineCompiler::create(argvB.size(), argvB, true, retVal, oclocArgHelperWithoutInput.get()); pOfflineCompiler = OfflineCompiler::create(argvB.size(), argvB, true, retVal, oclocArgHelperWithoutInput.get());
@@ -1578,7 +1578,7 @@ TEST_F(OfflineCompilerTests, GivenNonexistantDeviceWhenCompilingThenInvalidDevic
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
"foobar"}; "foobar"};
@@ -1594,7 +1594,7 @@ TEST_F(OfflineCompilerTests, GivenInvalidKernelWhenBuildingThenBuildProgramFailu
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/shouldfail.cl", clFiles + "shouldfail.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1667,8 +1667,10 @@ TEST(OfflineCompilerTest, GivenDelimitersWhenGettingStringThenParseIsCorrect) {
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler()); auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
ASSERT_NE(nullptr, mockOfflineCompiler); ASSERT_NE(nullptr, mockOfflineCompiler);
std::string kernelFileName(sharedBuiltinsDir + "/copy_buffer_to_buffer.builtin_kernel");
size_t srcSize = 0; size_t srcSize = 0;
auto ptrSrc = loadDataFromFile("test_files/copy_buffer_to_buffer.builtin_kernel", srcSize); auto ptrSrc = loadDataFromFile(kernelFileName.c_str(), srcSize);
const std::string src = ptrSrc.get(); const std::string src = ptrSrc.get();
ASSERT_EQ(srcSize, src.size()); ASSERT_EQ(srcSize, src.size());
@@ -1804,7 +1806,7 @@ TEST(OfflineCompilerTest, GivenSourceCodeWhenBuildingThenSuccessIsReturned) {
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -1825,7 +1827,7 @@ TEST(OfflineCompilerTest, givenSpvOnlyOptionPassedWhenCmdLineParsedThenGenerateO
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-output", "-output",
"myOutputFileName", "myOutputFileName",
"-spv_only", "-spv_only",
@@ -1860,7 +1862,7 @@ TEST(OfflineCompilerTest, GivenKernelWhenNoCharAfterKernelSourceThenBuildWithSuc
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/emptykernel.cl", clFiles + "emptykernel.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -2041,7 +2043,7 @@ TEST(OfflineCompilerTest, givenIntermediateRepresentationInputWhenBuildSourceCod
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/emptykernel.cl", clFiles + "emptykernel.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -2079,7 +2081,7 @@ TEST(OfflineCompilerTest, givenUseLlvmBcFlagWhenBuildingIrBinaryThenProperTransl
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/emptykernel.cl", clFiles + "emptykernel.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -2100,13 +2102,13 @@ TEST(OfflineCompilerTest, givenUseLlvmBcFlagWhenBuildingIrBinaryThenProperTransl
} }
TEST(OfflineCompilerTest, givenBinaryInputThenDontTruncateSourceAtFirstZero) { TEST(OfflineCompilerTest, givenBinaryInputThenDontTruncateSourceAtFirstZero) {
std::vector<std::string> argvLlvm = {"ocloc", "-llvm_input", "-file", "test_files/binary_with_zeroes", std::vector<std::string> argvLlvm = {"ocloc", "-llvm_input", "-file", clFiles + "binary_with_zeroes",
"-device", gEnvironment->devicePrefix.c_str()}; "-device", gEnvironment->devicePrefix.c_str()};
auto mockOfflineCompiler = std::make_unique<MockOfflineCompiler>(); auto mockOfflineCompiler = std::make_unique<MockOfflineCompiler>();
mockOfflineCompiler->initialize(argvLlvm.size(), argvLlvm); mockOfflineCompiler->initialize(argvLlvm.size(), argvLlvm);
EXPECT_LT(0U, mockOfflineCompiler->sourceCode.size()); EXPECT_LT(0U, mockOfflineCompiler->sourceCode.size());
std::vector<std::string> argvSpirV = {"ocloc", "-spirv_input", "-file", "test_files/binary_with_zeroes", std::vector<std::string> argvSpirV = {"ocloc", "-spirv_input", "-file", clFiles + "binary_with_zeroes",
"-device", gEnvironment->devicePrefix.c_str()}; "-device", gEnvironment->devicePrefix.c_str()};
mockOfflineCompiler = std::make_unique<MockOfflineCompiler>(); mockOfflineCompiler = std::make_unique<MockOfflineCompiler>();
mockOfflineCompiler->initialize(argvSpirV.size(), argvSpirV); mockOfflineCompiler->initialize(argvSpirV.size(), argvSpirV);
@@ -2125,7 +2127,7 @@ TEST(OfflineCompilerTest, givenSpirvInputFileWhenCmdLineHasOptionsThenCorrectOpt
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/emptykernel.cl", clFiles + "emptykernel.cl",
"-spirv_input", "-spirv_input",
"-device", "-device",
gEnvironment->devicePrefix.c_str(), gEnvironment->devicePrefix.c_str(),
@@ -2150,7 +2152,7 @@ TEST(OfflineCompilerTest, givenOutputFileOptionWhenSourceIsCompiledThenOutputFil
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-output", "-output",
"myOutputFileName", "myOutputFileName",
"-device", "-device",
@@ -2178,7 +2180,7 @@ TEST(OfflineCompilerTest, givenDebugDataAvailableWhenSourceIsBuiltThenDebugDataF
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-output", "-output",
"myOutputFileName", "myOutputFileName",
"-device", "-device",
@@ -2236,14 +2238,14 @@ TEST(OfflineCompilerTest, givenInputOptionsAndInternalOptionsFilesWhenOfflineCom
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler()); auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
ASSERT_NE(nullptr, mockOfflineCompiler); ASSERT_NE(nullptr, mockOfflineCompiler);
ASSERT_TRUE(fileExists("test_files/shouldfail_options.txt")); ASSERT_TRUE(fileExists(clFiles + "shouldfail_options.txt"));
ASSERT_TRUE(fileExists("test_files/shouldfail_internal_options.txt")); ASSERT_TRUE(fileExists(clFiles + "shouldfail_internal_options.txt"));
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/shouldfail.cl", clFiles + "shouldfail.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -2269,13 +2271,13 @@ TEST(OfflineCompilerTest, givenInputOptionsFileWithSpecialCharsWhenOfflineCompil
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler()); auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
ASSERT_NE(nullptr, mockOfflineCompiler); ASSERT_NE(nullptr, mockOfflineCompiler);
ASSERT_TRUE(fileExists("test_files/simple_kernels_opts_options.txt")); ASSERT_TRUE(fileExists(clFiles + "simple_kernels_opts_options.txt"));
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/simple_kernels_opts.cl", clFiles + "simple_kernels_opts.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -2290,13 +2292,13 @@ TEST(OfflineCompilerTest, givenInputOptionsAndOclockOptionsFileWithForceStosOptW
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler()); auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
ASSERT_NE(nullptr, mockOfflineCompiler); ASSERT_NE(nullptr, mockOfflineCompiler);
ASSERT_TRUE(fileExists("test_files/stateful_copy_buffer_ocloc_options.txt")); ASSERT_TRUE(fileExists(clFiles + "stateful_copy_buffer_ocloc_options.txt"));
std::vector<std::string> argv = { std::vector<std::string> argv = {
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/stateful_copy_buffer.cl", clFiles + "stateful_copy_buffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -2486,8 +2488,8 @@ TEST(OfflineCompilerTest, givenCompilerWhenBuildSourceCodeFailsThenGenerateElfBi
TEST(OfflineCompilerTest, givenDeviceSpecificKernelFileWhenCompilerIsInitializedThenOptionsAreReadFromFile) { TEST(OfflineCompilerTest, givenDeviceSpecificKernelFileWhenCompilerIsInitializedThenOptionsAreReadFromFile) {
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler()); auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
ASSERT_NE(nullptr, mockOfflineCompiler); ASSERT_NE(nullptr, mockOfflineCompiler);
const char *kernelFileName = "test_files/kernel_for_specific_device.skl"; std::string kernelFileName(clFiles + "kernel_for_specific_device.skl");
const char *optionsFileName = "test_files/kernel_for_specific_device_options.txt"; std::string optionsFileName(clFiles + "kernel_for_specific_device_options.txt");
ASSERT_TRUE(fileExists(kernelFileName)); ASSERT_TRUE(fileExists(kernelFileName));
ASSERT_TRUE(fileExists(optionsFileName)); ASSERT_TRUE(fileExists(optionsFileName));
@@ -2513,7 +2515,7 @@ TEST(OfflineCompilerTest, givenHexadecimalRevisionIdWhenCompilerIsInitializedThe
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str(), gEnvironment->devicePrefix.c_str(),
"-revision_id", "-revision_id",
@@ -2535,7 +2537,7 @@ TEST(OfflineCompilerTest, givenDebugVariableSetWhenInitializingThenOverrideRevis
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str(), gEnvironment->devicePrefix.c_str(),
"-revision_id", "-revision_id",
@@ -2554,7 +2556,7 @@ TEST(OfflineCompilerTest, givenDecimalRevisionIdWhenCompilerIsInitializedThenPas
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str(), gEnvironment->devicePrefix.c_str(),
"-revision_id", "-revision_id",
@@ -2573,7 +2575,7 @@ TEST(OfflineCompilerTest, givenNoRevisionIdWhenCompilerIsInitializedThenHwInfoHa
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -2601,7 +2603,7 @@ TEST(OfflineCompilerTest, whenDeviceIsSpecifiedThenDefaultConfigFromTheDeviceIsU
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -2669,7 +2671,7 @@ TEST(OclocCompile, whenDetectedPotentialInputTypeMismatchThenEmitsWarning) {
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-device", "-device",
gEnvironment->devicePrefix.c_str()}; gEnvironment->devicePrefix.c_str()};
@@ -2711,7 +2713,7 @@ TEST(OclocCompile, givenCommandLineWithoutDeviceWhenCompilingToSpirvThenSucceeds
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-spv_only"}; "-spv_only"};
int retVal = ocloc.initialize(argv.size(), argv); int retVal = ocloc.initialize(argv.size(), argv);
@@ -2728,7 +2730,7 @@ TEST(OclocCompile, givenDeviceAndInternalOptionsOptionWhenCompilingToSpirvThenIn
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-internal_options", "-internal_options",
"-cl-ext=+custom_param", "-cl-ext=+custom_param",
"-device", "-device",
@@ -2751,7 +2753,7 @@ TEST(OclocCompile, givenNoDeviceAndInternalOptionsOptionWhenCompilingToSpirvThen
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-internal_options", "-internal_options",
"-cl-ext=+custom_param", "-cl-ext=+custom_param",
"-spv_only"}; "-spv_only"};
@@ -2782,7 +2784,7 @@ TEST(OclocCompile, givenSpirvInputThenDontGenerateSpirvFile) {
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/binary_with_zeroes", clFiles + "binary_with_zeroes",
"-out_dir", "-out_dir",
"offline_compiler_test", "offline_compiler_test",
"-device", "-device",
@@ -2805,7 +2807,7 @@ TEST(OclocCompile, givenFormatFlagWithKnownFormatPassedThenEnforceSpecifiedForma
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-spv_only", "-spv_only",
"--format", "--format",
"patchtokens"}; "patchtokens"};
@@ -2814,7 +2816,7 @@ TEST(OclocCompile, givenFormatFlagWithKnownFormatPassedThenEnforceSpecifiedForma
"ocloc", "ocloc",
"-q", "-q",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-spv_only", "-spv_only",
"--format", "--format",
"zebin"}; "zebin"};
@@ -2835,7 +2837,7 @@ TEST(OclocCompile, givenFormatFlagWithUnknownFormatPassedThenPrintWarning) {
std::vector<std::string> argvUnknownFormatEnforced = { std::vector<std::string> argvUnknownFormatEnforced = {
"ocloc", "ocloc",
"-file", "-file",
"test_files/copybuffer.cl", clFiles + "copybuffer.cl",
"-spv_only", "-spv_only",
"--format", "--format",
"banana"}; "banana"};

View File

@@ -7,6 +7,7 @@
#include "shared/source/helpers/constants.h" #include "shared/source/helpers/constants.h"
#include "shared/source/helpers/file_io.h" #include "shared/source/helpers/file_io.h"
#include "shared/source/os_interface/linux/os_inc.h"
#include "shared/source/os_interface/linux/os_memory_linux.h" #include "shared/source/os_interface/linux/os_memory_linux.h"
#include "shared/source/utilities/stackvec.h" #include "shared/source/utilities/stackvec.h"
@@ -104,7 +105,7 @@ TEST(OSMemoryLinux, givenOSMemoryLinuxWhenReserveCpuAddressRangeIsCalledAndBaseA
TEST(OSMemoryLinux, GivenProcSelfMapsFileExistsWhenGetMemoryMapsIsQueriedThenValidValueIsReturned) { TEST(OSMemoryLinux, GivenProcSelfMapsFileExistsWhenGetMemoryMapsIsQueriedThenValidValueIsReturned) {
auto mockOSMemoryLinux = MockOSMemoryLinux::create(); auto mockOSMemoryLinux = MockOSMemoryLinux::create();
std::string mapsFile = "test_files/linux/proc/self/maps"; std::string mapsFile(std::string(Os::sysFsProcPathPrefix) + "self/maps");
EXPECT_TRUE(fileExists(mapsFile)); EXPECT_TRUE(fileExists(mapsFile));
OSMemory::MemoryMaps memoryMaps; OSMemory::MemoryMaps memoryMaps;

View File

@@ -9,11 +9,13 @@
#include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/device_factory.h" #include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/linux/os_context_linux.h" #include "shared/source/os_interface/linux/os_context_linux.h"
#include "shared/source/os_interface/linux/os_inc.h"
#include "shared/source/os_interface/os_interface.h" #include "shared/source/os_interface/os_interface.h"
#include "shared/test/common/fixtures/memory_management_fixture.h" #include "shared/test/common/fixtures/memory_management_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h" #include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/helpers/test_files.h"
#include "shared/test/common/libult/linux/drm_mock.h" #include "shared/test/common/libult/linux/drm_mock.h"
#include "shared/test/common/mocks/linux/mock_os_context_linux.h" #include "shared/test/common/mocks/linux/mock_os_context_linux.h"
#include "shared/test/common/mocks/mock_memory_manager.h" #include "shared/test/common/mocks/mock_memory_manager.h"
@@ -27,6 +29,13 @@
using namespace NEO; using namespace NEO;
std::string getLinuxDevicesPath(const char *file) {
std::string resultString(Os::sysFsPciPathPrefix);
resultString += file;
return resultString;
}
TEST(DrmTest, WhenGettingDeviceIdThenCorrectIdReturned) { TEST(DrmTest, WhenGettingDeviceIdThenCorrectIdReturned) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>(); auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->prepareRootDeviceEnvironments(1);
@@ -886,7 +895,7 @@ TEST(DrmQueryTest, GivenNonTileArchitectureWhenFrequencyIsQueriedThenFallbackToL
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 0; hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 0;
hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true; hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true;
std::string gtMaxFreqFile = "test_files/linux/devices/device/drm/card1/gt_max_freq_mhz"; std::string gtMaxFreqFile = getLinuxDevicesPath("device/drm/card1/gt_max_freq_mhz");
EXPECT_TRUE(fileExists(gtMaxFreqFile)); EXPECT_TRUE(fileExists(gtMaxFreqFile));
drm.setPciPath("device"); drm.setPciPath("device");
@@ -909,7 +918,7 @@ TEST(DrmQueryTest, GivenTileArchitectureIsInvalidWhenFrequencyIsQueriedThenFallb
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 2; hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 2;
hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = false; hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = false;
std::string gtMaxFreqFile = "test_files/linux/devices/device/drm/card1/gt_max_freq_mhz"; std::string gtMaxFreqFile = getLinuxDevicesPath("device/drm/card1/gt_max_freq_mhz");
EXPECT_TRUE(fileExists(gtMaxFreqFile)); EXPECT_TRUE(fileExists(gtMaxFreqFile));
drm.setPciPath("device"); drm.setPciPath("device");
@@ -932,7 +941,7 @@ TEST(DrmQueryTest, GivenRpsMaxFreqFileExistsWhenFrequencyIsQueriedThenValidValue
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 1; hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 1;
hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true; hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true;
std::string rpsMaxFreqFile = "test_files/linux/devices/device/drm/card1/gt/gt0/rps_max_freq_mhz"; std::string rpsMaxFreqFile = getLinuxDevicesPath("device/drm/card1/gt/gt0/rps_max_freq_mhz");
EXPECT_TRUE(fileExists(rpsMaxFreqFile)); EXPECT_TRUE(fileExists(rpsMaxFreqFile));
drm.setPciPath("device"); drm.setPciPath("device");
@@ -955,7 +964,7 @@ TEST(DrmQueryTest, GivenRpsMaxFreqFilesExistWhenFrequenciesAreQueriedThenValidVa
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 2; hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 2;
hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true; hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true;
std::string rpsMaxFreqFile = "test_files/linux/devices/device/drm/card1/gt/gt1/rps_max_freq_mhz"; std::string rpsMaxFreqFile = getLinuxDevicesPath("device/drm/card1/gt/gt1/rps_max_freq_mhz");
EXPECT_TRUE(fileExists(rpsMaxFreqFile)); EXPECT_TRUE(fileExists(rpsMaxFreqFile));
drm.setPciPath("device"); drm.setPciPath("device");
@@ -978,10 +987,10 @@ TEST(DrmQueryTest, GivenRpsMaxFreqFileDoesntExistWhenFrequencyIsQueriedThenFallb
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 3; hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = 3;
hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true; hwInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true;
std::string rpsMaxFreqFile = "test_files/linux/devices/device/drm/card1/gt/gt2/rps_max_freq_mhz"; std::string rpsMaxFreqFile = getLinuxDevicesPath("device/drm/card1/gt/gt2/rps_max_freq_mhz");
EXPECT_FALSE(fileExists(rpsMaxFreqFile)); EXPECT_FALSE(fileExists(rpsMaxFreqFile));
std::string gtMaxFreqFile = "test_files/linux/devices/device/drm/card1/gt_max_freq_mhz"; std::string gtMaxFreqFile = getLinuxDevicesPath("device/drm/card1/gt_max_freq_mhz");
EXPECT_TRUE(fileExists(gtMaxFreqFile)); EXPECT_TRUE(fileExists(gtMaxFreqFile));
drm.setPciPath("device"); drm.setPciPath("device");
@@ -1007,7 +1016,7 @@ TEST(DrmQueryTest, givenUapiPrelimVersionThenReturnCorrectString) {
executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->prepareRootDeviceEnvironments(1);
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]}; DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
std::string prelimVersionFile = "test_files/linux/devices/device/drm/card1/prelim_uapi_version"; std::string prelimVersionFile = getLinuxDevicesPath("device/drm/card1/prelim_uapi_version");
EXPECT_TRUE(fileExists(prelimVersionFile)); EXPECT_TRUE(fileExists(prelimVersionFile));
drm.setPciPath("device"); drm.setPciPath("device");

View File

@@ -10,10 +10,13 @@
#include "shared/source/helpers/file_io.h" #include "shared/source/helpers/file_io.h"
#include "config.h" #include "config.h"
#include "test_files_setup.h"
std::string testFiles("test_files/" NEO_ARCH "/"); std::string testFiles("test_files/" NEO_ARCH "/");
std::string testFilesApiSpecific("test_files/" NEO_ARCH "/"); std::string testFilesApiSpecific("test_files/" NEO_ARCH "/");
std::string clFiles("test_files/"); std::string clFiles("test_files/");
std::string sharedFiles(NEO_SHARED_TEST_FILES_DIR);
std::string sharedBuiltinsDir(NEO_SHARED_BUILTINS_DIR);
std::string binaryNameSuffix(""); std::string binaryNameSuffix("");
void retrieveBinaryKernelFilename(std::string &outputFilename, const std::string &kernelName, const std::string &extension, const std::string &options) { void retrieveBinaryKernelFilename(std::string &outputFilename, const std::string &kernelName, const std::string &extension, const std::string &options) {

View File

@@ -10,6 +10,8 @@
extern std::string testFiles; extern std::string testFiles;
extern std::string testFilesApiSpecific; extern std::string testFilesApiSpecific;
extern std::string sharedFiles;
extern std::string sharedBuiltinsDir;
extern std::string clFiles; extern std::string clFiles;
extern std::string binaryNameSuffix; extern std::string binaryNameSuffix;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 Intel Corporation * Copyright (C) 2021-2022 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -7,22 +7,27 @@
#include "shared/source/utilities/directory.h" #include "shared/source/utilities/directory.h"
#include "test_files_setup.h"
#include <cstdio> #include <cstdio>
#include <dirent.h> #include <dirent.h>
namespace NEO { namespace NEO {
std::string byPathPattern(std::string(NEO_SHARED_TEST_FILES_DIR) + "/linux/by-path");
std::string deviceDrmPath(std::string(NEO_SHARED_TEST_FILES_DIR) + "/linux/devices/device/drm");
std::vector<std::string> Directory::getFiles(const std::string &path) { std::vector<std::string> Directory::getFiles(const std::string &path) {
std::vector<std::string> files; std::vector<std::string> files;
if (path == "./test_files/linux/by-path") { if (path == byPathPattern) {
files.push_back("./test_files/linux/by-path/pci-0000:00:02.0-card"); files.push_back(byPathPattern + "/pci-0000:00:02.0-card");
files.push_back("./test_files/linux/by-path/pci-0000:00:02.0-render"); files.push_back(byPathPattern + "/pci-0000:00:02.0-render");
files.push_back("./test_files/linux/by-path/pci-0000:00:03.0-card"); files.push_back(byPathPattern + "/pci-0000:00:03.0-card");
files.push_back("./test_files/linux/by-path/pci-0000:00:03.0-render"); files.push_back(byPathPattern + "/pci-0000:00:03.0-render");
return files; return files;
} }
if (path == "./test_files/linux/devices/device/drm") { if (path == deviceDrmPath) {
files.push_back("./test_files/linux/devices/device/drm/card1"); files.push_back(deviceDrmPath + "/card1");
return files; return files;
} }
if (path == "/sys/class/intel_pmt") { if (path == "/sys/class/intel_pmt") {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2021 Intel Corporation * Copyright (C) 2018-2022 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -9,6 +9,7 @@
#include "common/gtsysinfo.h" #include "common/gtsysinfo.h"
#include "igfxfmid.h" #include "igfxfmid.h"
#include "test_files_setup.h"
namespace Os { namespace Os {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@@ -24,9 +25,9 @@ const char *metricsLibraryDllName = "";
const char *gdiDllName = ""; const char *gdiDllName = "";
const char *dxcoreDllName = ""; const char *dxcoreDllName = "";
#endif #endif
const char *sysFsPciPathPrefix = "./test_files/linux/devices/"; const char *sysFsPciPathPrefix = NEO_SHARED_TEST_FILES_DIR "/linux/devices/";
const char *pciDevicesDirectory = "./test_files/linux/by-path"; const char *pciDevicesDirectory = NEO_SHARED_TEST_FILES_DIR "/linux/by-path";
const char *sysFsProcPathPrefix = "./test_files/linux/proc/"; const char *sysFsProcPathPrefix = NEO_SHARED_TEST_FILES_DIR "/linux/proc/";
} // namespace Os } // namespace Os
NEO::OsLibrary *setAdapterInfo(const PLATFORM *platform, const GT_SYSTEM_INFO *gtSystemInfo, uint64_t gpuAddressSpace) { NEO::OsLibrary *setAdapterInfo(const PLATFORM *platform, const GT_SYSTEM_INFO *gtSystemInfo, uint64_t gpuAddressSpace) {

View File

@@ -9,6 +9,7 @@
#include "shared/source/os_interface/linux/sys_calls.h" #include "shared/source/os_interface/linux/sys_calls.h"
#include "drm/i915_drm.h" #include "drm/i915_drm.h"
#include "test_files_setup.h"
#include <cstdint> #include <cstdint>
#include <cstdio> #include <cstdio>
@@ -68,7 +69,7 @@ int open(const char *file, int flags) {
if (strcmp(file, "/dev/dri/by-path/pci-0000:invalid-render") == 0) { if (strcmp(file, "/dev/dri/by-path/pci-0000:invalid-render") == 0) {
return 0; return 0;
} }
if (strcmp(file, "./test_files/linux/by-path/pci-0000:00:02.0-render") == 0) { if (strcmp(file, NEO_SHARED_TEST_FILES_DIR "/linux/by-path/pci-0000:00:02.0-render") == 0) {
return fakeFileDescriptor; return fakeFileDescriptor;
} }

View File

@@ -49,23 +49,6 @@ function(compile_kernels_gen platform_name_with_type revision_id platform_name s
set(compiled_kernels_${platform_name_with_type}_${revision_id} ${compiled_kernels_${platform_name_with_type}_${revision_id}} PARENT_SCOPE) set(compiled_kernels_${platform_name_with_type}_${revision_id} ${compiled_kernels_${platform_name_with_type}_${revision_id}} PARENT_SCOPE)
endfunction() endfunction()
function(neo_shared_copy_test_files target product revision_id)
string(TOLOWER ${product} product)
set(dest_dir "${TargetDir}/${product}/${revision_id}/test_files")
set(source_dir "${NEO_SOURCE_DIR}/shared/test/common/test_files")
add_custom_target(${target})
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND echo copying test files from ${source_dir} to ${dest_dir}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${source_dir} ${dest_dir}
WORKING_DIRECTORY ${TargetDir}
DEPENDS ${source_dir}
)
add_dependencies(${target} copy_compiler_files)
set_target_properties(${target} PROPERTIES FOLDER "${SHARED_TEST_PROJECTS_FOLDER}/${SHARED_TEST_PROJECTS_SUB_FOLDER}/${PLATFORM_SPECIFIC_TEST_TARGETS_FOLDER}/${product}/${revision_id}")
endfunction()
file(GLOB_RECURSE TEST_KERNELS *.cl) file(GLOB_RECURSE TEST_KERNELS *.cl)
file(GLOB_RECURSE TEST_KERNELS_IMAGES *_images.cl) file(GLOB_RECURSE TEST_KERNELS_IMAGES *_images.cl)
add_custom_target(prepare_test_kernels_for_shared) add_custom_target(prepare_test_kernels_for_shared)
@@ -80,8 +63,7 @@ macro(macro_for_each_platform)
foreach(PLATFORM_TYPE ${PLATFORM_TYPES}) foreach(PLATFORM_TYPE ${PLATFORM_TYPES})
foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS}) foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS})
if(${PLATFORM_IT}_IS_${PLATFORM_TYPE}) if(${PLATFORM_IT}_IS_${PLATFORM_TYPE})
neo_shared_copy_test_files(copy_test_kernel_${PLATFORM_IT_LOWER}_${REVISION_ID} ${PLATFORM_IT} ${REVISION_ID}) add_dependencies(prepare_test_kernels_for_shared copy_compiler_files)
add_dependencies(prepare_test_kernels_for_shared copy_test_kernel_${PLATFORM_IT_LOWER}_${REVISION_ID})
endif() endif()
endforeach() endforeach()
endforeach() endforeach()

View File

@@ -29,6 +29,7 @@
#include "shared/test/unit_test/tests_configuration.h" #include "shared/test/unit_test/tests_configuration.h"
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "test_files_setup.h"
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>
@@ -320,6 +321,10 @@ int main(int argc, char **argv) {
testBinaryFiles.append(testFiles); testBinaryFiles.append(testFiles);
testFiles = testBinaryFiles; testFiles = testBinaryFiles;
std::string nClFiles = NEO_SHARED_TEST_FILES_DIR;
nClFiles.append("/");
clFiles = nClFiles;
std::string executionDirectory(hardwarePrefix[productFamily]); std::string executionDirectory(hardwarePrefix[productFamily]);
executionDirectory += NEO::executionDirectorySuffix; // _aub for aub_tests, empty otherwise executionDirectory += NEO::executionDirectorySuffix; // _aub for aub_tests, empty otherwise
executionDirectory += "/"; executionDirectory += "/";

View File

@@ -18,8 +18,8 @@
using namespace NEO; using namespace NEO;
TEST(CpuInfoAarch64, givenProcCpuinfoFileExistsWhenIsCpuFlagPresentIsCalledThenValidValueIsReturned) { TEST(CpuInfoAarch64, givenProcCpuinfoFileExistsWhenIsCpuFlagPresentIsCalledThenValidValueIsReturned) {
VariableBackup<const char *> pathPrefixBackup(&Os::sysFsProcPathPrefix, "./test_files"); VariableBackup<const char *> pathPrefixBackup(&Os::sysFsProcPathPrefix, ".");
std::string cpuinfoFile = "./test_files/cpuinfo"; std::string cpuinfoFile = "cpuinfo";
EXPECT_FALSE(fileExists(cpuinfoFile)); EXPECT_FALSE(fileExists(cpuinfoFile));
{ {

View File

@@ -13,7 +13,7 @@ TEST(SettingsFileReader, givenTestFileWithDefaultValuesWhenTheyAreQueriedThenDef
// Use test settings file // Use test settings file
std::unique_ptr<TestSettingsFileReader> reader = std::unique_ptr<TestSettingsFileReader> reader =
std::unique_ptr<TestSettingsFileReader>(new TestSettingsFileReader(TestSettingsFileReader::testPath)); std::unique_ptr<TestSettingsFileReader>(new TestSettingsFileReader(TestSettingsFileReader::getTestPath().c_str()));
ASSERT_NE(nullptr, reader); ASSERT_NE(nullptr, reader);

View File

@@ -7,6 +7,7 @@
#include "shared/source/helpers/file_io.h" #include "shared/source/helpers/file_io.h"
#include "shared/source/utilities/debug_file_reader.h" #include "shared/source/utilities/debug_file_reader.h"
#include "shared/test/common/helpers/test_files.h"
#include "shared/test/common/test_macros/test.h" #include "shared/test/common/test_macros/test.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@@ -35,13 +36,14 @@ class TestSettingsFileReader : public SettingsFileReader {
return settingStringMap.size(); return settingStringMap.size();
} }
static const char *testPath; static const std::string getTestPath() {
static const char *stringTestPath; return clFiles + "igdrcl.config";
}
static const std::string getStringTestPath() {
return clFiles + "igdrcl_string.config";
}
}; };
const char *TestSettingsFileReader::testPath = "./test_files/igdrcl.config";
const char *TestSettingsFileReader::stringTestPath = "./test_files/igdrcl_string.config";
TEST(SettingsFileReader, GivenFilesDoesNotExistWhenCreatingFileReaderThenCreationSucceeds) { TEST(SettingsFileReader, GivenFilesDoesNotExistWhenCreatingFileReaderThenCreationSucceeds) {
bool settingsFileExists = fileExists(SettingsReader::settingsFileName); bool settingsFileExists = fileExists(SettingsReader::settingsFileName);
@@ -59,7 +61,7 @@ TEST(SettingsFileReader, GivenFilesDoesNotExistWhenCreatingFileReaderThenCreatio
TEST(SettingsFileReader, WhenGettingSettingThenCorrectStringValueIsReturned) { TEST(SettingsFileReader, WhenGettingSettingThenCorrectStringValueIsReturned) {
// Use test settings file // Use test settings file
auto reader = std::make_unique<TestSettingsFileReader>(TestSettingsFileReader::stringTestPath); auto reader = std::make_unique<TestSettingsFileReader>(TestSettingsFileReader::getStringTestPath().c_str());
ASSERT_NE(nullptr, reader); ASSERT_NE(nullptr, reader);
std::string retValue; std::string retValue;
@@ -82,7 +84,7 @@ TEST(SettingsFileReader, WhenGettingSettingThenCorrectStringValueIsReturned) {
} }
TEST(SettingsFileReader, givenDebugFileSettingInWhichStringIsFollowedByIntegerWhenItIsParsedThenProperValuesAreObtained) { TEST(SettingsFileReader, givenDebugFileSettingInWhichStringIsFollowedByIntegerWhenItIsParsedThenProperValuesAreObtained) {
auto reader = std::make_unique<TestSettingsFileReader>(TestSettingsFileReader::stringTestPath); auto reader = std::make_unique<TestSettingsFileReader>(TestSettingsFileReader::getStringTestPath().c_str());
ASSERT_NE(nullptr, reader.get()); ASSERT_NE(nullptr, reader.get());
int32_t retValue = 0; int32_t retValue = 0;
@@ -103,7 +105,7 @@ TEST(SettingsFileReader, givenDebugFileSettingInWhichStringIsFollowedByIntegerWh
TEST(SettingsFileReader, GivenSettingNotInFileWhenGettingSettingThenProvidedDefaultIsReturned) { TEST(SettingsFileReader, GivenSettingNotInFileWhenGettingSettingThenProvidedDefaultIsReturned) {
// Use test settings file // Use test settings file
auto reader = std::make_unique<TestSettingsFileReader>(TestSettingsFileReader::testPath); auto reader = std::make_unique<TestSettingsFileReader>(TestSettingsFileReader::getTestPath().c_str());
ASSERT_NE(nullptr, reader); ASSERT_NE(nullptr, reader);
bool defaultBoolValue = false; bool defaultBoolValue = false;
@@ -123,7 +125,7 @@ TEST(SettingsFileReader, GivenSettingNotInFileWhenGettingSettingThenProvidedDefa
} }
TEST(SettingsFileReader, WhenGettingAppSpecificLocationThenCorrectLocationIsReturned) { TEST(SettingsFileReader, WhenGettingAppSpecificLocationThenCorrectLocationIsReturned) {
std::unique_ptr<TestSettingsFileReader> reader(new TestSettingsFileReader(TestSettingsFileReader::testPath)); std::unique_ptr<TestSettingsFileReader> reader(new TestSettingsFileReader(TestSettingsFileReader::getTestPath().c_str()));
std::string appSpecific = "cl_cache_dir"; std::string appSpecific = "cl_cache_dir";
EXPECT_EQ(appSpecific, reader->appSpecificLocation(appSpecific)); EXPECT_EQ(appSpecific, reader->appSpecificLocation(appSpecific));
} }

View File

@@ -18,8 +18,8 @@
using namespace NEO; using namespace NEO;
TEST(CpuInfo, givenProcCpuinfoFileExistsWhenIsCpuFlagPresentIsCalledThenValidValueIsReturned) { TEST(CpuInfo, givenProcCpuinfoFileExistsWhenIsCpuFlagPresentIsCalledThenValidValueIsReturned) {
VariableBackup<const char *> pathPrefixBackup(&Os::sysFsProcPathPrefix, "./test_files"); VariableBackup<const char *> pathPrefixBackup(&Os::sysFsProcPathPrefix, ".");
std::string cpuinfoFile = "./test_files/cpuinfo"; std::string cpuinfoFile = "cpuinfo";
EXPECT_FALSE(fileExists(cpuinfoFile)); EXPECT_FALSE(fileExists(cpuinfoFile));
{ {

15
test_files_setup.h.in Normal file
View File

@@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#ifndef TEST_FILES_SETUP_H
#define TEST_FILES_SETUP_H
#cmakedefine NEO_SHARED_BUILTINS_DIR "${NEO_SHARED_BUILTINS_DIR}"
#cmakedefine NEO_SHARED_TEST_FILES_DIR "${NEO_SHARED_TEST_FILES_DIR}"
#cmakedefine NEO_OPENCL_TEST_FILES_DIR "${NEO_OPENCL_TEST_FILES_DIR}"
#endif /* TEST_FILES_SETUP_H */