diff --git a/kernel_lite/process_posix/src/UidGidTest.cpp b/kernel_lite/process_posix/src/UidGidTest.cpp index a8fe8d0fdc5a53323beec0906f07178165d4393e..cde44231371673ac2c52011b983bfc303b2a7f5b 100755 --- a/kernel_lite/process_posix/src/UidGidTest.cpp +++ b/kernel_lite/process_posix/src/UidGidTest.cpp @@ -642,7 +642,6 @@ HWTEST_F(UidGidTest, testGetgroups, Function | MediumTest | Level1) int n = getgroups(0, gidList); ASSERT_EQ(n, 1); ASSERT_EQ(gidList[0], 0); - n = getgroups(testSize, gidList); ASSERT_EQ(n, 1); ASSERT_EQ(gidList[0], SHELL_GID); @@ -691,8 +690,6 @@ HWTEST_F(UidGidTest, testSetgroups1, Function | MediumTest | Level1) n = getgroups(2, gidListOut); EXPECT_EQ(n, 1); EXPECT_EQ(gidListOut[0], SHELL_GID); - gidListOut[0] = 2; - int ret = setgroups(2, gidListOut); free(gidListIn); free(gidListOut); } @@ -708,8 +705,8 @@ HWTEST_F(UidGidTest, testSetgroups2, Function | MediumTest | Level1) gid_t gidListOut[4] = {0}; LOG("Init: make sure groups not changed by other test."); - int n = getgroups(2, gidListOut); - EXPECT_EQ(n, 2); + int n = getgroups(1, gidListOut); + EXPECT_EQ(n, 1); EXPECT_EQ(gidListOut[0], SHELL_GID); LOG("add 2 groups"); diff --git a/kernel_lite/process_posix/src/UidGidTest.h b/kernel_lite/process_posix/src/UidGidTest.h index e2b15bbd719121f5f46240beb4fe5ccffdb8b398..fc3a1131322bc4814e583a39ee7dc4952f294c32 100755 --- a/kernel_lite/process_posix/src/UidGidTest.h +++ b/kernel_lite/process_posix/src/UidGidTest.h @@ -61,6 +61,7 @@ protected: setgid(SHELL_GID); AssertAllUid(SHELL_UID); AssertAllGid(SHELL_GID); + int rt = setgroups(0, NULL); } };