Don't use the entire std namespace

Change-Id: I2014117a154fb2c1a61af5c31baa228b4fb3dbc2
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-03-27 15:56:17 +01:00
committed by sys_ocldev
parent 6de2b4e1cd
commit 441ff1fcdf
41 changed files with 142 additions and 184 deletions

View File

@@ -11,7 +11,6 @@
#include <thread>
using namespace std;
using namespace NEO;
namespace BuiltinKernelsSimulation {

View File

@@ -13,7 +13,6 @@
#include <mutex>
#include <thread>
using namespace std;
using namespace NEO;
namespace BuiltinKernelsSimulation {

View File

@@ -9,7 +9,6 @@
#include "opencl/source/os_interface/ocl_reg_path.h"
using namespace std;
namespace NEO {
DebugSettingsManager<globalDebugFunctionalityLevel> DebugManager(oclRegPath);

View File

@@ -7,7 +7,6 @@
#include "shared/source/source_level_debugger/source_level_debugger.h"
using namespace std;
namespace NEO {

View File

@@ -10,7 +10,6 @@
#include "opencl/test/unit_test/os_interface/windows/hw_info_config_win_tests.h"
using namespace NEO;
using namespace std;
using HwInfoConfigTestWindowsIcllp = HwInfoConfigTestWindows;

View File

@@ -10,7 +10,6 @@
#include "opencl/test/unit_test/os_interface/windows/hw_info_config_win_tests.h"
using namespace NEO;
using namespace std;
using HwInfoConfigTestWindowsTgllp = HwInfoConfigTestWindows;

View File

@@ -12,7 +12,6 @@
#include "opencl/test/unit_test/os_interface/windows/hw_info_config_win_tests.h"
using namespace NEO;
using namespace std;
using HwInfoConfigTestWindowsGen12lp = HwInfoConfigTestWindows;

View File

@@ -9,7 +9,6 @@
#include "opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h"
using namespace NEO;
using namespace std;
struct HwInfoConfigTestLinuxBdw : HwInfoConfigTestLinux {
void SetUp() override {

View File

@@ -10,7 +10,6 @@
#include "opencl/test/unit_test/os_interface/windows/hw_info_config_win_tests.h"
using namespace NEO;
using namespace std;
using HwInfoConfigTestWindowsBdw = HwInfoConfigTestWindows;

View File

@@ -9,7 +9,6 @@
#include "opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h"
using namespace NEO;
using namespace std;
struct HwInfoConfigTestLinuxBxt : HwInfoConfigTestLinux {
void SetUp() override {

View File

@@ -10,7 +10,6 @@
#include "opencl/test/unit_test/os_interface/windows/hw_info_config_win_tests.h"
using namespace NEO;
using namespace std;
using HwInfoConfigTestWindowsBxt = HwInfoConfigTestWindows;

View File

@@ -9,7 +9,6 @@
#include "opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h"
using namespace NEO;
using namespace std;
struct HwInfoConfigTestLinuxCfl : HwInfoConfigTestLinux {
void SetUp() override {

View File

@@ -10,7 +10,6 @@
#include "opencl/test/unit_test/os_interface/windows/hw_info_config_win_tests.h"
using namespace NEO;
using namespace std;
using HwInfoConfigTestWindowsCfl = HwInfoConfigTestWindows;

View File

@@ -9,7 +9,6 @@
#include "opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h"
using namespace NEO;
using namespace std;
struct HwInfoConfigTestLinuxGlk : HwInfoConfigTestLinux {
void SetUp() override {

View File

@@ -10,7 +10,6 @@
#include "opencl/test/unit_test/os_interface/windows/hw_info_config_win_tests.h"
using namespace NEO;
using namespace std;
using HwInfoConfigTestWindowsGlk = HwInfoConfigTestWindows;

View File

@@ -9,7 +9,6 @@
#include "opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h"
using namespace NEO;
using namespace std;
struct HwInfoConfigTestLinuxKbl : HwInfoConfigTestLinux {
void SetUp() override {

View File

@@ -10,7 +10,6 @@
#include "opencl/test/unit_test/os_interface/windows/hw_info_config_win_tests.h"
using namespace NEO;
using namespace std;
using HwInfoConfigTestWindowsKbl = HwInfoConfigTestWindows;

View File

@@ -9,7 +9,6 @@
#include "opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h"
using namespace NEO;
using namespace std;
struct HwInfoConfigTestLinuxSkl : HwInfoConfigTestLinux {
void SetUp() override {

View File

@@ -10,7 +10,6 @@
#include "opencl/test/unit_test/os_interface/windows/hw_info_config_win_tests.h"
using namespace NEO;
using namespace std;
using HwInfoConfigTestWindowsSkl = HwInfoConfigTestWindows;

View File

@@ -9,7 +9,6 @@
#include "opencl/source/os_interface/ocl_reg_path.h"
using namespace std;
namespace NEO {
DebugSettingsManager<globalDebugFunctionalityLevel> DebugManager(oclRegPath);

View File

@@ -20,7 +20,6 @@
#include <thread>
using namespace NEO;
using namespace std;
TEST(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSharedAllocationIsCreatedFromMultipleThreadsThenSingleBoIsReused) {
class MockDrm : public Drm {
@@ -39,14 +38,14 @@ TEST(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSharedAllocationIsCreatedFro
executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
auto mock = new MockDrm(0, *executionEnvironment.rootDeviceEnvironments[0]);
executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->setDrm(mock);
auto memoryManager = make_unique<TestedDrmMemoryManager>(executionEnvironment);
auto memoryManager = std::make_unique<TestedDrmMemoryManager>(executionEnvironment);
osHandle handle = 3;
constexpr size_t maxThreads = 10;
GraphicsAllocation *createdAllocations[maxThreads];
thread threads[maxThreads];
atomic<size_t> index(0);
std::thread threads[maxThreads];
std::atomic<size_t> index(0);
auto createFunction = [&]() {
size_t indexFree = index++;
@@ -76,8 +75,8 @@ TEST(DrmMemoryManagerTest, givenMultipleThreadsWhenSharedAllocationIsCreatedThen
primeFdHandle = 1;
closeHandle = 1;
}
atomic<int> primeFdHandle;
atomic<int> closeHandle;
std::atomic<int> primeFdHandle;
std::atomic<int> closeHandle;
int ioctl(unsigned long request, void *arg) override {
if (request == DRM_IOCTL_PRIME_FD_TO_HANDLE) {
@@ -91,7 +90,7 @@ TEST(DrmMemoryManagerTest, givenMultipleThreadsWhenSharedAllocationIsCreatedThen
else if (request == DRM_IOCTL_GEM_CLOSE) {
closeHandle++;
this_thread::yield();
std::this_thread::yield();
primeFdHandle.store(closeHandle.load());
}
@@ -104,14 +103,14 @@ TEST(DrmMemoryManagerTest, givenMultipleThreadsWhenSharedAllocationIsCreatedThen
executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
auto mock = new MockDrm(0, *executionEnvironment.rootDeviceEnvironments[0]);
executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->setDrm(mock);
auto memoryManager = make_unique<TestedDrmMemoryManager>(executionEnvironment);
auto memoryManager = std::make_unique<TestedDrmMemoryManager>(executionEnvironment);
osHandle handle = 3;
constexpr size_t maxThreads = 10;
GraphicsAllocation *createdAllocations[maxThreads];
thread threads[maxThreads];
atomic<size_t> index(0);
std::thread threads[maxThreads];
std::atomic<size_t> index(0);
auto createFunction = [&]() {
size_t indexFree = index++;
@@ -119,7 +118,7 @@ TEST(DrmMemoryManagerTest, givenMultipleThreadsWhenSharedAllocationIsCreatedThen
createdAllocations[indexFree] = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false);
EXPECT_NE(nullptr, createdAllocations[indexFree]);
this_thread::yield();
std::this_thread::yield();
memoryManager->freeGraphicsMemory(createdAllocations[indexFree]);
};

View File

@@ -11,7 +11,6 @@
#include <string>
using namespace std;
extern void generateSegfaultWithSafetyGuard(SegfaultHelper *segfaultHelper);
@@ -25,11 +24,11 @@ int main(int argc, char **argv) {
}
void captureAndCheckStdOut() {
string callstack = ::testing::internal::GetCapturedStdout();
std::string callstack = ::testing::internal::GetCapturedStdout();
EXPECT_THAT(callstack, ::testing::HasSubstr(string("Callstack")));
EXPECT_THAT(callstack, ::testing::HasSubstr(string("cloc_segfault_test")));
EXPECT_THAT(callstack, ::testing::HasSubstr(string("generateSegfaultWithSafetyGuard")));
EXPECT_THAT(callstack, ::testing::HasSubstr(std::string("Callstack")));
EXPECT_THAT(callstack, ::testing::HasSubstr(std::string("cloc_segfault_test")));
EXPECT_THAT(callstack, ::testing::HasSubstr(std::string("generateSegfaultWithSafetyGuard")));
}
TEST(SegFault, givenCallWithSafetyGuardWhenSegfaultHappensThenCallstackIsPrintedToStdOut) {

View File

@@ -12,7 +12,6 @@
#include "opencl/source/cl_device/cl_device.h"
using namespace NEO;
using namespace std;
void HwInfoConfigTest::SetUp() {
PlatformFixture::SetUp();

View File

@@ -15,7 +15,6 @@
#include "gtest/gtest.h"
using namespace NEO;
using namespace std;
struct HwInfoConfigTest : public ::testing::Test,
public PlatformFixture {

View File

@@ -19,7 +19,6 @@
#include <memory>
using namespace NEO;
using namespace std;
TEST(DrmTest, GetDeviceID) {
DrmMock *pDrm = new DrmMock;
@@ -71,8 +70,8 @@ TEST(DrmTest, GivenValidConfigFileWhenFrequencyIsQueriedThenValidValueIsReturned
pDrm->StoredDeviceID = 0x1234;
string gpuFile = "test_files/devices/config";
string gtMaxFreqFile = "test_files/devices/drm/card0/gt_max_freq_mhz";
std::string gpuFile = "test_files/devices/config";
std::string gtMaxFreqFile = "test_files/devices/drm/card0/gt_max_freq_mhz";
EXPECT_TRUE(fileExists(gpuFile));
EXPECT_TRUE(fileExists(gtMaxFreqFile));
@@ -120,7 +119,7 @@ TEST(DrmTest, GetRevisionID) {
}
TEST(DrmTest, GivenDrmWhenAskedForGttSizeThenReturnCorrectValue) {
auto drm = make_unique<DrmMock>();
auto drm = std::make_unique<DrmMock>();
uint64_t queryGttSize = 0;
drm->StoredRetValForGetGttSize = 0;

View File

@@ -78,7 +78,6 @@ struct DummyHwConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
};
using namespace NEO;
using namespace std;
void mockCpuidex(int *cpuInfo, int functionId, int subfunctionId);

View File

@@ -15,7 +15,6 @@
#include "opencl/test/unit_test/os_interface/linux/drm_mock.h"
using namespace NEO;
using namespace std;
struct HwInfoConfigTestLinux : public HwInfoConfigTest {
void SetUp() override;

View File

@@ -15,7 +15,6 @@
#include <string>
using namespace NEO;
using namespace std;
const char *perfLogPath = "perf_logs/";

View File

@@ -23,7 +23,6 @@
#include <memory>
using namespace NEO;
using namespace std;
class MockSchedulerKernel : public SchedulerKernel {
public:
@@ -59,7 +58,7 @@ class MockSchedulerKernel : public SchedulerKernel {
};
TEST(SchedulerKernelTest, getLws) {
auto device = make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device);
@@ -69,7 +68,7 @@ TEST(SchedulerKernelTest, getLws) {
}
TEST(SchedulerKernelTest, getGws) {
auto device = make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device);
@@ -85,7 +84,7 @@ TEST(SchedulerKernelTest, getGws) {
}
TEST(SchedulerKernelTest, setGws) {
auto device = make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device);
@@ -98,7 +97,7 @@ TEST(SchedulerKernelTest, setGws) {
}
TEST(SchedulerKernelTest, getCurbeSize) {
auto device = make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
KernelInfo info;
uint32_t crossTrheadDataSize = 32;
@@ -124,14 +123,14 @@ TEST(SchedulerKernelTest, setArgsForSchedulerKernel) {
auto context = clUniquePtr(new MockContext(device.get()));
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
program->setDevice(&device->getDevice());
unique_ptr<KernelInfo> info(nullptr);
std::unique_ptr<KernelInfo> info(nullptr);
KernelInfo *infoPtr = nullptr;
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr));
std::unique_ptr<MockSchedulerKernel> scheduler = std::unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr));
info.reset(infoPtr);
unique_ptr<MockGraphicsAllocation> allocs[9];
std::unique_ptr<MockGraphicsAllocation> allocs[9];
for (uint32_t i = 0; i < 9; i++) {
allocs[i] = unique_ptr<MockGraphicsAllocation>(new MockGraphicsAllocation((void *)0x1234, 10));
allocs[i] = std::unique_ptr<MockGraphicsAllocation>(new MockGraphicsAllocation((void *)0x1234, 10));
}
scheduler->setArgs(allocs[0].get(),
@@ -155,14 +154,14 @@ TEST(SchedulerKernelTest, setArgsForSchedulerKernelWithNullDebugQueue) {
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
program->setDevice(&device->getDevice());
unique_ptr<KernelInfo> info(nullptr);
std::unique_ptr<KernelInfo> info(nullptr);
KernelInfo *infoPtr = nullptr;
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr));
std::unique_ptr<MockSchedulerKernel> scheduler = std::unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr));
info.reset(infoPtr);
unique_ptr<MockGraphicsAllocation> allocs[9];
std::unique_ptr<MockGraphicsAllocation> allocs[9];
for (uint32_t i = 0; i < 9; i++) {
allocs[i] = unique_ptr<MockGraphicsAllocation>(new MockGraphicsAllocation((void *)0x1234, 10));
allocs[i] = std::unique_ptr<MockGraphicsAllocation>(new MockGraphicsAllocation((void *)0x1234, 10));
}
scheduler->setArgs(allocs[0].get(),
@@ -186,11 +185,11 @@ TEST(SchedulerKernelTest, givenGraphicsAllocationWithDifferentCpuAndGpuAddresses
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
program->setDevice(&device->getDevice());
unique_ptr<KernelInfo> info(nullptr);
std::unique_ptr<KernelInfo> info(nullptr);
KernelInfo *infoPtr = nullptr;
auto scheduler = clUniquePtr(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr));
info.reset(infoPtr);
unique_ptr<MockGraphicsAllocation> allocs[9];
std::unique_ptr<MockGraphicsAllocation> allocs[9];
for (uint32_t i = 0; i < 9; i++) {
allocs[i] = std::make_unique<MockGraphicsAllocation>(reinterpret_cast<void *>(0x1234), 0x4321, 10);
@@ -221,9 +220,9 @@ TEST(SchedulerKernelTest, createKernelReflectionForForcedSchedulerDispatch) {
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
program->setDevice(&device->getDevice());
unique_ptr<KernelInfo> info(nullptr);
std::unique_ptr<KernelInfo> info(nullptr);
KernelInfo *infoPtr = nullptr;
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr));
std::unique_ptr<MockSchedulerKernel> scheduler = std::unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr));
info.reset(infoPtr);
scheduler->createReflectionSurface();
@@ -240,9 +239,9 @@ TEST(SchedulerKernelTest, createKernelReflectionSecondTimeForForcedSchedulerDisp
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
program->setDevice(&device->getDevice());
unique_ptr<KernelInfo> info(nullptr);
std::unique_ptr<KernelInfo> info(nullptr);
KernelInfo *infoPtr = nullptr;
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr));
std::unique_ptr<MockSchedulerKernel> scheduler = std::unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr));
info.reset(infoPtr);
scheduler->createReflectionSurface();
@@ -263,9 +262,9 @@ TEST(SchedulerKernelTest, createKernelReflectionForSchedulerDoesNothing) {
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false, &device->getDevice()));
program->setDevice(&device->getDevice());
unique_ptr<KernelInfo> info(nullptr);
std::unique_ptr<KernelInfo> info(nullptr);
KernelInfo *infoPtr = nullptr;
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr));
std::unique_ptr<MockSchedulerKernel> scheduler = std::unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, device->getDevice(), infoPtr));
info.reset(infoPtr);
scheduler->createReflectionSurface();
@@ -274,7 +273,7 @@ TEST(SchedulerKernelTest, createKernelReflectionForSchedulerDoesNothing) {
}
TEST(SchedulerKernelTest, getCurbeSizeWithNullKernelInfo) {
auto device = make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
KernelInfo info;
@@ -291,7 +290,7 @@ TEST(SchedulerKernelTest, givenForcedSchedulerGwsByDebugVariableWhenSchedulerKer
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.SchedulerGWS.set(48);
auto device = make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
KernelInfo info;
MockSchedulerKernel kernel(&program, info, *device);

View File

@@ -8,13 +8,12 @@
#include "opencl/test/unit_test/utilities/debug_file_reader_tests.inl"
using namespace NEO;
using namespace std;
TEST(SettingsFileReader, givenTestFileWithDefaultValuesWhenTheyAreQueriedThenDefaultValuesMatch) {
// Use test settings file
std::unique_ptr<TestSettingsFileReader> reader =
unique_ptr<TestSettingsFileReader>(new TestSettingsFileReader(TestSettingsFileReader::testPath));
std::unique_ptr<TestSettingsFileReader>(new TestSettingsFileReader(TestSettingsFileReader::testPath));
ASSERT_NE(nullptr, reader);
@@ -35,7 +34,7 @@ TEST(SettingsFileReader, GetSetting) {
// Use test settings file
std::unique_ptr<TestSettingsFileReader> reader =
unique_ptr<TestSettingsFileReader>(new TestSettingsFileReader(TestSettingsFileReader::testPath));
std::unique_ptr<TestSettingsFileReader>(new TestSettingsFileReader(TestSettingsFileReader::testPath));
ASSERT_NE(nullptr, reader);
#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \

View File

@@ -16,7 +16,6 @@
#include <string>
using namespace NEO;
using namespace std;
class TestSettingsFileReader : public SettingsFileReader {
public:
@@ -48,7 +47,7 @@ TEST(SettingsFileReader, CreateFileReaderWithoutFile) {
}
// Use current location for file read
std::unique_ptr<TestSettingsFileReader> reader = unique_ptr<TestSettingsFileReader>(new TestSettingsFileReader());
auto reader = std::make_unique<TestSettingsFileReader>();
ASSERT_NE(nullptr, reader);
EXPECT_EQ(0u, reader->getStringSettingsCount());
@@ -56,12 +55,12 @@ TEST(SettingsFileReader, CreateFileReaderWithoutFile) {
TEST(SettingsFileReader, GetStringSettingFromFile) {
// Use test settings file
std::unique_ptr<TestSettingsFileReader> reader = unique_ptr<TestSettingsFileReader>(new TestSettingsFileReader(TestSettingsFileReader::stringTestPath));
auto reader = std::make_unique<TestSettingsFileReader>(TestSettingsFileReader::stringTestPath);
ASSERT_NE(nullptr, reader);
string retValue;
std::string retValue;
// StringTestKey is defined in file: unit_tests\helpers\test_debug_variables.inl
string returnedStringValue = reader->getSetting("StringTestKey", retValue);
std::string returnedStringValue = reader->getSetting("StringTestKey", retValue);
// "Test Value" is a value that should be read from file defined in stringTestPath member
EXPECT_STREQ(returnedStringValue.c_str(), "TestValue");
@@ -79,7 +78,7 @@ TEST(SettingsFileReader, GetStringSettingFromFile) {
}
TEST(SettingsFileReader, givenDebugFileSettingInWhichStringIsFollowedByIntegerWhenItIsParsedThenProperValuesAreObtained) {
std::unique_ptr<TestSettingsFileReader> reader(new TestSettingsFileReader(TestSettingsFileReader::stringTestPath));
auto reader = std::make_unique<TestSettingsFileReader>(TestSettingsFileReader::stringTestPath);
ASSERT_NE(nullptr, reader.get());
int32_t retValue = 0;
@@ -87,8 +86,8 @@ TEST(SettingsFileReader, givenDebugFileSettingInWhichStringIsFollowedByIntegerWh
EXPECT_EQ(1, returnedIntValue);
string retValueString;
string returnedStringValue = reader->getSetting("StringTestKey", retValueString);
std::string retValueString;
std::string returnedStringValue = reader->getSetting("StringTestKey", retValueString);
EXPECT_STREQ(returnedStringValue.c_str(), "TestValue");
}
@@ -96,7 +95,7 @@ TEST(SettingsFileReader, givenDebugFileSettingInWhichStringIsFollowedByIntegerWh
TEST(SettingsFileReader, GetSettingWhenNotInFile) {
// Use test settings file
std::unique_ptr<TestSettingsFileReader> reader = unique_ptr<TestSettingsFileReader>(new TestSettingsFileReader(TestSettingsFileReader::testPath));
auto reader = std::make_unique<TestSettingsFileReader>(TestSettingsFileReader::testPath);
ASSERT_NE(nullptr, reader);
bool defaultBoolValue = false;
@@ -109,8 +108,8 @@ TEST(SettingsFileReader, GetSettingWhenNotInFile) {
EXPECT_EQ(defaultIntValue, returnedIntValue);
string defaultStringValue = "ABCD";
string returnedStringValue = reader->getSetting("StringSettingNotExistingInFile", defaultStringValue);
std::string defaultStringValue = "ABCD";
std::string returnedStringValue = reader->getSetting("StringSettingNotExistingInFile", defaultStringValue);
EXPECT_EQ(defaultStringValue, returnedStringValue);
}
@@ -122,18 +121,18 @@ TEST(SettingsFileReader, appSpecificLocation) {
}
TEST(SettingsFileReader, givenHexNumbersSemiColonSeparatedListInInputStreamWhenParsingThenCorrectStringValueIsStored) {
std::unique_ptr<TestSettingsFileReader> reader = unique_ptr<TestSettingsFileReader>(new TestSettingsFileReader());
auto reader = std::make_unique<TestSettingsFileReader>();
ASSERT_NE(nullptr, reader);
//No settings should be parsed initially
EXPECT_EQ(0u, reader->getStringSettingsCount());
stringstream inputLineWithSemiColonList("KeyName = 0x1234;0x5555");
std::stringstream inputLineWithSemiColonList("KeyName = 0x1234;0x5555");
reader->parseStream(inputLineWithSemiColonList);
string defaultStringValue = "FailedToParse";
string returnedStringValue = reader->getSetting("KeyName", defaultStringValue);
std::string defaultStringValue = "FailedToParse";
std::string returnedStringValue = reader->getSetting("KeyName", defaultStringValue);
EXPECT_STREQ("0x1234;0x5555", returnedStringValue.c_str());
}

View File

@@ -18,7 +18,6 @@
#include <string>
using namespace NEO;
using namespace std;
TEST(SettingsReader, Create) {
SettingsReader *reader = SettingsReader::create(oclRegPath);
@@ -43,10 +42,10 @@ TEST(SettingsReader, GivenSettingsFileExistsWhenCreatingSettingsReaderThenFileRe
}
auto reader = std::unique_ptr<SettingsReader>(SettingsReader::create(oclRegPath));
EXPECT_NE(nullptr, reader.get());
string defaultValue("unk");
std::string defaultValue("unk");
EXPECT_STREQ("test", reader->getSetting("ProductFamilyOverride", defaultValue).c_str());
remove(SettingsReader::settingsFileName);
std::remove(SettingsReader::settingsFileName);
}
TEST(SettingsReader, CreateFileReader) {
@@ -72,7 +71,7 @@ TEST(SettingsReader, CreateOsReader) {
TEST(SettingsReader, CreateOsReaderWithRegKey) {
std::string regKey = oclRegPath;
unique_ptr<SettingsReader> reader(SettingsReader::createOsReader(false, regKey));
std::unique_ptr<SettingsReader> reader(SettingsReader::createOsReader(false, regKey));
EXPECT_NE(nullptr, reader);
}

View File

@@ -24,7 +24,6 @@
#include <sstream>
#include <string>
using namespace std;
using namespace NEO;
TEST(FileLogger, WithDebugFunctionality) {
@@ -190,10 +189,10 @@ TEST(FileLogger, WithDebugFunctionalityGetSizesReturnsCorectString) {
FullyEnabledFileLogger fileLogger(testFile, flags);
// getSizes returns string
uintptr_t input[3] = {1, 2, 3};
string lwsSizes = fileLogger.getSizes(input, 3, true);
string gwsSizes = fileLogger.getSizes(input, 3, false);
string lwsExpected = "localWorkSize[0]: \t1\nlocalWorkSize[1]: \t2\nlocalWorkSize[2]: \t3\n";
string gwsExpected = "globalWorkSize[0]: \t1\nglobalWorkSize[1]: \t2\nglobalWorkSize[2]: \t3\n";
std::string lwsSizes = fileLogger.getSizes(input, 3, true);
std::string gwsSizes = fileLogger.getSizes(input, 3, false);
std::string lwsExpected = "localWorkSize[0]: \t1\nlocalWorkSize[1]: \t2\nlocalWorkSize[2]: \t3\n";
std::string gwsExpected = "globalWorkSize[0]: \t1\nglobalWorkSize[1]: \t2\nglobalWorkSize[2]: \t3\n";
EXPECT_EQ(lwsExpected, lwsSizes);
EXPECT_EQ(gwsExpected, gwsSizes);
}
@@ -205,8 +204,8 @@ TEST(FileLogger, WithDebugFunctionalityGetSizesNegative) {
FullyEnabledFileLogger fileLogger(testFile, flags);
// getSizes returns string
string lwsSizes = fileLogger.getSizes(nullptr, 3, true);
string gwsSizes = fileLogger.getSizes(nullptr, 3, false);
std::string lwsSizes = fileLogger.getSizes(nullptr, 3, true);
std::string gwsSizes = fileLogger.getSizes(nullptr, 3, false);
EXPECT_EQ(0u, lwsSizes.size());
EXPECT_EQ(0u, gwsSizes.size());
@@ -219,8 +218,8 @@ TEST(FileLogger, WithoutDebugFunctionalityGetSizesDoesNotReturnString) {
FullyDisabledFileLogger fileLogger(testFile, flags);
uintptr_t input[3] = {1, 2, 3};
string lwsSizes = fileLogger.getSizes(input, 3, true);
string gwsSizes = fileLogger.getSizes(input, 3, false);
std::string lwsSizes = fileLogger.getSizes(input, 3, true);
std::string gwsSizes = fileLogger.getSizes(input, 3, false);
EXPECT_EQ(0u, lwsSizes.size());
EXPECT_EQ(0u, gwsSizes.size());
}
@@ -234,7 +233,7 @@ TEST(FileLogger, WithDebugFunctionalityGetEventsReturnsCorectString) {
// getEvents returns string
uintptr_t event = 8;
uintptr_t *input[3] = {&event, &event, &event};
string eventsString = fileLogger.getEvents((uintptr_t *)input, 2);
std::string eventsString = fileLogger.getEvents((uintptr_t *)input, 2);
EXPECT_NE(0u, eventsString.size());
}
@@ -244,7 +243,7 @@ TEST(FileLogger, WithDebugFunctionalityGetEventsNegative) {
FullyEnabledFileLogger fileLogger(testFile, flags);
// getEvents returns 0 sized string
string event = fileLogger.getEvents(nullptr, 2);
std::string event = fileLogger.getEvents(nullptr, 2);
EXPECT_EQ(0u, event.size());
}
@@ -260,9 +259,9 @@ TEST(FileLogger, GivenLoggerWithDebugFunctionalityWhenGetMemObjectsIsCalledThenC
cl_mem clMemObjects[] = {clMem, clMem};
cl_uint numObjects = 2;
string memObjectString = fileLogger.getMemObjects(reinterpret_cast<const uintptr_t *>(clMemObjects), numObjects);
std::string memObjectString = fileLogger.getMemObjects(reinterpret_cast<const uintptr_t *>(clMemObjects), numObjects);
EXPECT_NE(0u, memObjectString.size());
stringstream output;
std::stringstream output;
output << "cl_mem " << clMem << ", MemObj " << memoryObject;
EXPECT_THAT(memObjectString, ::testing::HasSubstr(output.str()));
}
@@ -271,7 +270,7 @@ TEST(FileLogger, GivenDebugFunctionalityWhenGetMemObjectsIsCalledWithNullptrThen
std::string testFile = "testfile";
DebugVariables flags;
FullyEnabledFileLogger fileLogger(testFile, flags);
string memObjectString = fileLogger.getMemObjects(nullptr, 2);
std::string memObjectString = fileLogger.getMemObjects(nullptr, 2);
EXPECT_EQ(0u, memObjectString.size());
}
@@ -279,7 +278,7 @@ TEST(FileLogger, GiveDisabledDebugFunctionalityWhenGetMemObjectsIsCalledThenCall
std::string testFile = "testfile";
DebugVariables flags;
FullyDisabledFileLogger fileLogger(testFile, flags);
string memObjectString = fileLogger.getMemObjects(nullptr, 2);
std::string memObjectString = fileLogger.getMemObjects(nullptr, 2);
EXPECT_EQ(0u, memObjectString.size());
}
@@ -288,7 +287,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernel) {
DebugVariables flags;
flags.DumpKernels.set(true);
FullyEnabledFileLogger fileLogger(testFile, flags);
string kernelDumpFile = "testDumpKernel";
std::string kernelDumpFile = "testDumpKernel";
// test kernel dumping
fileLogger.dumpKernel(kernelDumpFile, "kernel source here");
@@ -299,7 +298,7 @@ TEST(FileLogger, WithoutDebugFunctionalityDumpKernel) {
std::string testFile = "testfile";
DebugVariables flags;
flags.DumpKernels.set(false);
string kernelDumpFile = "testDumpKernel";
std::string kernelDumpFile = "testDumpKernel";
FullyEnabledFileLogger fileLogger(testFile, flags);
// test kernel dumping
@@ -312,7 +311,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpBinary) {
DebugVariables flags;
flags.DumpKernels.set(true);
FullyEnabledFileLogger fileLogger(testFile, flags);
string programDumpFile = "programBinary.bin";
std::string programDumpFile = "programBinary.bin";
size_t length = 4;
unsigned char binary[4];
const unsigned char *ptrBinary = binary;
@@ -327,7 +326,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpNullBinary) {
flags.DumpKernels.set(true);
FullyEnabledFileLogger fileLogger(testFile, flags);
string programDumpFile = "programBinary.bin";
std::string programDumpFile = "programBinary.bin";
size_t length = 4;
fileLogger.dumpBinaryProgram(1, &length, nullptr);
@@ -358,10 +357,10 @@ TEST(FileLogger, WithDebugFunctionalityDontDumpKernelArgsForNullMdi) {
TEST(FileLogger, GivenDebugFunctionalityWhenDebugFlagIsDisabledThenDoNotDumpKernelArgsForMdi) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
auto multiDispatchInfo = unique_ptr<MockMultiDispatchInfo>(new MockMultiDispatchInfo(kernel.get()));
auto kernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
auto multiDispatchInfo = std::unique_ptr<MockMultiDispatchInfo>(new MockMultiDispatchInfo(kernel.get()));
KernelArgPatchInfo kernelArgPatchInfo;
@@ -373,7 +372,7 @@ TEST(FileLogger, GivenDebugFunctionalityWhenDebugFlagIsDisabledThenDoNotDumpKern
kernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector.push_back(kernelArgPatchInfo);
size_t crossThreadDataSize = 64;
auto crossThreadData = unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
auto crossThreadData = std::unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
kernel->setCrossThreadData(crossThreadData.get(), static_cast<uint32_t>(crossThreadDataSize));
std::string testFile = "testfile";
@@ -393,10 +392,10 @@ TEST(FileLogger, GivenDebugFunctionalityWhenDebugFlagIsDisabledThenDoNotDumpKern
TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsForMdi) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
auto multiDispatchInfo = unique_ptr<MockMultiDispatchInfo>(new MockMultiDispatchInfo(kernel.get()));
auto kernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
auto multiDispatchInfo = std::unique_ptr<MockMultiDispatchInfo>(new MockMultiDispatchInfo(kernel.get()));
KernelArgPatchInfo kernelArgPatchInfo;
@@ -408,7 +407,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsForMdi) {
kernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector.push_back(kernelArgPatchInfo);
size_t crossThreadDataSize = 64;
auto crossThreadData = unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
auto crossThreadData = std::unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
kernel->setCrossThreadData(crossThreadData.get(), static_cast<uint32_t>(crossThreadDataSize));
std::string testFile = "testfile";
@@ -438,9 +437,9 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelNullKernel) {
TEST(FileLogger, WithDebugFunctionalityAndEmptyKernelDontDumpKernelArgs) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
auto kernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
std::string testFile = "testfile";
DebugVariables flags;
@@ -454,9 +453,9 @@ TEST(FileLogger, WithDebugFunctionalityAndEmptyKernelDontDumpKernelArgs) {
TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsImmediate) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
auto kernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
KernelArgPatchInfo kernelArgPatchInfo;
@@ -468,7 +467,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsImmediate) {
kernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector.push_back(kernelArgPatchInfo);
size_t crossThreadDataSize = 64;
auto crossThreadData = unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
auto crossThreadData = std::unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
kernel->setCrossThreadData(crossThreadData.get(), static_cast<uint32_t>(crossThreadDataSize));
std::string testFile = "testfile";
@@ -488,9 +487,9 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsImmediate) {
TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsImmediateZeroSize) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
auto kernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
KernelArgPatchInfo kernelArgPatchInfo;
@@ -502,7 +501,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsImmediateZeroSize) {
kernelInfo->kernelArgInfo[0].kernelArgPatchInfoVector.push_back(kernelArgPatchInfo);
size_t crossThreadDataSize = sizeof(64);
auto crossThreadData = unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
auto crossThreadData = std::unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
kernel->setCrossThreadData(crossThreadData.get(), static_cast<uint32_t>(crossThreadDataSize));
std::string testFile = "testfile";
@@ -518,9 +517,9 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsImmediateZeroSize) {
TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsLocalBuffer) {
auto kernelInfo = std::make_unique<KernelInfo>();
auto device = make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockProgram program(*device->getExecutionEnvironment());
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
auto kernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
KernelArgPatchInfo kernelArgPatchInfo;
@@ -555,7 +554,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsBufferNotSet) {
kernel->initialize();
size_t crossThreadDataSize = sizeof(void *);
auto crossThreadData = unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
auto crossThreadData = std::unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
kernel->setCrossThreadData(crossThreadData.get(), static_cast<uint32_t>(crossThreadDataSize));
std::string testFile = "testfile";
@@ -590,7 +589,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsBuffer) {
kernel->initialize();
size_t crossThreadDataSize = sizeof(void *);
auto crossThreadData = unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
auto crossThreadData = std::unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
kernel->setCrossThreadData(crossThreadData.get(), static_cast<uint32_t>(crossThreadDataSize));
kernel->setArg(0, clObj);
@@ -666,7 +665,7 @@ TEST(FileLogger, WithDebugFunctionalityDumpKernelArgsImageNotSet) {
kernel->initialize();
size_t crossThreadDataSize = sizeof(void *);
auto crossThreadData = unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
auto crossThreadData = std::unique_ptr<uint8_t>(new uint8_t[crossThreadDataSize]);
kernel->setCrossThreadData(crossThreadData.get(), static_cast<uint32_t>(crossThreadDataSize));
std::string testFile = "testfile";
@@ -699,8 +698,8 @@ TEST(FileLogger, WithDebugFunctionalityDumpBinaryNegativeCases) {
}
TEST(FileLogger, WithoutDebugFunctionality) {
string path = ".";
vector<string> files = Directory::getFiles(path);
std::string path = ".";
std::vector<std::string> files = Directory::getFiles(path);
size_t initialNumberOfFiles = files.size();
std::string testFile = "testfile";
@@ -719,7 +718,7 @@ TEST(FileLogger, WithoutDebugFunctionality) {
// test kernel dumping
bool kernelDumpCreated = false;
string kernelDumpFile = "testDumpKernel";
std::string kernelDumpFile = "testDumpKernel";
fileLogger.dumpKernel(kernelDumpFile, "kernel source here");
kernelDumpCreated = fileExists(kernelDumpFile.append(".txt"));
@@ -736,17 +735,17 @@ TEST(FileLogger, WithoutDebugFunctionality) {
EXPECT_EQ(0u, output);
// getEvents returns 0-size string
string event = fileLogger.getEvents(&input, 0);
std::string event = fileLogger.getEvents(&input, 0);
EXPECT_EQ(0u, event.size());
// getSizes returns 0-size string
string lwsSizes = fileLogger.getSizes(&input, 0, true);
string gwsSizes = fileLogger.getSizes(&input, 0, false);
std::string lwsSizes = fileLogger.getSizes(&input, 0, true);
std::string gwsSizes = fileLogger.getSizes(&input, 0, false);
EXPECT_EQ(0u, lwsSizes.size());
EXPECT_EQ(0u, gwsSizes.size());
// no programDump file
string programDumpFile = "programBinary.bin";
std::string programDumpFile = "programBinary.bin";
size_t length = 4;
unsigned char binary[4];
const unsigned char *ptrBinary = binary;
@@ -808,17 +807,17 @@ TEST(FileLogger, infoPointerToStringReturnsCorrectString) {
FullyEnabledFileLogger fileLogger(testFile, flags);
uint64_t value64bit = 64;
string string64bit = fileLogger.infoPointerToString(&value64bit, sizeof(uint64_t));
std::string string64bit = fileLogger.infoPointerToString(&value64bit, sizeof(uint64_t));
uint32_t value32bit = 32;
string string32bit = fileLogger.infoPointerToString(&value32bit, sizeof(uint32_t));
std::string string32bit = fileLogger.infoPointerToString(&value32bit, sizeof(uint32_t));
uint8_t value8bit = 0;
string string8bit = fileLogger.infoPointerToString(&value8bit, sizeof(uint8_t));
std::string string8bit = fileLogger.infoPointerToString(&value8bit, sizeof(uint8_t));
EXPECT_STREQ("64", string64bit.c_str());
EXPECT_STREQ("32", string32bit.c_str());
EXPECT_STREQ("0", string8bit.c_str());
string stringNonValue = fileLogger.infoPointerToString(nullptr, 56);
std::string stringNonValue = fileLogger.infoPointerToString(nullptr, 56);
EXPECT_STREQ("", stringNonValue.c_str());
char valueChar = 0;

View File

@@ -22,9 +22,7 @@
#include <excpt.h>
#include <psapi.h>
using namespace std;
string SehException::getExceptionDescription(unsigned int code) {
std::string SehException::getExceptionDescription(unsigned int code) {
switch (code) {
case EXCEPTION_ACCESS_VIOLATION:
return "Access violation";
@@ -47,7 +45,7 @@ int SehException::filter(unsigned int code, struct _EXCEPTION_POINTERS *ep) {
printf("EXCEPTION: %s\n", SehException::getExceptionDescription(code).c_str());
if (code != EXCEPTION_STACK_OVERFLOW) {
string callstack;
std::string callstack;
SehException::getCallStack(code, ep, callstack);
printf("Callstack:\n\n%s", callstack.c_str());
@@ -55,7 +53,7 @@ int SehException::filter(unsigned int code, struct _EXCEPTION_POINTERS *ep) {
return EXCEPTION_EXECUTE_HANDLER;
}
void SehException::getCallStack(unsigned int code, struct _EXCEPTION_POINTERS *ep, string &stack) {
void SehException::getCallStack(unsigned int code, struct _EXCEPTION_POINTERS *ep, std::string &stack) {
DWORD machine = 0;
HANDLE hProcess = GetCurrentProcess();
HANDLE hThread = GetCurrentThread();
@@ -89,7 +87,7 @@ void SehException::getCallStack(unsigned int code, struct _EXCEPTION_POINTERS *e
DWORD displacement = 0;
DWORD64 displacement64 = 0;
unique_ptr<NEO::OsLibrary> psApiLib(NEO::OsLibrary::load("psapi.dll"));
std::unique_ptr<NEO::OsLibrary> psApiLib(NEO::OsLibrary::load("psapi.dll"));
auto getMappedFileName = reinterpret_cast<getMappedFileNameFunction>(psApiLib->getProcAddress("GetMappedFileNameA"));
size_t callstackCounter = 0;
@@ -123,9 +121,9 @@ void SehException::getCallStack(unsigned int code, struct _EXCEPTION_POINTERS *e
break;
}
string lineInCode;
string module;
string symbolName;
std::string lineInCode;
std::string module;
std::string symbolName;
DWORD64 address = stackFrame.AddrPC.Offset;
IMAGEHLP_LINE64 imageLine;
@@ -152,7 +150,7 @@ void SehException::getCallStack(unsigned int code, struct _EXCEPTION_POINTERS *e
void SehException::addLineToCallstack(std::string &callstack, size_t counter, std::string &module, std::string &line, std::string &symbol) {
callstack += "[";
callstack += to_string(counter);
callstack += std::to_string(counter);
callstack += "]: ";
if (module.size()) {

View File

@@ -7,7 +7,6 @@
#include "shared/source/utilities/debug_file_reader.h"
using namespace std;
namespace NEO {
@@ -32,7 +31,7 @@ SettingsFileReader::~SettingsFileReader() {
int32_t SettingsFileReader::getSetting(const char *settingName, int32_t defaultValue) {
int32_t value = defaultValue;
map<string, string>::iterator it = settingStringMap.find(string(settingName));
std::map<std::string, std::string>::iterator it = settingStringMap.find(std::string(settingName));
if (it != settingStringMap.end()) {
value = atoi(it->second.c_str());
}
@@ -46,7 +45,7 @@ bool SettingsFileReader::getSetting(const char *settingName, bool defaultValue)
std::string SettingsFileReader::getSetting(const char *settingName, const std::string &value) {
std::string returnValue = value;
map<string, string>::iterator it = settingStringMap.find(string(settingName));
std::map<std::string, std::string>::iterator it = settingStringMap.find(std::string(settingName));
if (it != settingStringMap.end())
returnValue = it->second;
@@ -58,14 +57,14 @@ const char *SettingsFileReader::appSpecificLocation(const std::string &name) {
}
void SettingsFileReader::parseStream(std::istream &inputStream) {
stringstream ss;
string key;
string value;
std::stringstream ss;
std::string key;
std::string value;
char temp = 0;
while (!inputStream.eof()) {
string tempString;
string tempStringValue;
std::string tempString;
std::string tempStringValue;
getline(inputStream, tempString);
ss << tempString;
@@ -74,10 +73,10 @@ void SettingsFileReader::parseStream(std::istream &inputStream) {
ss >> value;
if (!ss.fail()) {
settingStringMap.insert(pair<string, string>(key, value));
settingStringMap.insert(std::pair<std::string, std::string>(key, value));
}
ss.str(string()); // for reset string inside stringstream
ss.str(std::string()); // for reset string inside stringstream
ss.clear();
key.clear();
}

View File

@@ -16,7 +16,6 @@
#include <sstream>
#include <thread>
using namespace std;
namespace NEO {
@@ -63,12 +62,12 @@ PerfProfiler::PerfProfiler(int id, std::unique_ptr<std::ostream> logOut, std::un
if (logOut != nullptr) {
this->logFile = std::move(logOut);
} else {
stringstream filename;
std::stringstream filename;
filename << "PerfReport_Thread_" << id << ".xml";
std::unique_ptr<std::ofstream> logToFile = std::unique_ptr<std::ofstream>(new std::ofstream());
logToFile->exceptions(std::ios::failbit | std::ios::badbit);
logToFile->open(filename.str().c_str(), ios::trunc);
logToFile->open(filename.str().c_str(), std::ios::trunc);
this->logFile = std::move(logToFile);
}
@@ -77,12 +76,12 @@ PerfProfiler::PerfProfiler(int id, std::unique_ptr<std::ostream> logOut, std::un
if (sysLogOut != nullptr) {
this->sysLogFile = std::move(sysLogOut);
} else {
stringstream filename;
std::stringstream filename;
filename << "SysPerfReport_Thread_" << id << ".xml";
std::unique_ptr<std::ofstream> sysLogToFile = std::unique_ptr<std::ofstream>(new std::ofstream());
sysLogToFile->exceptions(std::ios::failbit | std::ios::badbit);
sysLogToFile->open(filename.str().c_str(), ios::trunc);
sysLogToFile->open(filename.str().c_str(), std::ios::trunc);
this->sysLogFile = std::move(sysLogToFile);
}
@@ -160,7 +159,7 @@ void PerfProfiler::SysLogBuilder::read(std::istream &str, long long &start, unsi
}
void PerfProfiler::logTimes(long long start, long long end, long long span, unsigned long long totalSystem, const char *function) {
stringstream str;
std::stringstream str;
LogBuilder::write(str, start, end, span, totalSystem, function);
*logFile << str.str();
logFile->flush();

View File

@@ -24,7 +24,6 @@
#include <memory>
using namespace NEO;
using namespace std;
class CompilerCacheMock : public CompilerCache {
public:
@@ -202,7 +201,7 @@ TEST(CompilerCacheHashTests, GivenCompilingOptionsWhenGettingCacheThenCorrectCac
strcpy_s(buf3.get(), bufSize, internalOptionsArray[i3].c_str());
internalOptions = ArrayRef<char>(buf3.get(), strlen(buf3.get()));
string hash = CompilerCache::getCachedFileName(hwInfo, src, apiOptions, internalOptions);
std::string hash = CompilerCache::getCachedFileName(hwInfo, src, apiOptions, internalOptions);
if (hashes.find(hash) != hashes.end()) {
FAIL() << "failed: " << i1 << ":" << i2 << ":" << i3;
@@ -215,8 +214,8 @@ TEST(CompilerCacheHashTests, GivenCompilingOptionsWhenGettingCacheThenCorrectCac
}
}
string hash = CompilerCache::getCachedFileName(hwInfo, src, apiOptions, internalOptions);
string hash2 = CompilerCache::getCachedFileName(hwInfo, src, apiOptions, internalOptions);
std::string hash = CompilerCache::getCachedFileName(hwInfo, src, apiOptions, internalOptions);
std::string hash2 = CompilerCache::getCachedFileName(hwInfo, src, apiOptions, internalOptions);
EXPECT_STREQ(hash.c_str(), hash2.c_str());
}

View File

@@ -14,7 +14,6 @@
#include <map>
using namespace NEO;
using namespace std;
#undef DECLARE_DEBUG_VARIABLE
@@ -32,7 +31,7 @@ class TestDebugFlagsChecker {
return returnedValue == defaultValue;
}
static bool isEqual(string returnedValue, string defaultValue) {
static bool isEqual(std::string returnedValue, std::string defaultValue) {
return returnedValue == defaultValue;
}
};

View File

@@ -15,17 +15,16 @@
#include <fstream>
using namespace NEO;
using namespace std;
TEST(Directory, GetFiles) {
ofstream tempfile("temp_file_that_does_not_exist.tmp");
std::ofstream tempfile("temp_file_that_does_not_exist.tmp");
tempfile << " ";
tempfile.flush();
tempfile.close();
string path = ".";
vector<string> files = Directory::getFiles(path);
std::string path = ".";
std::vector<std::string> files = Directory::getFiles(path);
EXPECT_LT(0u, files.size());
remove("temp_file_that_does_not_exist.tmp");
std::remove("temp_file_that_does_not_exist.tmp");
}

View File

@@ -15,7 +15,6 @@
#include <random>
using namespace NEO;
using namespace std;
const size_t sizeThreshold = 16 * 4096;
@@ -652,14 +651,14 @@ TEST(HeapAllocatorTest, AllocationsDoNotOverlap) {
const uint32_t maxIndex = 2000;
unique_ptr<uint64_t[]> ptrs(new uint64_t[maxIndex]);
unique_ptr<size_t[]> sizes(new size_t[maxIndex]);
std::unique_ptr<uint64_t[]> ptrs(new uint64_t[maxIndex]);
std::unique_ptr<size_t[]> sizes(new size_t[maxIndex]);
memset(ptrs.get(), 0, sizeof(uint64_t) * maxIndex);
memset(sizes.get(), 0, sizeof(size_t) * maxIndex);
uint16_t *freeIndexes = new uint16_t[maxIndex];
unique_ptr<uint16_t[]> indexes(new uint16_t[maxIndex]);
std::unique_ptr<uint16_t[]> indexes(new uint16_t[maxIndex]);
memset(freeIndexes, 0, sizeof(uint16_t) * maxIndex);
memset(indexes.get(), 0, sizeof(uint16_t) * maxIndex);
@@ -714,7 +713,7 @@ TEST(HeapAllocatorTest, AllocationsDoNotOverlap) {
for (uint32_t i = 0; i < allocatorSize / reqAlignment; i++) {
if (*pTemp > 1) {
EXPECT_TRUE(false) << "Heap from Allocator corrupted at page offset " << i << endl;
EXPECT_TRUE(false) << "Heap from Allocator corrupted at page offset " << i << std::endl;
}
}

View File

@@ -16,7 +16,6 @@
using namespace NEO;
using namespace std;
TEST(PerfProfiler, create) {
PerfProfiler *ptr = PerfProfiler::create();