Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151821434
D50092.id154585.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D50092.id154585.diff
View Options
diff --git a/usr.bin/mail/tests/mail_sigint_test.c b/usr.bin/mail/tests/mail_sigint_test.c
--- a/usr.bin/mail/tests/mail_sigint_test.c
+++ b/usr.bin/mail/tests/mail_sigint_test.c
@@ -11,6 +11,7 @@
#include <signal.h>
#include <stdbool.h>
#include <stdlib.h>
+#include <time.h>
#include <unistd.h>
#include <atf-c.h>
@@ -32,6 +33,7 @@
char ebuf[1024] = "";
struct pollfd fds[2];
int ipd[2], opd[2], epd[2], spd[2];
+ time_t start, now;
size_t olen = 0, elen = 0;
ssize_t rlen;
pid_t pid;
@@ -86,6 +88,7 @@
fds[0].events = POLLIN;
fds[1].fd = epd[0];
fds[1].events = POLLIN;
+ time(&start);
for (;;) {
if (poll(fds, 2, 1000) < 0)
atf_tc_fail("failed to poll");
@@ -101,10 +104,15 @@
atf_tc_fail("failed to read");
elen += rlen;
}
- if (elen > 0 && kc == 1) {
+ time(&now);
+ if (now - start > 1 && elen > 0 && kc == 1) {
kill(pid, SIGINT);
kc++;
}
+ if (now - start > 15 && kc > 0) {
+ kill(pid, SIGKILL);
+ kc = -1;
+ }
if (waitpid(pid, &status, WNOHANG) == pid)
break;
}
@@ -114,14 +122,16 @@
close(spd[0]);
if (interactive) {
ATF_CHECK(WIFEXITED(status));
- ATF_CHECK_INTEQ(1, WEXITSTATUS(status));
+ if (WIFEXITED(status))
+ ATF_CHECK_INTEQ(1, WEXITSTATUS(status));
ATF_CHECK_INTEQ(2, kc);
ATF_CHECK_STREQ("", obuf);
ATF_CHECK_MATCH("Interrupt -- one more to kill letter", ebuf);
atf_utils_compare_file("dead.letter", BODY);
} else {
ATF_CHECK(WIFSIGNALED(status));
- ATF_CHECK_INTEQ(SIGINT, WTERMSIG(status));
+ if (WIFSIGNALED(status))
+ ATF_CHECK_INTEQ(SIGINT, WTERMSIG(status));
ATF_CHECK_INTEQ(1, kc);
ATF_CHECK_STREQ("", obuf);
ATF_CHECK_STREQ("", ebuf);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 11, 9:41 PM (18 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31309913
Default Alt Text
D50092.id154585.diff (1 KB)
Attached To
Mode
D50092: mail: Further refine the SIGINT test.
Attached
Detach File
Event Timeline
Log In to Comment