[Lldb-commits] [lldb] r334003 - Really fix ClangParserTest

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 5 03:29:48 PDT 2018


Author: labath
Date: Tue Jun  5 03:29:48 2018
New Revision: 334003

URL: http://llvm.org/viewvc/llvm-project?rev=334003&view=rev
Log:
Really fix ClangParserTest

It turns out the test needs a fixture after all (to initialize HostInfo), so
provide one that does that.

Modified:
    lldb/trunk/unittests/Expression/ClangParserTest.cpp

Modified: lldb/trunk/unittests/Expression/ClangParserTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Expression/ClangParserTest.cpp?rev=334003&r1=334002&r2=334003&view=diff
==============================================================================
--- lldb/trunk/unittests/Expression/ClangParserTest.cpp (original)
+++ lldb/trunk/unittests/Expression/ClangParserTest.cpp Tue Jun  5 03:29:48 2018
@@ -9,12 +9,20 @@
 
 #include "Plugins/ExpressionParser/Clang/ClangHost.h"
 #include "TestingSupport/TestUtilities.h"
+#include "lldb/Host/HostInfo.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/lldb-defines.h"
 #include "gtest/gtest.h"
 
 using namespace lldb_private;
 
+namespace {
+struct ClangHostTest : public testing::Test {
+  static void SetUpTestCase() { HostInfo::Initialize(); }
+  static void TearDownTestCase() { HostInfo::Terminate(); }
+};
+} // namespace
+
 #ifdef __APPLE__
 static std::string ComputeClangDir(std::string lldb_shlib_path,
                                    bool verify = false) {
@@ -24,7 +32,7 @@ static std::string ComputeClangDir(std::
   return clang_dir.GetPath();
 }
 
-TEST(ClangHostTest, MacOSX) {
+TEST_F(ClangHostTest, MacOSX) {
   // This returns whatever the POSIX fallback returns.
   std::string posix = "/usr/lib/liblldb.dylib";
   EXPECT_FALSE(ComputeClangDir(posix).empty());




More information about the lldb-commits mailing list