diff --git a/kernel_lite/process_posix/src/UidGidTest.cpp b/kernel_lite/process_posix/src/UidGidTest.cpp index 00b916d165e620575bb268490c04d95099667d4d..ce8df47c6d4632b5c0c7d2f34bf2ad30d9eee83e 100755 --- a/kernel_lite/process_posix/src/UidGidTest.cpp +++ b/kernel_lite/process_posix/src/UidGidTest.cpp @@ -640,15 +640,14 @@ HWTEST_F(UidGidTest, testGetgroups, Function | MediumTest | Level1) const int testSize = 10; gid_t gidList[testSize] = {0}; int n = getgroups(0, gidList); - ASSERT_EQ(n, 2); + ASSERT_EQ(n, 1); int rt = getgroups(n, gidList); ASSERT_EQ(gidList[0], SHELL_GID); - ASSERT_EQ(gidList[1], 0); ASSERT_EQ(rt, n); n = getgroups(testSize, gidList); - ASSERT_EQ(n, 2); + ASSERT_EQ(n, 1); ASSERT_EQ(gidList[0], SHELL_GID); - ASSERT_EQ(gidList[1], 0); + } /** @@ -675,6 +674,7 @@ HWTEST_F(UidGidTest, testSetgroups1, Function | MediumTest | Level1) gidListIn[i] = GetRandID(); gidListOut[i] = 0; } + int rt = setgroups(groupSize, gidListIn); EXPECT_EQ(rt, 0); @@ -710,10 +710,9 @@ HWTEST_F(UidGidTest, testSetgroups2, Function | MediumTest | Level1) LOG("Init: make sure groups not changed by other test."); int n = getgroups(0, gidListOut); - EXPECT_EQ(n, 2); + EXPECT_EQ(n, 1); int rt = getgroups(n, gidListOut); EXPECT_EQ(gidListOut[0], SHELL_GID); - EXPECT_EQ(gidListOut[1], 0); EXPECT_EQ(rt, n); LOG("add 2 groups"); @@ -745,6 +744,7 @@ HWTEST_F(UidGidTest, testSetgroupsFail, Function | MediumTest | Level3) LOG("add 2 groups"); gid_t gidListIn[2] = {GetRandID(), GetRandID()}; gid_t gidListOut[4] = {0}; + int rt = setgroups(2, gidListIn); EXPECT_EQ(rt, 0); diff --git a/kernel_lite/process_posix/src/UidGidTest.h b/kernel_lite/process_posix/src/UidGidTest.h index bcfea1e55d513e7a493594bc588b933f598c790a..8d1fcf4893ae1a01e9e89ff8ec99727f973d3096 100755 --- a/kernel_lite/process_posix/src/UidGidTest.h +++ b/kernel_lite/process_posix/src/UidGidTest.h @@ -67,11 +67,7 @@ protected: int rt = getgroups(groupNum, groupsArray); EXPECT_EQ(rt, groupNum); } - void SetUp() - { - LOG("SetUp: set gid"); - setgid(SHELL_GID); - } + void TearDown() { LOG("TearDown: reset uid and gid");