diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:12:36 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:12:36 +0000 |
commit | ef5d0b5e97ec8e6fa395d377b09aa7755e345b4f (patch) | |
tree | 27916256fdeeb57d10d2f3d6948be5d71a703215 /unittests/tools/lldb-server/tests/TestBase.h | |
parent | 76e0736e7fcfeb179779e49c05604464b1ccd704 (diff) |
Notes
Diffstat (limited to 'unittests/tools/lldb-server/tests/TestBase.h')
-rw-r--r-- | unittests/tools/lldb-server/tests/TestBase.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/unittests/tools/lldb-server/tests/TestBase.h b/unittests/tools/lldb-server/tests/TestBase.h new file mode 100644 index 0000000000000..8956490e945c1 --- /dev/null +++ b/unittests/tools/lldb-server/tests/TestBase.h @@ -0,0 +1,48 @@ +//===-- TestBase.h ----------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_SERVER_TESTS_TESTBASE_H +#define LLDB_SERVER_TESTS_TESTBASE_H + +#include "TestClient.h" +#include "lldb/Host/HostInfo.h" +#include "llvm/Support/Path.h" +#include "llvm/Testing/Support/Error.h" +#include "gtest/gtest.h" + +namespace llgs_tests { + +class TestBase: public ::testing::Test { +public: + static void SetUpTestCase() { lldb_private::HostInfo::Initialize(); } + + static std::string getInferiorPath(llvm::StringRef Name) { + llvm::SmallString<64> Path(LLDB_TEST_INFERIOR_PATH); + llvm::sys::path::append(Path, Name + LLDB_TEST_INFERIOR_SUFFIX); + return Path.str(); + } + + static std::string getLogFileName(); +}; + +class StandardStartupTest: public TestBase { +public: + void SetUp() override { + auto ClientOr = TestClient::launch(getLogFileName()); + ASSERT_THAT_EXPECTED(ClientOr, llvm::Succeeded()); + Client = std::move(*ClientOr); + } + +protected: + std::unique_ptr<TestClient> Client; +}; + +} // namespace llgs_tests + +#endif // LLDB_SERVER_TESTS_TESTBASE_H |