1 //===-- SymbolsTest.cpp -----------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "gtest/gtest.h" 10 11 #include "lldb/Core/ModuleSpec.h" 12 #include "lldb/Host/FileSystem.h" 13 #include "lldb/Host/HostInfo.h" 14 #include "lldb/Symbol/LocateSymbolFile.h" 15 #include "lldb/Target/Target.h" 16 17 using namespace lldb_private; 18 19 namespace { 20 class SymbolsTest : public ::testing::Test { 21 public: 22 void SetUp() override { 23 FileSystem::Initialize(); 24 HostInfo::Initialize(); 25 } 26 void TearDown() override { 27 HostInfo::Terminate(); 28 FileSystem::Terminate(); 29 } 30 }; 31 } // namespace 32 33 TEST_F( 34 SymbolsTest, 35 TerminateLocateExecutableSymbolFileForUnknownExecutableAndUnknownSymbolFile) { 36 ModuleSpec module_spec; 37 FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); 38 FileSpec symbol_file_spec = 39 Symbols::LocateExecutableSymbolFile(module_spec, search_paths); 40 EXPECT_TRUE(symbol_file_spec.GetFilename().IsEmpty()); 41 } 42 43 TEST_F(SymbolsTest, 44 LocateExecutableSymbolFileForUnknownExecutableAndMissingSymbolFile) { 45 ModuleSpec module_spec; 46 // using a GUID here because the symbol file shouldn't actually exist on disk 47 module_spec.GetSymbolFileSpec().SetFile( 48 "4A524676-B24B-4F4E-968A-551D465EBAF1.so", FileSpec::Style::native); 49 FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); 50 FileSpec symbol_file_spec = 51 Symbols::LocateExecutableSymbolFile(module_spec, search_paths); 52 EXPECT_TRUE(symbol_file_spec.GetFilename().IsEmpty()); 53 } 54