diff --git a/include/dxc/CMakeLists.txt b/include/dxc/CMakeLists.txt index c40a662c89..501739bb2d 100644 --- a/include/dxc/CMakeLists.txt +++ b/include/dxc/CMakeLists.txt @@ -2,6 +2,13 @@ include(HCT) add_hlsl_hctgen(HLSLIntrinsicOp OUTPUT HlslIntrinsicOp.h) +set(HLSL_TEST_DATA_DIR ${LLVM_SOURCE_DIR}/tools/clang/test/HLSL/) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/dxc/Test/TestConfig.h.in + ${LLVM_INCLUDE_DIR}/dxc/Test/TestConfig.h + ) + add_subdirectory(DXIL) add_subdirectory(DxilContainer) add_subdirectory(HLSL) diff --git a/include/dxc/Test/HlslTestUtils.h b/include/dxc/Test/HlslTestUtils.h index 822424aca8..61eb5a8432 100644 --- a/include/dxc/Test/HlslTestUtils.h +++ b/include/dxc/Test/HlslTestUtils.h @@ -26,6 +26,7 @@ #include "WEXAdapter.h" #endif #include "dxc/Support/Unicode.h" +#include "dxc/Test/TestConfig.h" #include "dxc/DXIL/DxilConstants.h" // DenormMode using namespace std; @@ -212,7 +213,8 @@ inline std::wstring GetPathToHlslDataFile(const wchar_t* relative, LPCWSTR param if (FAILED(WEX::TestExecution::RuntimeParameters::TryGetValue(paramName, HlslDataDirValue))) return std::wstring(); } else { - ASSERT_HRESULT_SUCCEEDED(WEX::TestExecution::RuntimeParameters::TryGetValue(HLSLDATAFILEPARAM, HlslDataDirValue)); + if (FAILED(WEX::TestExecution::RuntimeParameters::TryGetValue(HLSLDATAFILEPARAM, HlslDataDirValue))) + HlslDataDirValue = DEFAULT_TEST_DIR; } wchar_t envPath[MAX_PATH]; diff --git a/include/dxc/Test/TestConfig.h.in b/include/dxc/Test/TestConfig.h.in new file mode 100644 index 0000000000..b04984a506 --- /dev/null +++ b/include/dxc/Test/TestConfig.h.in @@ -0,0 +1 @@ +#define DEFAULT_TEST_DIR L"@HLSL_TEST_DATA_DIR@" diff --git a/include/dxc/Test/WEXAdapter.h b/include/dxc/Test/WEXAdapter.h index 847665240a..a886cd0005 100644 --- a/include/dxc/Test/WEXAdapter.h +++ b/include/dxc/Test/WEXAdapter.h @@ -132,6 +132,8 @@ namespace WEX { namespace Common { class String : public std::wstring { public: + String() = default; + String(const wchar_t *S) : std::wstring(S) {} size_t GetLength() { return length(); } bool IsEmpty() { return empty(); } int CompareNoCase(std::wstring str) const {