From 4931330258b65b97e07b5c2b32a8a9f8cd9dea49 Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Wed, 25 Oct 2023 16:02:49 +0000 Subject: [PATCH] test: move black box test function to shared lib Signed-off-by: Zbigniew Zdanowicz --- .../test/black_box_tests/common/zello_common.cpp | 14 ++++++++++++++ .../test/black_box_tests/common/zello_common.h | 2 ++ .../test/black_box_tests/zello_copy_tracing.cpp | 14 -------------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/level_zero/core/test/black_box_tests/common/zello_common.cpp b/level_zero/core/test/black_box_tests/common/zello_common.cpp index b0fa6df272..752b766e61 100644 --- a/level_zero/core/test/black_box_tests/common/zello_common.cpp +++ b/level_zero/core/test/black_box_tests/common/zello_common.cpp @@ -11,6 +11,12 @@ #include #include +#ifdef _WIN64 +#include +#else +#include +#endif + bool verbose; bool isParamEnabled(int argc, char *argv[], const char *shortName, const char *longName) { @@ -553,3 +559,11 @@ const std::vector &getResourcesSearchLocations() { }; return locations; } + +void setEnvironmentVariable(const char *variableName, const char *variableValue) { +#ifdef _WIN64 + SetEnvironmentVariableA(variableName, variableValue); +#else + setenv(variableName, variableValue, 1); +#endif +} diff --git a/level_zero/core/test/black_box_tests/common/zello_common.h b/level_zero/core/test/black_box_tests/common/zello_common.h index f8accdb949..c2f9a60641 100644 --- a/level_zero/core/test/black_box_tests/common/zello_common.h +++ b/level_zero/core/test/black_box_tests/common/zello_common.h @@ -125,6 +125,8 @@ void printCommandQueueGroupsProperties(ze_device_handle_t &device); const std::vector &getResourcesSearchLocations(); +void setEnvironmentVariable(const char *variableName, const char *variableValue); + // read binary file into a non-NULL-terminated string template inline std::unique_ptr readBinaryFile(const std::string &name, SizeT &outSize) { diff --git a/level_zero/core/test/black_box_tests/zello_copy_tracing.cpp b/level_zero/core/test/black_box_tests/zello_copy_tracing.cpp index ff7a25ad94..858e7dd7ea 100644 --- a/level_zero/core/test/black_box_tests/zello_copy_tracing.cpp +++ b/level_zero/core/test/black_box_tests/zello_copy_tracing.cpp @@ -19,12 +19,6 @@ #include #include -#ifdef _WIN64 -#include -#else -#include -#endif - struct UserTracerData { uint32_t tracerData; }; @@ -637,14 +631,6 @@ void testAppendMemoryCopy2(ze_context_handle_t &context, ze_device_handle_t &dev SUCCESS_OR_TERMINATE(cmdQueueDdiTable.pfnDestroy(cmdQueue)); } -void setEnvironmentVariable(const char *variableName, const char *variableValue) { -#ifdef _WIN64 - SetEnvironmentVariableA(variableName, variableValue); -#else - setenv(variableName, variableValue, 1); -#endif -} - int main(int argc, char *argv[]) { const std::string blackBoxName = "Zello Copy Tracing"; verbose = isVerbose(argc, argv);