mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-09 04:19:10 -04:00
test(mkdwarfs): more error tests
This commit is contained in:
parent
5cf79e2208
commit
5dd8715964
@ -1154,6 +1154,23 @@ TEST(mkdwarfs_test, recompress) {
|
||||
EXPECT_TRUE(fs.find("/random"));
|
||||
}
|
||||
|
||||
{
|
||||
auto t = tester(image);
|
||||
EXPECT_EQ(1, t.run({"-i", image_file, "-o", "-", "--recompress",
|
||||
"--recompress-categories=pcmaudio/metadata,SoMeThInG"}))
|
||||
<< t.err();
|
||||
EXPECT_THAT(t.err(), ::testing::HasSubstr(
|
||||
"no category 'SoMeThInG' in input filesystem"));
|
||||
}
|
||||
|
||||
{
|
||||
auto t = tester(image);
|
||||
EXPECT_EQ(1, t.run({"-i", image_file, "-o", "-", "--recompress", "-C",
|
||||
"SoMeThInG::null"}))
|
||||
<< t.err();
|
||||
EXPECT_THAT(t.err(), ::testing::HasSubstr("unknown category: 'SoMeThInG'"));
|
||||
}
|
||||
|
||||
{
|
||||
auto corrupt_image = image;
|
||||
corrupt_image[64] ^= 0x01; // flip a bit right after the header
|
||||
@ -1900,3 +1917,22 @@ TEST(mkdwarfs_test, low_memory_limit) {
|
||||
EXPECT_THAT(t.err(), ::testing::HasSubstr("low memory limit"));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(mkdwarfs_test, recoverable_errors) {
|
||||
{
|
||||
mkdwarfs_tester t;
|
||||
t.os->set_access_fail("/somedir/ipsum.py");
|
||||
EXPECT_EQ(1, t.run("-i / -o - -l4")) << t.err();
|
||||
EXPECT_THAT(t.err(),
|
||||
::testing::HasSubstr("filesystem created with 1 error"));
|
||||
}
|
||||
|
||||
{
|
||||
mkdwarfs_tester t;
|
||||
t.os->set_access_fail("/somedir/ipsum.py");
|
||||
t.os->set_access_fail("/baz.pl");
|
||||
EXPECT_EQ(1, t.run("-i / -o - -l4")) << t.err();
|
||||
EXPECT_THAT(t.err(),
|
||||
::testing::HasSubstr("filesystem created with 2 errors"));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user