diff options
author | Bruno Haible <bruno@clisp.org> | 2011-09-19 01:02:09 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2011-09-19 01:02:09 +0200 |
commit | ceabceacb175fe3e37d05ba7cbe74aa502115adb (patch) | |
tree | 4d25234e2f4172fc17e9cb809594a48b9f996a8d | |
parent | 6c4582fe7d5fe1751d4e545c62ef7504869e7609 (diff) | |
download | gnulib-ceabceacb175fe3e37d05ba7cbe74aa502115adb.tar.gz |
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.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | modules/ptsname-tests | 1 | ||||
-rw-r--r-- | tests/test-ptsname.c | 8 |
3 files changed, 16 insertions, 0 deletions
@@ -1,5 +1,12 @@ 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. * modules/posix_spawn_file_actions_addclose (Dependencies): Add posix_spawn_file_actions_init. diff --git a/modules/ptsname-tests b/modules/ptsname-tests index 344b8a7038..e26bc9e5c2 100644 --- a/modules/ptsname-tests +++ b/modules/ptsname-tests @@ -7,6 +7,7 @@ Depends-on: same-inode configure.ac: +AC_CHECK_DECLS_ONCE([alarm]) Makefile.am: TESTS += test-ptsname diff --git a/tests/test-ptsname.c b/tests/test-ptsname.c index ccf2ab1b5e..921367cc1f 100644 --- 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 @@ same_slave (const char *slave_name1, const char *slave_name2) 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; |