diff options
author | Fabricio Voznika <fvoznika@google.com> | 2021-04-28 16:14:52 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-28 16:22:24 -0700 |
commit | e1149179f3d5d7cbacb160d5bee6b00fe64a08ae (patch) | |
tree | bf1537c80ce62848d5f483212ebbb0e3f49bb540 /test/syscalls/linux/uname.cc | |
parent | 704728d38fdb3ceaf8dfbfdba84eee183775b90c (diff) |
Remove side effect from test cases
Restore capabilities for tests that need to change them.
PiperOrigin-RevId: 371007047
Diffstat (limited to 'test/syscalls/linux/uname.cc')
-rw-r--r-- | test/syscalls/linux/uname.cc | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/test/syscalls/linux/uname.cc b/test/syscalls/linux/uname.cc index d8824b171..759ea4f53 100644 --- a/test/syscalls/linux/uname.cc +++ b/test/syscalls/linux/uname.cc @@ -76,9 +76,7 @@ TEST(UnameTest, SetNames) { } TEST(UnameTest, UnprivilegedSetNames) { - if (ASSERT_NO_ERRNO_AND_VALUE(HaveCapability(CAP_SYS_ADMIN))) { - EXPECT_NO_ERRNO(SetCapability(CAP_SYS_ADMIN, false)); - } + AutoCapability cap(CAP_SYS_ADMIN, false); EXPECT_THAT(sethostname("", 0), SyscallFailsWithErrno(EPERM)); EXPECT_THAT(setdomainname("", 0), SyscallFailsWithErrno(EPERM)); |