Visitar URL original
fix tests · linuxdeploy/linuxdeploy@0134c88 · GitHub
Skip to content

Commit 0134c88

Browse files
author
Tilman
committed
fix tests
1 parent a685c86 commit 0134c88

4 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎src/core/elf_file.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ namespace linuxdeploy {
162162

163163
ElfFile::ElfFile(const boost::filesystem::path& path) {
164164
// check if file exists
165-
if (!bf::exists(path) || !bf::is_regular_file(path))
165+
if (!bf::is_regular_file(path))
166166
throw ElfFileParseError("No such file: " + path.string());
167167

168168
// check magic bytes

‎tests/core/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function(ld_core_add_test_executable NAME)
1616
-DSIMPLE_ICON_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../data/simple_icon.svg"
1717
-DSIMPLE_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../data/simple_file.txt"
1818
-DREADONLY_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../data/readonly-file.txt"
19+
-DEMPTY_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../data/empty-file.txt"
1920
)
2021

2122
# make sure library and executable are built before test_appdir

‎tests/core/test_elf_file.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ namespace {
2323
}
2424

2525
void expectThrowsElfFileErrorInvalidElfHeader(const char* path) {
26-
expectElfFileConstructorThrowMessage(path, "Invalid magic bytes in file header");
26+
expectElfFileConstructorThrowMessage(path, "Invalid magic bytes in header of file: ");
2727
}
2828

2929
void expectThrowsElfFileErrorFileNotFound(const char* path) {
30-
expectElfFileConstructorThrowMessage(path, "No such file or directory: ");
30+
expectElfFileConstructorThrowMessage(path, "No such file: ");
3131
}
3232
}
3333

@@ -51,7 +51,7 @@ namespace LinuxDeployTest {
5151
}
5252

5353
TEST_F(ElfFileTest, checkInvalidElfHeaderOnEmptyFile) {
54-
expectThrowsElfFileErrorInvalidElfHeader("/dev/null");
54+
expectThrowsElfFileErrorInvalidElfHeader(EMPTY_FILE_PATH);
5555
}
5656

5757
TEST_F(ElfFileTest, checkInvalidElfHeaderOnRandomFiles) {

‎tests/data/empty-file.txt‎

Whitespace-only changes.

0 commit comments

Comments
 (0)