Browse Source

[linux-port] Enable VerifierTest for Unix (#1452)

Enable gtest support and convert path name to ascii for ifstream
Greg Roth 7 năm trước cách đây
mục cha
commit
a62e5eaec3

+ 1 - 1
tools/clang/unittests/HLSL/CMakeLists.txt

@@ -75,7 +75,6 @@ set(HLSL_IGNORE_SOURCES
   ShaderOpTest.cpp
   SystemValueTest.cpp
   ValidationTest.cpp
-  VerifierTest.cpp
   )
 
 add_clang_unittest(clang-hlsl-tests
@@ -85,6 +84,7 @@ add_clang_unittest(clang-hlsl-tests
   HLSLTestOptions.cpp
   Objects.cpp
   TestMain.cpp
+  VerifierTest.cpp
   )
 
 endif(WIN32)

+ 3 - 3
tools/clang/unittests/HLSL/TestMain.cpp

@@ -13,6 +13,7 @@
 #include "llvm/Support/Signals.h"
 
 #include "HLSLTestOptions.h"
+#include "WEXAdapter.h"
 
 #if defined(_WIN32)
 #include <windows.h>
@@ -21,9 +22,6 @@
 #endif
 #endif
 
-bool moduleSetup();
-bool moduleTeardown();
-
 namespace {
 using namespace ::testing;
 
@@ -142,6 +140,8 @@ int main(int argc, char **argv) {
 #endif
 #endif
 
+  moduleSetup();
   int rv = RUN_ALL_TESTS();
+  moduleTeardown();
   return rv;
 }

+ 9 - 3
tools/clang/unittests/HLSL/VerifierTest.cpp

@@ -16,14 +16,20 @@
 
 #include <fstream>
 
+#ifdef _WIN32
 #include "WexTestClass.h"
+#endif
 #include "HlslTestUtils.h"
 
 using namespace std;
 
 // The test fixture.
-class VerifierTest
-{
+#ifdef _WIN32
+class VerifierTest {
+#else
+class VerifierTest : public ::testing::Test {
+#endif
+
 public:
   BEGIN_TEST_CLASS(VerifierTest)
     TEST_CLASS_PROPERTY(L"Parallel", L"true")
@@ -94,7 +100,7 @@ public:
     //
 
     {
-      ifstream infile(path);
+      ifstream infile(CW2A(path).m_psz);
       ASSERT_EQ(false, infile.bad());
 
       infile.getline(firstLine, _countof(firstLine));