Fixes for integration tests of sem_syscalls #268
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is a fix for [#248] issue. where we see intermittent test failures which uses semaphores. and performs actions like
The tests effected are:
Causes:
The first kind of issue was assertion failures when sem_getvalue_syscall is performed outside of the critical section of parent/child process. which causes nondeterministic outputs since once out of critical section the busy waiting thread/process will go into its critical section and modify the semaphore value.
The second type is performing sem_try_wait call to enter into critical section, and always asserting a success from the call. sem_try_wait is different from sem_wait in the sense there is no busy waiting and thus if another thread/process is in the critical section, it just returns false.
The third kind of issue is performing sem_destroy before the child process exits its critical section. which causes nondeterministic behaviour, leading to child's sem_post call to throw error. parent process has to wait for all the threads/process to exit before destroying semaphore and shared memory.
Fixes # (issue)
Type of change
How Has This Been Tested?
lind_project/tests/test_cases/test_a.c
lind_project/tests/test_cases/test_b.c
Checklist: