summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/proc_pid_uid_gid_map.cc
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-01-21 16:32:49 -0800
committergVisor bot <gvisor-bot@google.com>2020-01-21 16:32:49 -0800
commit45a8edbd5ae6c836317923dc7d2b5baac9feea98 (patch)
treec8e011c89c1808fe2e520ee41c9bcb2af7911cd0 /test/syscalls/linux/proc_pid_uid_gid_map.cc
parentb3405a719cbb33dac2deced192209a5584e5e3d6 (diff)
parent200cf245c4ed43d8e2a37484cdbc36f5fbfa1ac9 (diff)
Merge pull request #1492 from majek:err_typo_in_netstack_tests
PiperOrigin-RevId: 290840370
Diffstat (limited to 'test/syscalls/linux/proc_pid_uid_gid_map.cc')
-rw-r--r--test/syscalls/linux/proc_pid_uid_gid_map.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/syscalls/linux/proc_pid_uid_gid_map.cc b/test/syscalls/linux/proc_pid_uid_gid_map.cc
index 748f7be58..8e268ebd1 100644
--- a/test/syscalls/linux/proc_pid_uid_gid_map.cc
+++ b/test/syscalls/linux/proc_pid_uid_gid_map.cc
@@ -117,13 +117,13 @@ void DenyPidSetgroups(pid_t pid) {
}
// Returns a valid UID/GID that isn't id.
-uint32_t another_id(uint32_t id) { return (id + 1) % 65535; }
+uint32 another_id(uint32 id) { return (id + 1) % 65535; }
struct TestParam {
std::string desc;
int cap;
std::function<std::string(absl::string_view)> get_map_filename;
- std::function<uint32_t()> get_current_id;
+ std::function<uint32()> get_current_id;
};
std::string DescribeTestParam(const ::testing::TestParamInfo<TestParam>& info) {
@@ -135,17 +135,17 @@ std::vector<TestParam> UidGidMapTestParams() {
[](absl::string_view pid) {
return absl::StrCat("/proc/", pid, "/uid_map");
},
- []() -> uint32_t { return getuid(); }},
+ []() -> uint32 { return getuid(); }},
TestParam{"GID", CAP_SETGID,
[](absl::string_view pid) {
return absl::StrCat("/proc/", pid, "/gid_map");
},
- []() -> uint32_t { return getgid(); }}};
+ []() -> uint32 { return getgid(); }}};
}
class ProcUidGidMapTest : public ::testing::TestWithParam<TestParam> {
protected:
- uint32_t CurrentID() { return GetParam().get_current_id(); }
+ uint32 CurrentID() { return GetParam().get_current_id(); }
};
class ProcSelfUidGidMapTest : public ProcUidGidMapTest {
@@ -198,7 +198,7 @@ TEST_P(ProcSelfUidGidMapTest, IsInitiallyEmpty) {
TEST_P(ProcSelfUidGidMapTest, IdentityMapOwnID) {
SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(CanCreateUserNamespace()));
- uint32_t id = CurrentID();
+ uint32 id = CurrentID();
std::string line = absl::StrCat(id, " ", id, " 1");
EXPECT_THAT(
InNewUserNamespaceWithMapFD([&](int fd) {
@@ -213,7 +213,7 @@ TEST_P(ProcSelfUidGidMapTest, TrailingNewlineAndNULIgnored) {
// and an invalid (incomplete) map entry are appended to the valid entry. The
// newline should be accepted, and everything after the NUL should be ignored.
SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(CanCreateUserNamespace()));
- uint32_t id = CurrentID();
+ uint32 id = CurrentID();
std::string line = absl::StrCat(id, " ", id, " 1\n\0 4 3");
EXPECT_THAT(
InNewUserNamespaceWithMapFD([&](int fd) {
@@ -227,8 +227,8 @@ TEST_P(ProcSelfUidGidMapTest, TrailingNewlineAndNULIgnored) {
TEST_P(ProcSelfUidGidMapTest, NonIdentityMapOwnID) {
SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(CanCreateUserNamespace()));
- uint32_t id = CurrentID();
- uint32_t id2 = another_id(id);
+ uint32 id = CurrentID();
+ uint32 id2 = another_id(id);
std::string line = absl::StrCat(id2, " ", id, " 1");
EXPECT_THAT(
InNewUserNamespaceWithMapFD([&](int fd) {
@@ -243,8 +243,8 @@ TEST_P(ProcSelfUidGidMapTest, MapOtherID) {
// Whether or not we have CAP_SET*ID is irrelevant: the process running in the
// new (child) user namespace won't have any capabilities in the current
// (parent) user namespace, which is needed.
- uint32_t id = CurrentID();
- uint32_t id2 = another_id(id);
+ uint32 id = CurrentID();
+ uint32 id2 = another_id(id);
std::string line = absl::StrCat(id, " ", id2, " 1");
EXPECT_THAT(InNewUserNamespaceWithMapFD([&](int fd) {
DenySelfSetgroups();
@@ -270,8 +270,8 @@ TEST_P(ProcPidUidGidMapTest, MapOtherIDPrivileged) {
std::tie(child_pid, cleanup_child) =
ASSERT_NO_ERRNO_AND_VALUE(CreateProcessInNewUserNamespace());
- uint32_t id = CurrentID();
- uint32_t id2 = another_id(id);
+ uint32 id = CurrentID();
+ uint32 id2 = another_id(id);
std::string line = absl::StrCat(id, " ", id2, " 1");
DenyPidSetgroups(child_pid);
auto fd = ASSERT_NO_ERRNO_AND_VALUE(OpenMapFile(child_pid));