Skip to content

Commit a4c9629

Browse files
committed
ifdef for windows vs unix env var addition
1 parent 9800c91 commit a4c9629

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/clang/unittests/HLSL/ValidationTest.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "llvm/ADT/ArrayRef.h"
2525
#include "llvm/ADT/StringRef.h"
2626
#include "llvm/Support/Regex.h"
27+
#include <cstdlib> // for setenv(), getenv(), unsetenv()
2728

2829
#ifdef _WIN32
2930
#include <atlbase.h>
@@ -4230,10 +4231,15 @@ TEST_F(ValidationTest, UnitTestExtValidationSupport) {
42304231
VERIFY_ARE_EQUAL(m_dllExtSupport1.GetDxilDllPath(), "");
42314232

42324233
// 2. Test with a bogus path in the environment variable
4234+
#ifdef _WIN32
42334235
SetEnvironmentVariableW(L"DXC_DXIL_DLL_PATH", L"bogus");
42344236
// also update the CRT environment
42354237
_putenv_s("DXC_DXIL_DLL_PATH", "bogus");
42364238

4239+
#else
4240+
setenv("DXC_DXIL_DLL_PATH", "bogus", 1);
4241+
#endif
4242+
42374243
if (!m_dllExtSupport2.IsEnabled()) {
42384244
VERIFY_SUCCEEDED(m_dllExtSupport2.Initialize());
42394245
}

0 commit comments

Comments
 (0)