From 9e4aa04ad1f6e63f4aa99f516b19e4ff2592918b Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Thu, 22 Apr 2021 20:04:17 -0700 Subject: Remove side effect from mount tests Dropping CAP_SYS_ADMIN and not restoring it causes other tests to be skipped. PiperOrigin-RevId: 370002644 --- test/syscalls/linux/mount.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'test/syscalls/linux/mount.cc') diff --git a/test/syscalls/linux/mount.cc b/test/syscalls/linux/mount.cc index cdc223d07..92d0fb05c 100644 --- a/test/syscalls/linux/mount.cc +++ b/test/syscalls/linux/mount.cc @@ -67,9 +67,7 @@ TEST(MountTest, MountInvalidTarget) { TEST(MountTest, MountPermDenied) { // Clear CAP_SYS_ADMIN. - if (ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_SYS_ADMIN))) { - EXPECT_NO_ERRNO(SetCapability(CAP_SYS_ADMIN, false)); - } + AutoCapability cap(CAP_SYS_ADMIN, false); // Linux expects a valid target before checking capability. auto const dir = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateDir()); -- cgit v1.2.3