diff --git a/source/loader/linux/platform_discovery_lin.cpp b/source/loader/linux/platform_discovery_lin.cpp index 68d06a8bfd..aff0af402e 100644 --- a/source/loader/linux/platform_discovery_lin.cpp +++ b/source/loader/linux/platform_discovery_lin.cpp @@ -15,9 +15,7 @@ namespace loader { -static const char *knownPlatformNames[] = { - MAKE_LIBRARY_NAME("ur_null", UR_VERSION), -}; +static constexpr char *knownPlatformNames[] = {}; std::vector discoverEnabledPlatforms() { std::vector enabledPlatforms; diff --git a/source/loader/windows/platform_discovery_win.cpp b/source/loader/windows/platform_discovery_win.cpp index 4b9cfad32b..82f3f515e4 100644 --- a/source/loader/windows/platform_discovery_win.cpp +++ b/source/loader/windows/platform_discovery_win.cpp @@ -21,9 +21,7 @@ namespace loader { -static const char *knownAdaptersNames[] = { - MAKE_LIBRARY_NAME("ur_null", UR_VERSION), -}; +static constexpr char *knownAdaptersNames[] = {}; std::vector discoverEnabledPlatforms() { std::vector enabledPlatforms; @@ -32,11 +30,7 @@ std::vector discoverEnabledPlatforms() { char *altPlatforms = nullptr; _dupenv_s(&altPlatforms, NULL, "UR_ADAPTERS_FORCE_LOAD"); - if (altPlatforms == nullptr) { - for (auto libName : knownAdaptersNames) { - enabledPlatforms.emplace_back(libName); - } - } else { + if (altPlatforms != nullptr) { std::stringstream ss(altPlatforms); while (ss.good()) { std::string substr; diff --git a/test/conformance/source/environment.cpp b/test/conformance/source/environment.cpp index ea57fa3d33..084a062e39 100644 --- a/test/conformance/source/environment.cpp +++ b/test/conformance/source/environment.cpp @@ -32,7 +32,13 @@ uur::PlatformEnvironment::PlatformEnvironment(int argc, char **argv) : platform_options{parsePlatformOptions(argc, argv)} { instance = this; ur_device_init_flags_t device_flags = 0; - if (urInit(device_flags)) { + switch (urInit(device_flags)) { + case UR_RESULT_SUCCESS: + break; + case UR_RESULT_ERROR_UNINITIALIZED: + error = "Could not load adapter"; + return; + default: error = "urInit() failed"; return; } @@ -100,11 +106,18 @@ uur::PlatformEnvironment::PlatformEnvironment(int argc, char **argv) void uur::PlatformEnvironment::SetUp() { if (!error.empty()) { - FAIL() << error; + if (error == "Could not load adapter") { + GTEST_SKIP() << error; + } else { + FAIL() << error; + } } } void uur::PlatformEnvironment::TearDown() { + if (error == "Could not load adapter") { + return; + } ur_tear_down_params_t tear_down_params{}; if (urTearDown(&tear_down_params)) { FAIL() << "urTearDown() failed"; @@ -155,8 +168,21 @@ DevicesEnvironment::DevicesEnvironment(int argc, char **argv) void DevicesEnvironment::SetUp() { PlatformEnvironment::SetUp(); + if (error == "Could not load adapter") { + return; + } if (devices.empty() || !error.empty()) { FAIL() << error; } } + +void DevicesEnvironment::TearDown() { + PlatformEnvironment::TearDown(); + for (auto device : devices) { + if (urDeviceRelease(device)) { + error = "urDeviceRelease() failed"; + return; + } + } +} } // namespace uur diff --git a/test/conformance/testing/uur/environment.h b/test/conformance/testing/uur/environment.h index 03fae035b0..52f9fdb2be 100644 --- a/test/conformance/testing/uur/environment.h +++ b/test/conformance/testing/uur/environment.h @@ -36,7 +36,7 @@ struct DevicesEnvironment : PlatformEnvironment { virtual ~DevicesEnvironment() override = default; virtual void SetUp() override; - inline virtual void TearDown() override { PlatformEnvironment::TearDown(); } + virtual void TearDown() override; inline const std::vector &GetDevices() const { return devices; diff --git a/test/layers/validation/CMakeLists.txt b/test/layers/validation/CMakeLists.txt index 2c55dfe0a9..633b6e730c 100644 --- a/test/layers/validation/CMakeLists.txt +++ b/test/layers/validation/CMakeLists.txt @@ -19,7 +19,8 @@ function(add_validation_test name) set_tests_properties(${name} PROPERTIES LABELS "validation") set_property(TEST ${name} PROPERTY ENVIRONMENT "UR_ENABLE_VALIDATION_LAYER=1" - "UR_ENABLE_PARAMETER_VALIDATION=1") + "UR_ENABLE_PARAMETER_VALIDATION=1" + "UR_ADAPTERS_FORCE_LOAD=$") endfunction() add_validation_test(parameters parameters.cpp) diff --git a/test/python/CMakeLists.txt b/test/python/CMakeLists.txt index 0dd4db32d5..779e8e8991 100644 --- a/test/python/CMakeLists.txt +++ b/test/python/CMakeLists.txt @@ -18,7 +18,7 @@ function(add_python_test name) endif() # this is for importing the include/ur.py module in other python files set_property(TEST ${TEST_NAME} APPEND PROPERTY - ENVIRONMENT "PYTHONPATH=${PROJECT_SOURCE_DIR}") + ENVIRONMENT "PYTHONPATH=${PROJECT_SOURCE_DIR}" "UR_ADAPTERS_FORCE_LOAD=$") endfunction() add_python_test(basic)