Files
linuxdeploy/tests/core/test_elf_file.cpp
TheAssassin 3c6096433d Detect dynamically linked and debug symbols only ELF files
TODO: extract ELF stuff into new small C++ wrapper library that can be used in various places (e.g., AppImageLauncher, the AppImage runtime, ...)
2021-05-29 01:19:42 +02:00

31 lines
917 B
C++

#include "gtest/gtest.h"
#include "linuxdeploy/core/elf_file.h"
using namespace std;
using namespace linuxdeploy::core;
namespace bf = boost::filesystem;
using namespace std;
using namespace linuxdeploy::core::elf_file;
namespace LinuxDeployTest {
class ElfFileTest : public ::testing::Test {};
TEST_F(ElfFileTest, checkIsDebugSymbolsFile) {
ElfFile debugSymbolsFile(SIMPLE_LIBRARY_DEBUG_PATH);
EXPECT_TRUE(debugSymbolsFile.isDebugSymbolsFile());
ElfFile regularLibraryFile(SIMPLE_LIBRARY_PATH);
EXPECT_FALSE(regularLibraryFile.isDebugSymbolsFile());
}
TEST_F(ElfFileTest, checkIsDynamicallyLinked) {
ElfFile regularLibraryFile(SIMPLE_EXECUTABLE_PATH);
EXPECT_TRUE(regularLibraryFile.isDynamicallyLinked());
ElfFile staticLibraryFile(SIMPLE_EXECUTABLE_STATIC_PATH);
EXPECT_FALSE(staticLibraryFile.isDynamicallyLinked());
}
}