test: check inode dumps in the presence of read/map errors

This commit is contained in:
Marcus Holland-Moritz 2024-01-15 21:04:04 +01:00
parent 6cf799a96e
commit 70d3c8232d

View File

@ -2188,7 +2188,7 @@ TEST_P(map_file_error_test, delayed) {
.max_name_len = 8,
.with_errors = true});
// t.os->setenv("DWARFS_DUMP_INODES", "inodes.dump");
t.os->setenv("DWARFS_DUMP_INODES", "inodes.dump");
// t.iol->use_real_terminal(true);
std::string args = "-i / -o test.dwarfs --no-progress --log-level=verbose";
@ -2264,6 +2264,24 @@ TEST_P(map_file_error_test, delayed) {
std::cout << folly::hexDump(it->second.data(), it->second.size())
<< std::endl;
}
auto dump = t.fa->get_file("inodes.dump");
ASSERT_TRUE(dump);
if (extra_args.find("--file-hash=none") == std::string::npos) {
EXPECT_THAT(dump.value(), ::testing::HasSubstr("(invalid)"))
<< dump.value();
}
if (extra_args.find("--order=revpath") != std::string::npos) {
EXPECT_THAT(dump.value(), ::testing::HasSubstr("similarity: none"))
<< dump.value();
} else {
EXPECT_THAT(dump.value(), ::testing::HasSubstr("similarity: nilsimsa"))
<< dump.value();
}
if (extra_args.find("--categorize") != std::string::npos) {
EXPECT_THAT(dump.value(), ::testing::HasSubstr("[incompressible]"))
<< dump.value();
}
}
namespace {