kfdtest: Handle EINTR in waitpid

If the signal arrives too late, it interrupts waitpid. Handle this
situation gracefully.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Change-Id: If4925c352c81ba7fef8a940460b91f5e720b451e
Šī revīzija ir iekļauta:
Felix Kuehling
2021-02-26 22:31:08 -05:00
revīziju iesūtīja Kent Russell
vecāks d8d8e3ddd6
revīzija 25288e07dc
+5 -1
Parādīt failu
@@ -1812,9 +1812,13 @@ TEST_F(KFDMemoryTest, SignalHandling) {
ASSERT_SUCCESS(hsaKmtMapMemoryToGPU(pDb, size, NULL));
LOG() << "Mapping finished" << std::endl;
int childStatus;
pid_t pid;
// Parent process, just wait for the child to finish
EXPECT_EQ(childPid, waitpid(childPid, &childStatus, 0));
do {
pid = waitpid(childPid, &childStatus, 0);
} while(pid == -1 && errno == EINTR);
EXPECT_EQ(childPid, pid);
EXPECT_NE(0, WIFEXITED(childStatus));
EXPECT_EQ(0, WEXITSTATUS(childStatus));
}