Enable verity after mount in verity_mount test

PiperOrigin-RevId: 375823719
This commit is contained in:
Chong Cai
2021-05-25 16:46:28 -07:00
committed by gVisor bot
parent f298d73217
commit 080d122326
2 changed files with 7 additions and 2 deletions
+1
View File
@@ -1346,6 +1346,7 @@ cc_binary(
"//test/util:temp_path",
"//test/util:test_main",
"//test/util:test_util",
"//test/util:verity_util",
],
)
+6 -2
View File
@@ -22,13 +22,14 @@
#include "test/util/capability_util.h"
#include "test/util/temp_path.h"
#include "test/util/test_util.h"
#include "test/util/verity_util.h"
namespace gvisor {
namespace testing {
namespace {
// Mount verity file system on an existing gofer mount.
// Mount verity file system on an existing tmpfs mount.
TEST(MountTest, MountExisting) {
// Verity is implemented in VFS2.
SKIP_IF(IsRunningWithVFS1());
@@ -43,8 +44,11 @@ TEST(MountTest, MountExisting) {
// Mount a verity file system on the existing gofer mount.
auto const verity_dir = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateDir());
std::string opts = "lower_path=" + tmpfs_dir.path();
EXPECT_THAT(mount("", verity_dir.path().c_str(), "verity", 0, opts.c_str()),
ASSERT_THAT(mount("", verity_dir.path().c_str(), "verity", 0, opts.c_str()),
SyscallSucceeds());
auto const fd =
ASSERT_NO_ERRNO_AND_VALUE(Open(verity_dir.path(), O_RDONLY, 0777));
EXPECT_THAT(ioctl(fd.get(), FS_IOC_ENABLE_VERITY), SyscallSucceeds());
}
} // namespace