Fix mount entries listing for tmpfs

PiperOrigin-RevId: 276447076
Change-Id: Ia5873e34327c281e5c9fb66f5f58a0dd49ba10b0
This commit is contained in:
Wiktor Garbacz 2019-10-24 02:37:28 -07:00 committed by Copybara-Service
parent 282f2d65e7
commit a1b291d44a
2 changed files with 5 additions and 0 deletions

View File

@ -589,6 +589,7 @@ void RecursivelyListMountsImpl(const MountTree& tree,
inside_entries->emplace_back(absl::StrCat(rw_str, tree_path));
outside_entries->emplace_back(absl::StrCat(node.file_node().outside()));
} else if (node.has_tmpfs_node()) {
inside_entries->emplace_back(tree_path);
outside_entries->emplace_back(
absl::StrCat("tmpfs: ", node.tmpfs_node().tmpfs_options()));
}

View File

@ -205,6 +205,8 @@ TEST(MountTreeTest, TestList) {
}
}
ASSERT_THAT(mounts.AddTmpfs(file::CleanPath("/d"), 1024 * 1024), IsOk());
std::vector<std::string> outside_entries;
std::vector<std::string> inside_entries;
mounts.RecursivelyListMounts(&outside_entries, &inside_entries);
@ -219,6 +221,7 @@ TEST(MountTreeTest, TestList) {
"R /h",
"W /i/j/k",
"W /i/l/",
"/d",
}));
EXPECT_THAT(
outside_entries,
@ -229,6 +232,7 @@ TEST(MountTreeTest, TestList) {
absl::StrCat("/some/dir/", "h"),
absl::StrCat("/some/dir/", "i/j/k"),
absl::StrCat("/some/dir/", "i/l/"),
absl::StrCat("tmpfs: size=", 1024*1024),
}));
// clang-format on
}