-
Notifications
You must be signed in to change notification settings - Fork 61
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
Test to exercise signal delivery during a blocked pipe send. #1046
base: dev
Are you sure you want to change the base?
Conversation
{ | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | |
} | |
{ | |
} |
CHERIBSDTEST_CHECK_SYSCALL(alarm(1)); | ||
len = write(fds[0], buffer, sizeof(buffer)); | ||
if (len < 0 && errno != EINTR) | ||
cheribsdtest_failure_err("write"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really a successful test if you write the entire buffer without getting interrupted? If you want to ensure that the write was interrupted, then I think what you want to do instead might be something like:
static volatile sig_atomic_t alarm_fired;
static void
sigalrm_handler(...)
{
alarm_fired = 1;
}
CHERIBSDTEST(...)
{
...
len = write(fds[0], buffer, sizeof(buffer));
if (len == -1 && errno != EINTR)
cheribsdtest_failure_err("write");
/* we probably have some sort of wrapper for this */
if (alarm_fired == 0)
cheribsdtest_failure("failed to interrupt write");
Even this is somewhat racy as in theory the handler could fire before or after the write(), but those races are probably rare enough to ignore.
Test to trigger #1045 without the more complex IPC context that the original test required for other purposes.