1998-03-18 13:22:11 +01:00
|
|
|
/* Skeleton for test programs.
|
2015-01-02 17:28:19 +01:00
|
|
|
Copyright (C) 1998-2015 Free Software Foundation, Inc.
|
2001-07-06 06:58:11 +02:00
|
|
|
This file is part of the GNU C Library.
|
1998-03-18 13:22:11 +01:00
|
|
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 06:58:11 +02:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1998-03-18 13:22:11 +01:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 06:58:11 +02:00
|
|
|
Lesser General Public License for more details.
|
1998-03-18 13:22:11 +01:00
|
|
|
|
2001-07-06 06:58:11 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-10 00:18:22 +01:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1998-03-18 13:22:11 +01:00
|
|
|
|
2014-06-30 21:05:34 +02:00
|
|
|
#include <assert.h>
|
2003-06-07 11:40:26 +02:00
|
|
|
#include <errno.h>
|
2013-12-30 00:13:20 +01:00
|
|
|
#include <fcntl.h>
|
1998-03-18 13:22:11 +01:00
|
|
|
#include <getopt.h>
|
2005-03-08 01:50:21 +01:00
|
|
|
#include <malloc.h>
|
2013-12-30 00:13:20 +01:00
|
|
|
#include <paths.h>
|
1998-04-11 11:51:01 +02:00
|
|
|
#include <search.h>
|
1998-03-18 13:22:11 +01:00
|
|
|
#include <signal.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2000-04-01 23:49:24 +02:00
|
|
|
#include <string.h>
|
1998-03-18 13:22:11 +01:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/resource.h>
|
|
|
|
#include <sys/wait.h>
|
2002-12-13 22:32:16 +01:00
|
|
|
#include <sys/param.h>
|
2003-06-25 13:04:58 +02:00
|
|
|
#include <time.h>
|
1998-03-18 13:22:11 +01:00
|
|
|
|
|
|
|
/* The test function is normally called `do_test' and it is called
|
|
|
|
with argc and argv as the arguments. We nevertheless provide the
|
|
|
|
possibility to overwrite this name. */
|
|
|
|
#ifndef TEST_FUNCTION
|
|
|
|
# define TEST_FUNCTION do_test (argc, argv)
|
|
|
|
#endif
|
|
|
|
|
2002-12-13 22:32:16 +01:00
|
|
|
#ifndef TEST_DATA_LIMIT
|
|
|
|
# define TEST_DATA_LIMIT (64 << 20) /* Data limit (bytes) to run with. */
|
|
|
|
#endif
|
1998-03-18 13:22:11 +01:00
|
|
|
|
|
|
|
#define OPT_DIRECT 1000
|
|
|
|
#define OPT_TESTDIR 1001
|
|
|
|
|
|
|
|
static struct option options[] =
|
|
|
|
{
|
|
|
|
#ifdef CMDLINE_OPTIONS
|
|
|
|
CMDLINE_OPTIONS
|
|
|
|
#endif
|
|
|
|
{ "direct", no_argument, NULL, OPT_DIRECT },
|
|
|
|
{ "test-dir", required_argument, NULL, OPT_TESTDIR },
|
|
|
|
{ NULL, 0, NULL, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
/* PID of the test itself. */
|
2002-09-15 06:25:03 +02:00
|
|
|
static pid_t pid;
|
1998-03-18 13:22:11 +01:00
|
|
|
|
|
|
|
/* Directory to place temporary files in. */
|
|
|
|
static const char *test_dir;
|
|
|
|
|
1998-04-11 11:51:01 +02:00
|
|
|
/* List of temporary files. */
|
2000-12-18 17:40:40 +01:00
|
|
|
struct temp_name_list
|
1998-04-11 11:51:01 +02:00
|
|
|
{
|
|
|
|
struct qelem q;
|
|
|
|
const char *name;
|
2000-12-18 17:40:40 +01:00
|
|
|
} *temp_name_list;
|
1998-04-11 11:51:01 +02:00
|
|
|
|
|
|
|
/* Add temporary files in list. */
|
2000-11-25 00:39:37 +01:00
|
|
|
static void
|
2001-08-23 06:17:06 +02:00
|
|
|
__attribute__ ((unused))
|
1998-04-11 11:51:01 +02:00
|
|
|
add_temp_file (const char *name)
|
|
|
|
{
|
2000-12-18 17:40:40 +01:00
|
|
|
struct temp_name_list *newp
|
|
|
|
= (struct temp_name_list *) calloc (sizeof (*newp), 1);
|
1998-04-11 11:51:01 +02:00
|
|
|
if (newp != NULL)
|
|
|
|
{
|
|
|
|
newp->name = name;
|
2000-12-18 17:40:40 +01:00
|
|
|
if (temp_name_list == NULL)
|
|
|
|
temp_name_list = (struct temp_name_list *) &newp->q;
|
1998-04-11 11:51:01 +02:00
|
|
|
else
|
2000-12-18 17:40:40 +01:00
|
|
|
insque (newp, temp_name_list);
|
1998-04-11 11:51:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete all temporary files. */
|
2000-11-25 00:39:37 +01:00
|
|
|
static void
|
1998-04-11 11:51:01 +02:00
|
|
|
delete_temp_files (void)
|
|
|
|
{
|
2000-12-18 17:40:40 +01:00
|
|
|
while (temp_name_list != NULL)
|
1998-04-11 11:51:01 +02:00
|
|
|
{
|
2000-12-18 17:40:40 +01:00
|
|
|
remove (temp_name_list->name);
|
|
|
|
temp_name_list = (struct temp_name_list *) temp_name_list->q.q_forw;
|
1998-04-11 11:51:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-23 00:18:27 +02:00
|
|
|
/* Create a temporary file. */
|
|
|
|
static int
|
|
|
|
__attribute__ ((unused))
|
|
|
|
create_temp_file (const char *base, char **filename)
|
|
|
|
{
|
|
|
|
char *fname;
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
fname = (char *) malloc (strlen (test_dir) + 1 + strlen (base)
|
|
|
|
+ sizeof ("XXXXXX"));
|
|
|
|
if (fname == NULL)
|
|
|
|
{
|
|
|
|
puts ("out of memory");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
strcpy (stpcpy (stpcpy (stpcpy (fname, test_dir), "/"), base), "XXXXXX");
|
|
|
|
|
|
|
|
fd = mkstemp (fname);
|
|
|
|
if (fd == -1)
|
|
|
|
{
|
|
|
|
printf ("cannot open temporary file '%s': %m\n", fname);
|
|
|
|
free (fname);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
add_temp_file (fname);
|
|
|
|
if (filename != NULL)
|
|
|
|
*filename = fname;
|
|
|
|
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
|
1998-03-18 13:22:11 +01:00
|
|
|
/* Timeout handler. We kill the child and exit with an error. */
|
2000-11-25 00:39:37 +01:00
|
|
|
static void
|
2000-11-28 08:10:56 +01:00
|
|
|
__attribute__ ((noreturn))
|
2009-08-14 09:42:51 +02:00
|
|
|
signal_handler (int sig __attribute__ ((unused)))
|
1998-03-18 13:22:11 +01:00
|
|
|
{
|
|
|
|
int killed;
|
2002-09-30 02:22:13 +02:00
|
|
|
int status;
|
1998-03-18 13:22:11 +01:00
|
|
|
|
2014-06-30 21:05:34 +02:00
|
|
|
assert (pid > 1);
|
|
|
|
/* Kill the whole process group. */
|
|
|
|
kill (-pid, SIGKILL);
|
|
|
|
/* In case setpgid failed in the child, kill it individually too. */
|
1998-03-18 13:22:11 +01:00
|
|
|
kill (pid, SIGKILL);
|
|
|
|
|
|
|
|
/* Wait for it to terminate. */
|
2003-06-25 09:46:45 +02:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < 5; ++i)
|
|
|
|
{
|
|
|
|
killed = waitpid (pid, &status, WNOHANG|WUNTRACED);
|
|
|
|
if (killed != 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Delay, give the system time to process the kill. If the
|
|
|
|
nanosleep() call return prematurely, all the better. We
|
|
|
|
won't restart it since this probably means the child process
|
|
|
|
finally died. */
|
2005-12-23 02:03:28 +01:00
|
|
|
struct timespec ts;
|
|
|
|
ts.tv_sec = 0;
|
|
|
|
ts.tv_nsec = 100000000;
|
2003-06-25 09:46:45 +02:00
|
|
|
nanosleep (&ts, NULL);
|
|
|
|
}
|
1998-03-18 13:22:11 +01:00
|
|
|
if (killed != 0 && killed != pid)
|
|
|
|
{
|
2014-04-11 16:21:23 +02:00
|
|
|
printf ("Failed to kill test process: %m\n");
|
1998-03-18 13:22:11 +01:00
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CLEANUP_HANDLER
|
|
|
|
CLEANUP_HANDLER;
|
|
|
|
#endif
|
|
|
|
|
2009-08-14 09:42:51 +02:00
|
|
|
if (sig == SIGINT)
|
|
|
|
{
|
|
|
|
signal (sig, SIG_DFL);
|
|
|
|
raise (sig);
|
|
|
|
}
|
|
|
|
|
2002-12-07 06:39:20 +01:00
|
|
|
/* If we expected this signal: good! */
|
|
|
|
#ifdef EXPECTED_SIGNAL
|
|
|
|
if (EXPECTED_SIGNAL == SIGALRM)
|
|
|
|
exit (0);
|
|
|
|
#endif
|
|
|
|
|
2003-06-25 09:46:45 +02:00
|
|
|
if (killed == 0 || (WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL))
|
2014-04-11 16:21:23 +02:00
|
|
|
puts ("Timed out: killed the child process");
|
2002-09-30 02:22:13 +02:00
|
|
|
else if (WIFSTOPPED (status))
|
2014-04-11 16:21:23 +02:00
|
|
|
printf ("Timed out: the child process was %s\n",
|
|
|
|
strsignal (WSTOPSIG (status)));
|
2002-09-30 02:22:13 +02:00
|
|
|
else if (WIFSIGNALED (status))
|
2014-04-11 16:21:23 +02:00
|
|
|
printf ("Timed out: the child process got signal %s\n",
|
|
|
|
strsignal (WTERMSIG (status)));
|
2002-09-30 02:22:13 +02:00
|
|
|
else
|
2014-04-11 16:21:23 +02:00
|
|
|
printf ("Timed out: killed the child process but it exited %d\n",
|
|
|
|
WEXITSTATUS (status));
|
1998-03-18 13:22:11 +01:00
|
|
|
|
|
|
|
/* Exit with an error. */
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
2013-12-30 00:13:20 +01:00
|
|
|
/* Set fortification error handler. Used when tests want to verify that bad
|
|
|
|
code is caught by the library. */
|
|
|
|
static void
|
|
|
|
__attribute__ ((unused))
|
|
|
|
set_fortify_handler (void (*handler) (int sig))
|
|
|
|
{
|
|
|
|
struct sigaction sa;
|
|
|
|
|
|
|
|
sa.sa_handler = handler;
|
|
|
|
sa.sa_flags = 0;
|
|
|
|
sigemptyset (&sa.sa_mask);
|
|
|
|
|
|
|
|
sigaction (SIGABRT, &sa, NULL);
|
|
|
|
|
|
|
|
/* Avoid all the buffer overflow messages on stderr. */
|
|
|
|
int fd = open (_PATH_DEVNULL, O_WRONLY);
|
|
|
|
if (fd == -1)
|
|
|
|
close (STDERR_FILENO);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dup2 (fd, STDERR_FILENO);
|
|
|
|
close (fd);
|
|
|
|
}
|
|
|
|
setenv ("LIBC_FATAL_STDERR_", "1", 1);
|
|
|
|
}
|
|
|
|
|
1998-03-18 13:22:11 +01:00
|
|
|
/* We provide the entry point here. */
|
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int direct = 0; /* Directly call the test function? */
|
|
|
|
int status;
|
|
|
|
int opt;
|
2004-02-19 01:55:28 +01:00
|
|
|
unsigned int timeoutfactor = 1;
|
2002-09-15 06:25:03 +02:00
|
|
|
pid_t termpid;
|
1998-03-18 13:22:11 +01:00
|
|
|
|
2005-03-08 01:50:21 +01:00
|
|
|
/* Make uses of freed and uninitialized memory known. */
|
|
|
|
mallopt (M_PERTURB, 42);
|
|
|
|
|
2000-04-11 18:27:38 +02:00
|
|
|
#ifdef STDOUT_UNBUFFERED
|
|
|
|
setbuf (stdout, NULL);
|
|
|
|
#endif
|
|
|
|
|
2003-06-01 20:07:34 +02:00
|
|
|
while ((opt = getopt_long (argc, argv, "+", options, NULL)) != -1)
|
1998-03-18 13:22:11 +01:00
|
|
|
switch (opt)
|
|
|
|
{
|
|
|
|
case '?':
|
|
|
|
exit (1);
|
|
|
|
case OPT_DIRECT:
|
|
|
|
direct = 1;
|
|
|
|
break;
|
|
|
|
case OPT_TESTDIR:
|
|
|
|
test_dir = optarg;
|
|
|
|
break;
|
|
|
|
#ifdef CMDLINE_PROCESS
|
|
|
|
CMDLINE_PROCESS
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-02-19 01:55:28 +01:00
|
|
|
/* If set, read the test TIMEOUTFACTOR value from the environment.
|
|
|
|
This value is used to scale the default test timeout values. */
|
|
|
|
char *envstr_timeoutfactor = getenv ("TIMEOUTFACTOR");
|
|
|
|
if (envstr_timeoutfactor != NULL)
|
|
|
|
{
|
|
|
|
char *envstr_conv = envstr_timeoutfactor;
|
|
|
|
unsigned long int env_fact;
|
|
|
|
|
|
|
|
env_fact = strtoul (envstr_timeoutfactor, &envstr_conv, 0);
|
|
|
|
if (*envstr_conv == '\0' && envstr_conv != envstr_timeoutfactor)
|
|
|
|
timeoutfactor = MAX (env_fact, 1);
|
|
|
|
}
|
|
|
|
|
1998-03-18 13:22:11 +01:00
|
|
|
/* Set TMPDIR to specified test directory. */
|
|
|
|
if (test_dir != NULL)
|
|
|
|
{
|
|
|
|
setenv ("TMPDIR", test_dir, 1);
|
|
|
|
|
|
|
|
if (chdir (test_dir) < 0)
|
|
|
|
{
|
2014-04-11 16:21:23 +02:00
|
|
|
printf ("chdir: %m\n");
|
1998-03-18 13:22:11 +01:00
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
}
|
1998-04-11 11:51:01 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
test_dir = getenv ("TMPDIR");
|
|
|
|
if (test_dir == NULL || test_dir[0] == '\0')
|
|
|
|
test_dir = "/tmp";
|
|
|
|
}
|
1998-03-18 13:22:11 +01:00
|
|
|
|
1998-04-11 22:19:13 +02:00
|
|
|
/* Make sure we see all message, even those on stdout. */
|
|
|
|
setvbuf (stdout, NULL, _IONBF, 0);
|
|
|
|
|
1998-04-14 18:51:08 +02:00
|
|
|
/* make sure temporary files are deleted. */
|
|
|
|
atexit (delete_temp_files);
|
|
|
|
|
2000-10-26 10:11:19 +02:00
|
|
|
/* Correct for the possible parameters. */
|
2002-12-19 18:11:28 +01:00
|
|
|
argv[optind - 1] = argv[0];
|
2000-10-26 10:11:19 +02:00
|
|
|
argv += optind - 1;
|
|
|
|
argc -= optind - 1;
|
|
|
|
|
1998-04-14 18:51:08 +02:00
|
|
|
/* Call the initializing function, if one is available. */
|
|
|
|
#ifdef PREPARE
|
|
|
|
PREPARE (argc, argv);
|
|
|
|
#endif
|
|
|
|
|
1998-03-18 13:22:11 +01:00
|
|
|
/* If we are not expected to fork run the function immediately. */
|
|
|
|
if (direct)
|
|
|
|
return TEST_FUNCTION;
|
|
|
|
|
|
|
|
/* Set up the test environment:
|
|
|
|
- prevent core dumps
|
|
|
|
- set up the timer
|
|
|
|
- fork and execute the function. */
|
|
|
|
|
|
|
|
pid = fork ();
|
|
|
|
if (pid == 0)
|
|
|
|
{
|
|
|
|
/* This is the child. */
|
|
|
|
#ifdef RLIMIT_CORE
|
|
|
|
/* Try to avoid dumping core. */
|
|
|
|
struct rlimit core_limit;
|
|
|
|
core_limit.rlim_cur = 0;
|
|
|
|
core_limit.rlim_max = 0;
|
|
|
|
setrlimit (RLIMIT_CORE, &core_limit);
|
|
|
|
#endif
|
|
|
|
|
2002-12-13 22:32:16 +01:00
|
|
|
#ifdef RLIMIT_DATA
|
|
|
|
/* Try to avoid eating all memory if a test leaks. */
|
|
|
|
struct rlimit data_limit;
|
|
|
|
if (getrlimit (RLIMIT_DATA, &data_limit) == 0)
|
|
|
|
{
|
|
|
|
if (TEST_DATA_LIMIT == RLIM_INFINITY)
|
|
|
|
data_limit.rlim_cur = data_limit.rlim_max;
|
|
|
|
else if (data_limit.rlim_cur > (rlim_t) TEST_DATA_LIMIT)
|
|
|
|
data_limit.rlim_cur = MIN ((rlim_t) TEST_DATA_LIMIT,
|
|
|
|
data_limit.rlim_max);
|
|
|
|
if (setrlimit (RLIMIT_DATA, &data_limit) < 0)
|
2014-04-11 16:21:23 +02:00
|
|
|
printf ("setrlimit: RLIMIT_DATA: %m\n");
|
2002-12-13 22:32:16 +01:00
|
|
|
}
|
|
|
|
else
|
2014-04-11 16:21:23 +02:00
|
|
|
printf ("getrlimit: RLIMIT_DATA: %m\n");
|
2002-12-13 22:32:16 +01:00
|
|
|
#endif
|
|
|
|
|
2002-09-30 02:22:13 +02:00
|
|
|
/* We put the test process in its own pgrp so that if it bogusly
|
|
|
|
generates any job control signals, they won't hit the whole build. */
|
2014-06-30 21:05:34 +02:00
|
|
|
if (setpgid (0, 0) != 0)
|
|
|
|
printf ("Failed to set the process group ID: %m\n");
|
2002-09-30 02:22:13 +02:00
|
|
|
|
1998-03-18 13:22:11 +01:00
|
|
|
/* Execute the test function and exit with the return value. */
|
|
|
|
exit (TEST_FUNCTION);
|
|
|
|
}
|
|
|
|
else if (pid < 0)
|
|
|
|
{
|
2014-04-11 16:21:23 +02:00
|
|
|
printf ("Cannot fork test program: %m\n");
|
1998-03-18 13:22:11 +01:00
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set timeout. */
|
|
|
|
#ifndef TIMEOUT
|
|
|
|
/* Default timeout is two seconds. */
|
|
|
|
# define TIMEOUT 2
|
|
|
|
#endif
|
2009-08-14 09:42:51 +02:00
|
|
|
signal (SIGALRM, signal_handler);
|
2004-02-19 01:55:28 +01:00
|
|
|
alarm (TIMEOUT * timeoutfactor);
|
1998-03-18 13:22:11 +01:00
|
|
|
|
2009-08-14 09:42:51 +02:00
|
|
|
/* Make sure we clean up if the wrapper gets interrupted. */
|
|
|
|
signal (SIGINT, signal_handler);
|
|
|
|
|
1998-03-18 13:22:11 +01:00
|
|
|
/* Wait for the regular termination. */
|
2003-06-07 02:40:13 +02:00
|
|
|
termpid = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));
|
2002-09-15 06:25:03 +02:00
|
|
|
if (termpid == -1)
|
1998-03-18 13:22:11 +01:00
|
|
|
{
|
2002-09-15 06:25:03 +02:00
|
|
|
printf ("Waiting for test program failed: %m\n");
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
if (termpid != pid)
|
|
|
|
{
|
|
|
|
printf ("Oops, wrong test program terminated: expected %ld, got %ld\n",
|
|
|
|
(long int) pid, (long int) termpid);
|
1998-03-18 13:22:11 +01:00
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
2014-11-12 12:40:21 +01:00
|
|
|
/* Process terminated normaly without timeout etc. */
|
|
|
|
if (WIFEXITED (status))
|
1998-03-18 13:22:11 +01:00
|
|
|
{
|
2003-06-08 01:24:07 +02:00
|
|
|
#ifndef EXPECTED_STATUS
|
2014-11-12 12:40:21 +01:00
|
|
|
# ifndef EXPECTED_SIGNAL
|
|
|
|
/* Simply exit with the return value of the test. */
|
|
|
|
return WEXITSTATUS (status);
|
|
|
|
# else
|
|
|
|
printf ("Expected signal '%s' from child, got none\n",
|
|
|
|
strsignal (EXPECTED_SIGNAL));
|
|
|
|
exit (1);
|
|
|
|
# endif
|
2003-06-08 01:24:07 +02:00
|
|
|
#else
|
2014-11-12 12:40:21 +01:00
|
|
|
if (WEXITSTATUS (status) != EXPECTED_STATUS)
|
|
|
|
{
|
|
|
|
printf ("Expected status %d, got %d\n",
|
|
|
|
EXPECTED_STATUS, WEXITSTATUS (status));
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
/* Process was killed by timer or other signal. */
|
|
|
|
else
|
2003-06-08 01:24:07 +02:00
|
|
|
{
|
2014-11-12 12:40:21 +01:00
|
|
|
#ifndef EXPECTED_SIGNAL
|
|
|
|
printf ("Didn't expect signal from child: got `%s'\n",
|
|
|
|
strsignal (WTERMSIG (status)));
|
2003-06-08 01:24:07 +02:00
|
|
|
exit (1);
|
2014-11-12 12:40:21 +01:00
|
|
|
#else
|
|
|
|
if (WTERMSIG (status) != EXPECTED_SIGNAL)
|
|
|
|
{
|
|
|
|
printf ("Incorrect signal from child: got `%s', need `%s'\n",
|
|
|
|
strsignal (WTERMSIG (status)),
|
|
|
|
strsignal (EXPECTED_SIGNAL));
|
|
|
|
exit (1);
|
|
|
|
}
|
2003-06-08 01:24:07 +02:00
|
|
|
|
2014-11-12 12:40:21 +01:00
|
|
|
return 0;
|
2003-06-08 01:24:07 +02:00
|
|
|
#endif
|
2014-11-12 12:40:21 +01:00
|
|
|
}
|
1998-03-18 13:22:11 +01:00
|
|
|
}
|