Deleted Added
full compact
26c26
< * $FreeBSD: head/tools/regression/aio/aiotest/aiotest.c 253526 2013-07-21 19:21:18Z kib $
---
> * $FreeBSD: head/tools/regression/aio/aiotest/aiotest.c 280893 2015-03-31 06:43:55Z ngie $
41c41,42
< #include <sys/types.h>
---
> #include <sys/param.h>
> #include <sys/module.h>
82d82
< static int aio_notpresent;
84,87d83
< /*
< * Attempt to provide a cleaner failure mode in the event AIO support is not
< * present by catching and reporting SIGSYS.
< */
89c85
< aio_sigsys(int sig)
---
> aio_available(void)
92c88,91
< aio_notpresent = 1;
---
> if (modfind("aio") == -1)
> errx(0,
> "aio support not available in the kernel; skipping "
> "testcases");
95,102d93
< static void
< aio_sigsys_setup(void)
< {
<
< if (signal(SIGSYS, aio_sigsys) == SIG_ERR)
< errx(-1, "FAIL: signal(SIGSYS): %s", strerror(errno));
< }
<
108c99
< aio_timeout_signal(int sig)
---
> aio_timeout_signal(int sig __unused)
120c111
< errx(-1, "FAIL: %s: %s: aio_timeout_set: signal(SIGALRM): %s",
---
> errx(1, "FAIL: %s: %s: aio_timeout_set: signal(SIGALRM): %s",
130c121
< errx(-1, "FAIL: %s: %s: aio_timeout_stop: signal(NULL): %s",
---
> errx(1, "FAIL: %s: %s: aio_timeout_stop: signal(NULL): %s",
182c173
< errx(-1, "FAIL: %s: aio_context_init: buffer too large",
---
> errx(1, "FAIL: %s: aio_context_init: buffer too large",
193c184
< errx(-1, "%s: aio_context_init: aio_test_buffer: internal "
---
> errx(1, "%s: aio_context_init: aio_test_buffer: internal "
226d216
< int error;
227a218,219
> aio_available();
>
238,239d229
< if (aio_notpresent)
< errno = EOPNOTSUPP;
242c232
< errx(-1, "FAIL: %s: aio_write_test: "
---
> errx(1, "FAIL: %s: aio_write_test: "
247c237
< errx(-1, "FAIL: %s: aio_write_test: aio_write: %s",
---
> errx(1, "FAIL: %s: aio_write_test: aio_write: %s",
254,255d243
< if (aio_notpresent)
< errno = EOPNOTSUPP;
258c246
< errx(-1, "FAIL: %s: aio_write_test: "
---
> errx(1, "FAIL: %s: aio_write_test: "
264c252
< errx(-1, "FAIL: %s: aio_write_test: aio_waitcomplete: %s",
---
> errx(1, "FAIL: %s: aio_write_test: aio_waitcomplete: %s",
272c260
< errx(-1, "FAIL: %s: aio_write_test: aio_waitcomplete: short "
---
> errx(1, "FAIL: %s: aio_write_test: aio_waitcomplete: short "
286a275,276
> aio_available();
>
298,299d287
< if (aio_notpresent)
< errno = EOPNOTSUPP;
302c290
< errx(-1, "FAIL: %s: aio_read_test: "
---
> errx(1, "FAIL: %s: aio_read_test: "
307c295
< errx(-1, "FAIL: %s: aio_read_test: aio_read %s", ac->ac_test,
---
> errx(1, "FAIL: %s: aio_read_test: aio_read %s", ac->ac_test,
314,315d301
< if (aio_notpresent)
< errno = EOPNOTSUPP;
318c304
< errx(-1, "FAIL: %s: aio_read_test: "
---
> errx(1, "FAIL: %s: aio_read_test: "
324c310
< errx(-1, "FAIL: %s: aio_read_test: aio_waitcomplete: %s",
---
> errx(1, "FAIL: %s: aio_read_test: aio_waitcomplete: %s",
332c318
< errx(-1, "FAIL: %s: aio_read_test: aio_waitcomplete: short "
---
> errx(1, "FAIL: %s: aio_read_test: aio_waitcomplete: short "
338c324
< errx(-1, "FAIL: %s: aio_read_test: buffer mismatch",
---
> errx(1, "FAIL: %s: aio_read_test: buffer mismatch",
377a364,365
> aio_available();
>
381c369
< errx(-1, "FAIL: aio_file_test: mkstemp: %s",
---
> errx(1, "FAIL: aio_file_test: mkstemp: %s",
425a414,415
> aio_available();
>
427c417
< * In theory, mktemp() can return a name that is then collided with.
---
> * In theory, mkstemp() can return a name that is then collided with.
432c422,425
< mktemp(pathname);
---
> if (mkstemp(pathname) == -1)
> err(1, "FAIL: aio_fifo_test: mkstemp failed");
> if (unlink(pathname) == -1)
> err(1, "FAIL: aio_fifo_test: unlink failed");
434c427
< errx(-1, "FAIL: aio_fifo_test: mkfifo: %s", strerror(errno));
---
> errx(1, "FAIL: aio_fifo_test: mkfifo: %s", strerror(errno));
444c437
< errx(-1, "FAIL: aio_fifo_test: read_fd open: %s",
---
> errx(1, "FAIL: aio_fifo_test: read_fd open: %s",
454c447
< errx(-1, "FAIL: aio_fifo_test: write_fd open: %s",
---
> errx(1, "FAIL: aio_fifo_test: write_fd open: %s",
491a485,486
> aio_available();
>
493c488
< errx(-1, "FAIL: aio_socketpair_test: socketpair: %s",
---
> errx(1, "FAIL: aio_socketpair_test: socketpair: %s",
534a530,531
> aio_available();
>
536c533
< errx(-1, "FAIL: aio_pty_test: openpty: %s", strerror(errno));
---
> errx(1, "FAIL: aio_pty_test: openpty: %s", strerror(errno));
545c542
< errx(-1, "FAIL: aio_pty_test: tcgetattr: %s",
---
> errx(1, "FAIL: aio_pty_test: tcgetattr: %s",
553c550
< errx(-1, "FAIL: aio_pty_test: tcsetattr: %s",
---
> errx(1, "FAIL: aio_pty_test: tcsetattr: %s",
583a581,582
> aio_available();
>
585c584
< errx(-1, "FAIL: aio_pipe_test: pipe: %s", strerror(errno));
---
> errx(1, "FAIL: aio_pipe_test: pipe: %s", strerror(errno));
636c635
< int error, fd, i, mdctl_fd, unit;
---
> int error, fd, mdctl_fd, unit;
641a641,648
> aio_available();
>
> if (geteuid() != 0) {
> fprintf(stderr, "WARNING: aio_md_test: skipped as euid "
> "!= 0\n");
> return;
> }
>
644c651
< errx(-1, "FAIL: aio_md_test: open(/dev/%s): %s", MDCTL_NAME,
---
> errx(1, "FAIL: aio_md_test: open(/dev/%s): %s", MDCTL_NAME,
661c668
< errx(-1, "FAIL: aio_md_test: MDIOCATTACH: %s",
---
> errx(1, "FAIL: aio_md_test: MDIOCATTACH: %s",
672c679
< errx(-1, "FAIL: aio_md_test: open(%s): %s", pathname,
---
> errx(1, "FAIL: aio_md_test: open(%s): %s", pathname,
688c695
< main(int argc, char *argv[])
---
> main(void)
691d697
< aio_sigsys_setup();
697,701c703,705
< if (geteuid() == 0)
< aio_md_test();
< else
< fprintf(stderr, "WARNING: aio_md_test: skipped as euid "
< "!= 0\n");
---
> aio_md_test();
>
> return (0);