Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sem_timedwait: 2-1.c : There is always an error output TEST FAILED #1114

Open
chenguanxi12138 opened this issue Dec 22, 2023 · 2 comments
Open

Comments

@chenguanxi12138
Copy link

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?

@metan-ucw
Copy link
Member

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?

@chenguanxi12138
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants