Mercurial > hg > octave-shane > gnulib-hg
changeset 15652:66bab2a591f5
ptsname tests: Let the test fail rather than hang (e.g. on AIX 5.1).
* tests/test-ptsname.c (main): Terminate the test if it takes longer
than 5 seconds.
* modules/ptsname-tests (configure.ac): Test for alarm.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 19 Sep 2011 01:02:09 +0200 |
parents | 1f810b97845d |
children | f60ae63f5f6c |
files | ChangeLog modules/ptsname-tests tests/test-ptsname.c |
diffstat | 3 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-09-18 Bruno Haible <bruno@clisp.org> + + ptsname tests: Let the test fail rather than hang (e.g. on AIX 5.1). + * tests/test-ptsname.c (main): Terminate the test if it takes longer + than 5 seconds. + * modules/ptsname-tests (configure.ac): Test for alarm. + 2011-09-18 Bruno Haible <bruno@clisp.org> posix_spawn_file_actions_add*: Fix module dependencies.
--- a/modules/ptsname-tests +++ b/modules/ptsname-tests @@ -7,6 +7,7 @@ same-inode configure.ac: +AC_CHECK_DECLS_ONCE([alarm]) Makefile.am: TESTS += test-ptsname
--- a/tests/test-ptsname.c +++ b/tests/test-ptsname.c @@ -22,6 +22,7 @@ SIGNATURE_CHECK (ptsname, char *, (int)); #include <fcntl.h> +#include <signal.h> #include <stdio.h> #include <string.h> #include <unistd.h> @@ -54,6 +55,13 @@ int main (void) { +#if HAVE_DECL_ALARM + /* Declare failure if test takes too long, by using default abort + caused by SIGALRM. */ + signal (SIGALRM, SIG_DFL); + alarm (5); +#endif + { int fd; char *result;