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


[ROCm/ROCR-Runtime commit: 25288e07dc]
Este commit está contenido en:
Felix Kuehling
2021-02-26 22:31:08 -05:00
cometido por Kent Russell
padre ec289d055f
commit 4da176c09d
@@ -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));
}