1 //===-- SymbolsTest.cpp ---------------------------------------------------===// 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 "TestingSupport/SubsystemRAII.h" 12 #include "lldb/Core/ModuleSpec.h" 13 #include "lldb/Host/FileSystem.h" 14 #include "lldb/Host/HostInfo.h" 15 #include "lldb/Symbol/LocateSymbolFile.h" 16 #include "lldb/Target/Target.h" 17 18 using namespace lldb_private; 19 20 namespace { 21 class SymbolsTest : public ::testing::Test { 22 public: 23 SubsystemRAII<FileSystem, HostInfo> subsystems; 24 }; 25 } // namespace 26 TEST_F(SymbolsTest,TerminateLocateExecutableSymbolFileForUnknownExecutableAndUnknownSymbolFile)27TEST_F( 28 SymbolsTest, 29 TerminateLocateExecutableSymbolFileForUnknownExecutableAndUnknownSymbolFile) { 30 ModuleSpec module_spec; 31 FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); 32 FileSpec symbol_file_spec = 33 Symbols::LocateExecutableSymbolFile(module_spec, search_paths); 34 EXPECT_TRUE(symbol_file_spec.GetFilename().IsEmpty()); 35 } 36 TEST_F(SymbolsTest,LocateExecutableSymbolFileForUnknownExecutableAndMissingSymbolFile)37TEST_F(SymbolsTest, 38 LocateExecutableSymbolFileForUnknownExecutableAndMissingSymbolFile) { 39 ModuleSpec module_spec; 40 // using a GUID here because the symbol file shouldn't actually exist on disk 41 module_spec.GetSymbolFileSpec().SetFile( 42 "4A524676-B24B-4F4E-968A-551D465EBAF1.so", FileSpec::Style::native); 43 FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); 44 FileSpec symbol_file_spec = 45 Symbols::LocateExecutableSymbolFile(module_spec, search_paths); 46 EXPECT_TRUE(symbol_file_spec.GetFilename().IsEmpty()); 47 } 48