1212// RUN: env TEST_DEVICE_IS_NOT_AVAILABLE=1 env SYCL_DEVICE_ALLOWLIST="PlatformName:{{SUCH NAME DOESN'T EXIST}}" ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run-unfiltered-devices} %t.out
1313// RUN: env TEST_INCORRECT_VALUE=1 env SYCL_DEVICE_ALLOWLIST="IncorrectKey:{{.*}}" ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run-unfiltered-devices} %t.out
1414
15+ #include " ../helpers.hpp"
1516#include < algorithm>
1617#include < cstdlib>
1718#include < exception>
@@ -33,7 +34,7 @@ static void replaceSpecialCharacters(std::string &Str) {
3334int main () {
3435
3536 // Expected that the allowlist filter is not set
36- if (getenv (" PRINT_PLATFORM_INFO" )) {
37+ if (env::isDefined (" PRINT_PLATFORM_INFO" )) {
3738 for (const sycl::platform &Platform : sycl::platform::get_platforms ()) {
3839 std::string Name = Platform.get_info <sycl::info::platform::name>();
3940 std::string Ver = Platform.get_info <sycl::info::platform::version>();
@@ -51,7 +52,7 @@ int main() {
5152 }
5253
5354 // Expected that the allowlist filter is not set
54- if (getenv (" PRINT_DEVICE_INFO" )) {
55+ if (env::isDefined (" PRINT_DEVICE_INFO" )) {
5556 for (const sycl::platform &Platform : sycl::platform::get_platforms ()) {
5657 const sycl::device Dev = Platform.get_devices ().at (0 );
5758 std::string Name = Dev.get_info <sycl::info::device::name>();
@@ -71,7 +72,7 @@ int main() {
7172 }
7273
7374 // Expected the allowlist to be set with the "PRINT_DEVICE_INFO" run result
74- if (getenv (" TEST_DEVICE_AVAILABLE" )) {
75+ if (env::isDefined (" TEST_DEVICE_AVAILABLE" )) {
7576 for (const sycl::platform &Platform : sycl::platform::get_platforms ()) {
7677 if (Platform.get_devices ().size () != 1 )
7778 throw std::runtime_error (" Expected only one device." );
@@ -82,13 +83,13 @@ int main() {
8283 }
8384
8485 // Expected the allowlist to be set but empty
85- if (getenv (" TEST_DEVICE_IS_NOT_AVAILABLE" )) {
86+ if (env::isDefined (" TEST_DEVICE_IS_NOT_AVAILABLE" )) {
8687 if (!sycl::platform::get_platforms ().empty ())
8788 throw std::runtime_error (" Expected no device is available" );
8889 return 0 ;
8990 }
9091
91- if (getenv (" TEST_INCORRECT_VALUE" )) {
92+ if (env::isDefined (" TEST_INCORRECT_VALUE" )) {
9293 try {
9394 sycl::platform::get_platforms ();
9495 } catch (sycl::exception &E) {
0 commit comments