ltp
ltp copied to clipboard
sem_timedwait: 2-1.c : There is always an error output TEST FAILED
When I run the code interfaces/sem_timedwait/2-1.c, I always get the following output: TEST FAILED TEST PASSED After my analysis, I found that this is due to the fact that the parent process and the child process are not operating on the same mysemp, the mysemp of child process is just a copy of the mysemp of parent process with the same name. So this will result in the parent process not being able to complete the unlocking of the child process via the sem_post operation, and the child process will print a FAILED message due to the timeout. Is this the desired result of this test case, or do we actually want the parent and child processes to operate the same semaphore?
And it looks like the failure is ignored since the code should be:
if (WEXITSTATUS(i)
return PTS_FAILE;
We can fix the test either by putting the semaphore into a piece of shared memory or by running the child in a thread instead. Can you send a patch?
And it looks like the failure is ignored since the code should be:
if (WEXITSTATUS(i) return PTS_FAILE;We can fix the test either by putting the semaphore into a piece of shared memory or by running the child in a thread instead. Can you send a patch?
Of course, I'll send a patch later