diff options
author | Pavel Labath <labath@google.com> | 2017-06-29 13:02:11 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2017-06-29 13:02:11 +0000 |
commit | 7ed3e22f00468c71d561843bdb53d93d309ae92e (patch) | |
tree | b9ce5cd4c82dfee7b77c9268de58c6614ac89769 /lldb/unittests/Target/ModuleCacheTest.cpp | |
parent | 476f855ec8cbe465e26fc9e828cc1fe376c491ef (diff) | |
download | bcm5719-llvm-7ed3e22f00468c71d561843bdb53d93d309ae92e.tar.gz bcm5719-llvm-7ed3e22f00468c71d561843bdb53d93d309ae92e.zip |
[unittests] Add a helper function for getting an input file
Summary:
Fetching an input file required about five lines of code, and this was
repeated in multiple unit tests, with slight variations. Add a helper
function for doing that into the lldbUtilityMocks module (which I rename
to lldbUtilityHelpers to commemorate the fact it includes more than
mocks)
Reviewers: zturner, eugene
Subscribers: emaste, mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D34683
llvm-svn: 306668
Diffstat (limited to 'lldb/unittests/Target/ModuleCacheTest.cpp')
-rw-r--r-- | lldb/unittests/Target/ModuleCacheTest.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lldb/unittests/Target/ModuleCacheTest.cpp b/lldb/unittests/Target/ModuleCacheTest.cpp index 8914f8b5eac..122d789daf5 100644 --- a/lldb/unittests/Target/ModuleCacheTest.cpp +++ b/lldb/unittests/Target/ModuleCacheTest.cpp @@ -10,8 +10,7 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/ModuleCache.h" - -extern const char *TestMainArgv0; +#include "unittests/Utility/Helpers/TestUtilities.h" using namespace lldb_private; using namespace lldb; @@ -26,7 +25,7 @@ public: protected: static FileSpec s_cache_dir; - static llvm::SmallString<128> s_test_executable; + static std::string s_test_executable; void TryGetAndPut(const FileSpec &cache_dir, const char *hostname, bool expect_download); @@ -34,7 +33,7 @@ protected: } FileSpec ModuleCacheTest::s_cache_dir; -llvm::SmallString<128> ModuleCacheTest::s_test_executable; +std::string ModuleCacheTest::s_test_executable; static const char dummy_hostname[] = "dummy_hostname"; static const char dummy_remote_dir[] = "bin"; @@ -71,10 +70,7 @@ void ModuleCacheTest::SetUpTestCase() { FileSpec tmpdir_spec; HostInfo::GetLLDBPath(lldb::ePathTypeLLDBTempSystemDir, s_cache_dir); - - llvm::StringRef exe_folder = llvm::sys::path::parent_path(TestMainArgv0); - s_test_executable = exe_folder; - llvm::sys::path::append(s_test_executable, "Inputs", module_name); + s_test_executable = GetInputFilePath(module_name); } void ModuleCacheTest::TearDownTestCase() { |