Skip to content

Commit

Permalink
test: add proper --chmod=norm test
Browse files Browse the repository at this point in the history
  • Loading branch information
mhx committed Dec 30, 2023
1 parent aa5dfd2 commit a2c6b24
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/tool_main_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,29 @@ TEST_P(categorizer_test, end_to_end) {
INSTANTIATE_TEST_SUITE_P(dwarfs, categorizer_test,
::testing::Values("error", "warn", "info", "verbose",
"debug", "trace"));

TEST(mkdwarfs_test, chmod_norm) {
std::string const image_file = "test.dwarfs";

std::set<std::string> real, norm;

{
mkdwarfs_tester t;
EXPECT_EQ(0, t.run({"-i", "/", "-o", image_file}));
auto fs = t.fs_from_file(image_file);
fs.walk([&](auto const& iv) { real.insert(iv.inode().perm_string()); });
}

{
mkdwarfs_tester t;
EXPECT_EQ(0, t.run({"-i", "/", "-o", image_file, "--chmod=norm"}));
auto fs = t.fs_from_file(image_file);
fs.walk([&](auto const& iv) { norm.insert(iv.inode().perm_string()); });
}

EXPECT_NE(real, norm);

std::set<std::string> expected_norm = {"r--r--r--", "r-xr-xr-x"};

EXPECT_EQ(expected_norm, norm);
}

0 comments on commit a2c6b24

Please sign in to comment.