Skip to content

Commit

Permalink
Fix test in Windows.
Browse files Browse the repository at this point in the history
Signed-off-by: Maronas, Marcos <marcos.maronas@intel.com>
  • Loading branch information
maarquitos14 committed Jan 23, 2024
1 parent 4e78c90 commit 8b3d6c9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions sycl/test-e2e/CompositeDevice/composite_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,18 @@ bool isL0Backend(sycl::backend backend) {
}

bool isCombinedMode() {
const char *Mode = std::getenv("ZE_FLAT_DEVICE_HIERARCHY");
return (Mode != nullptr) && (std::strcmp(Mode, "COMBINED") == 0);
char *Mode = nullptr;
bool Res = false;
#ifdef _WIN32
size_t Size = 0;
auto Err = _dupenv_s(&Mode, &Size, "ZE_FLAT_DEVICE_HIERARCHY");
Res = (Mode != nullptr) && (std::strcmp(Mode, "COMBINED") == 0);
free(Mode);
#else
Mode = std::getenv("ZE_FLAT_DEVICE_HIERARCHY");
Res = (Mode != nullptr) && (std::strcmp(Mode, "COMBINED") == 0);
#endif
return Res;
}

int main() {
Expand Down

0 comments on commit 8b3d6c9

Please sign in to comment.