diff --git a/kernel_lite/fs_posix/src/FileSystemTest.cpp b/kernel_lite/fs_posix/src/FileSystemTest.cpp index 7a0e1aede79e72bd48acfdd1992cf9cf181c773e..44ff3cf243ed187c53cc3ba022b84e525583515a 100755 --- a/kernel_lite/fs_posix/src/FileSystemTest.cpp +++ b/kernel_lite/fs_posix/src/FileSystemTest.cpp @@ -22,6 +22,9 @@ using namespace testing::ext; // delete test file and dir void DeleteTestFiles() { + if (access(TOP_DIR "/DIR_NEW", F_OK) == 0) { + RemoveDir(TOP_DIR "/DIR_NEW"); + } if (access(TOP_DIR "/" DIR0, F_OK) == 0) { RemoveDir(TOP_DIR "/" DIR0); } diff --git a/kernel_lite/fs_posix/src/FsFcntlTest.cpp b/kernel_lite/fs_posix/src/FsFcntlTest.cpp index 66e106f284c6a793a34efd498ce5c42a4b70385a..88f1ad68612214225ef1fa9ce5918e18acfb2d39 100755 --- a/kernel_lite/fs_posix/src/FsFcntlTest.cpp +++ b/kernel_lite/fs_posix/src/FsFcntlTest.cpp @@ -324,6 +324,7 @@ HWTEST_F(FileSystemTest, testOpenEisdir, Function | MediumTest | Level2) fd = open(DIR0, O_RDWR, 0777); EXPECT_EQ(fd, -1) << "> Should open failed"; EXPECT_EQ(errno, EISDIR); + close(fd); } /** diff --git a/kernel_lite/process_posix/src/ProcessTest.cpp b/kernel_lite/process_posix/src/ProcessTest.cpp index c08fb7a22db5423763b9fdf6cfe2a6af1a39188c..adfff5b04a88eeca1b50e55104d747a96a40b25c 100755 --- a/kernel_lite/process_posix/src/ProcessTest.cpp +++ b/kernel_lite/process_posix/src/ProcessTest.cpp @@ -50,7 +50,7 @@ HWTEST_F(ProcessTest, testLineBigExit, Function | MediumTest | Level2) } Msleep(50); exitCode = 0; - ASSERT_EQ(CheckProcStatus(pid, &exitCode), 1); + ASSERT_EQ(CheckProcStatus(pid, &exitCode, 0), 1); ASSERT_EQ(exitCode, reInt[i]); } } @@ -160,7 +160,7 @@ HWTEST_F(ProcessTest, testLineExit, Function | MediumTest | Level2) } Msleep(50); exitCode = 0; - ASSERT_EQ(CheckProcStatus(pid, &exitCode), 1); + ASSERT_EQ(CheckProcStatus(pid, &exitCode, 0), 1); ASSERT_EQ(exitCode, reInt[i]); } } @@ -270,7 +270,7 @@ HWTEST_F(ProcessTest, testExit, Function | MediumTest | Level2) } Msleep(50); exitCode = 0; - ASSERT_EQ(CheckProcStatus(pid, &exitCode), 1); + ASSERT_EQ(CheckProcStatus(pid, &exitCode, 0), 1); ASSERT_EQ(exitCode, reInt[i]); } } @@ -343,7 +343,7 @@ int FunctionAssertFalse(void) } Msleep(50); int exitCode = 0; - int reInt = CheckProcStatus(pid, &exitCode); + int reInt = CheckProcStatus(pid, &exitCode, 0); if ((reInt == 2) && (exitCode == SIGABRT)) { LOG("> Success"); return 1; @@ -368,7 +368,7 @@ HWTEST_F(ProcessTest, testAssertFalse, Function | MediumTest | Level3) } Msleep(50); int exitCode = 0; - ASSERT_EQ(CheckProcStatus(pid, &exitCode), 2); + ASSERT_EQ(CheckProcStatus(pid, &exitCode, 0), 2); ASSERT_EQ(exitCode, SIGABRT); } @@ -534,5 +534,6 @@ HWTEST_F(ProcessTest, testWaitPidTest, Function | MediumTest | Level3) EXPECT_EQ(expectPid, 1); EXPECT_EQ(pidChild, 0); Msleep(50); + WaitProcExitedOK(pid); DeleteGlobalVariable(); }