summaryrefslogtreecommitdiff
path: root/test-skeleton.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-11 09:51:01 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-11 09:51:01 +0000
commitb9337b6a58501fcbae612a86d4219a8db2c5c1ff (patch)
treed458174e8585513835df7a2a11985532dec21b03 /test-skeleton.c
parente7993f207c226a07125718de0feef8ac652c6696 (diff)
Update.
1998-04-11 09:33 Ulrich Drepper <drepper@cygnus.com> * Makeconfig (rtobjdir): New variable. (rpath-link): Add rtobjdir and thread directory, if available. * test-skeleton.c: Add support to remove temporary files. Always define test_dir. Improve message about expected signal. * rt/Makefile (tests): Add tst-aio. Add rules for tst-aio to be linked with librt and thread library. * rt/aio_misc.c: Correct fundamental bugs. * rt/aio_suspend.c: Correct bug in test for available request. Initialize conditional variable. * rt/lio_listio.c: Initialize conditional variable. * rt/lio_listio64.c: Likewise. * rt/tst-aio.c: New file. * sysdeps/libm-ieee754/s_signgam.c: Undo last change. * sysdeps/libm-ieee754/w_gamma.c: Likewise. Adopt for ISO C 9x. * sysdeps/libm-ieee754/w_gammaf.c: Likewise. * sysdeps/libm-ieee754/w_gammal.c: Likewise. * sysdeps/libm-ieee754/w_lgamma.c: Likewise. * sysdeps/libm-ieee754/w_lgammaf.c: Likewise. * sysdeps/libm-ieee754/w_lgammal.c: Likewise. 1998-04-11 14:49 Mark Kettenis <kettenis@landau.phys.uva.nl> * posix/regex.c [_LIBC] (__re_syntax_options): Initialize to 0. * elf/dl-load.c (open_path): Use correct name for test whether directory in load path exists. * sysdeps/libm-ieee754/s_expm1.c: Remove variable one. * sysdeps/libm-ieee754/e_pow.c: Fix typo. Patches by Tom Rini <trini@kernel.crashing.org>. * wcsmbs/wcstof_l.c: Declare ____wcstoull_l_internal. * wcsmbs/wcstod_l.c: Likewise. * wcsmbs/wcstold_l.c: Likewise.
Diffstat (limited to 'test-skeleton.c')
-rw-r--r--test-skeleton.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/test-skeleton.c b/test-skeleton.c
index 5bb5c44c16..39c6073c73 100644
--- a/test-skeleton.c
+++ b/test-skeleton.c
@@ -18,6 +18,7 @@
Boston, MA 02111-1307, USA. */
#include <getopt.h>
+#include <search.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -52,6 +53,39 @@ static int pid;
/* Directory to place temporary files in. */
static const char *test_dir;
+/* List of temporary files. */
+struct name_list
+{
+ struct qelem q;
+ const char *name;
+} *name_list;
+
+/* Add temporary files in list. */
+void
+add_temp_file (const char *name)
+{
+ struct name_list *newp = (struct name_list *) calloc (sizeof (*newp), 1);
+ if (newp != NULL)
+ {
+ newp->name = name;
+ if (name_list == NULL)
+ name_list = (struct name_list *) &newp->q;
+ else
+ insque (newp, name_list);
+ }
+}
+
+/* Delete all temporary files. */
+void
+delete_temp_files (void)
+{
+ while (name_list != NULL)
+ {
+ remove (name_list->name);
+ name_list = (struct name_list *) name_list->q.q_forw;
+ }
+}
+
/* Timeout handler. We kill the child and exit with an error. */
void
timeout_handler (int sig __attribute__ ((unused)))
@@ -114,11 +148,20 @@ main (int argc, char *argv[])
exit (1);
}
}
+ else
+ {
+ test_dir = getenv ("TMPDIR");
+ if (test_dir == NULL || test_dir[0] == '\0')
+ test_dir = "/tmp";
+ }
/* If we are not expected to fork run the function immediately. */
if (direct)
return TEST_FUNCTION;
+ /* make sure temporary files are deleted. */
+ atexit (delete_temp_files);
+
/* Set up the test environment:
- prevent core dumps
- set up the timer
@@ -166,8 +209,12 @@ main (int argc, char *argv[])
#endif
if (WTERMSIG (status) != EXPECTED_SIGNAL)
{
- fprintf (stderr, "Incorrect signal from child: got `%s', need `%s'\n",
- strsignal (WTERMSIG (status)), strsignal (EXPECTED_SIGNAL));
+ if (EXPECTED_SIGNAL != 0)
+ fprintf (stderr, "Incorrect signal from child: got `%s', need `%s'\n",
+ strsignal (WTERMSIG (status)), strsignal (EXPECTED_SIGNAL));
+ else
+ fprintf (stderr, "Incorrect signal from child: got `%s'\n",
+ strsignal (WTERMSIG (status)));
exit (1);
}