summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorChong Cai <chongc@google.com>2021-05-25 16:43:50 -0700
committergVisor bot <gvisor-bot@google.com>2021-05-25 16:46:28 -0700
commit080d122326a55f43ed8bc97c6c319d5ee87b1ca5 (patch)
tree33f37eef7c65808cbf7ce40b1396331a72fc3b0f /test
parentf298d732170fb52189d9a4fe571caa8174227639 (diff)
Enable verity after mount in verity_mount test
PiperOrigin-RevId: 375823719
Diffstat (limited to 'test')
-rw-r--r--test/syscalls/linux/BUILD1
-rw-r--r--test/syscalls/linux/verity_mount.cc8
2 files changed, 7 insertions, 2 deletions
diff --git a/test/syscalls/linux/BUILD b/test/syscalls/linux/BUILD
index 0582e16ce..f3df889b6 100644
--- a/test/syscalls/linux/BUILD
+++ b/test/syscalls/linux/BUILD
@@ -1346,6 +1346,7 @@ cc_binary(
"//test/util:temp_path",
"//test/util:test_main",
"//test/util:test_util",
+ "//test/util:verity_util",
],
)
diff --git a/test/syscalls/linux/verity_mount.cc b/test/syscalls/linux/verity_mount.cc
index e73dd5599..d6bfcb46d 100644
--- a/test/syscalls/linux/verity_mount.cc
+++ b/test/syscalls/linux/verity_mount.cc
@@ -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