glibc/test-skeleton.c

243 lines
5.7 KiB
C
Raw Normal View History

/* Skeleton for test programs.
Copyright (C) 1998, 2000 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <getopt.h>
#include <search.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/resource.h>
#include <sys/wait.h>
/* 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
#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. */
static int pid;
/* Directory to place temporary files in. */
static const char *test_dir;
/* List of temporary files. */
Update. 2000-12-18 Andreas Jaeger <aj@suse.de> * test-skeleton.c: Use temp_name_list instead of temp_name_list to avoid collision with name_list from inet/netgroup.h. * nss/nss_files/files-network.c (NEED_H_ERRNO): Define. * include/grp.h (DECLARE_NSS_PROTOTYPES): New. * include/pwd.h (DECLARE_NSS_PROTOTYPES): New. * include/netdb.h (DECLARE_NSS_PROTOTYPES): New. * include/shadow.h (DECLARE_NSS_PROTOTYPES): New. * hesiod/nss_hesiod/hesiod-proto.c (_nss_hesiod_setprotoent): Fix declaration to match prototype. * hesiod/nss_hesiod/hesiod-pwd.c (_nss_hesiod_setpwent): Likewise. * hesiod/nss_hesiod/hesiod-grp.c (_nss_hesiod_setgrent): Likewise. * hesiod/nss_hesiod/hesiod-service.c (_nss_hesiod_setservent): Likewise. * nis/nss_nis/nis-grp.c (_nss_nis_setgrent): Likewise. * nis/nss_nis/nis-pwd.c (_nss_nis_setpwent): Likewise. * nis/nss_nis/nis-proto.c (_nss_nis_setprotoent): Likewise. * nis/nss_nis/nis-service.c (_nss_nis_setservent): Likewise. (_nss_nis_getservbyport_r): Likewise. * nis/nss_nis/nis-hosts.c (_nss_nis_sethostent): Likewise. * nis/nss_nis/nis-spwd.c (_nss_nis_setspent): Likewise. * nis/nss_nis/nis-network.c (_nss_nis_getnetent_r): Likewise. (_nss_nis_setnetent): Likewise * nis/nss_nis/nis-netgrp.c (_nss_nis_setnetgrent): Likewise. (_nss_nis_endnetgrent): Likewise. * nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_endnetgrent): Likewise. (_nss_nisplus_setnetgrent): Likewise. * nis/nss_nisplus/nisplus-spwd.c (_nss_nisplus_setspent): Likewise. * nis/nss_nisplus/nisplus-pwd.c (_nss_nisplus_setpwent): Likewise. * nis/nss_nisplus/nisplus-grp.c (_nss_nisplus_setgrent): Likewise. * nis/nss_nisplus/nisplus-network.c (_nss_nisplus_setnetent): Likewise. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_sethostent): Likewise. * nis/nss_nisplus/nisplus-service.c (_nss_nisplus_setservent): Likewise. * nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_setprotoent): Likewise. * nis/nss_compat/compat-spwd.c (_nss_compat_setspent): Likewise. * nis/nss_compat/compat-pwd.c (_nss_compat_setpwent): Likewise. * nis/nss_compat/compat-grp.c (_nss_compat_setgrent): Likewise. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr_r): Likewise. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r): Likewise. (_nss_dns_getnetbyaddr_r): Likewise.
2000-12-18 17:40:40 +01:00
struct temp_name_list
{
struct qelem q;
const char *name;
Update. 2000-12-18 Andreas Jaeger <aj@suse.de> * test-skeleton.c: Use temp_name_list instead of temp_name_list to avoid collision with name_list from inet/netgroup.h. * nss/nss_files/files-network.c (NEED_H_ERRNO): Define. * include/grp.h (DECLARE_NSS_PROTOTYPES): New. * include/pwd.h (DECLARE_NSS_PROTOTYPES): New. * include/netdb.h (DECLARE_NSS_PROTOTYPES): New. * include/shadow.h (DECLARE_NSS_PROTOTYPES): New. * hesiod/nss_hesiod/hesiod-proto.c (_nss_hesiod_setprotoent): Fix declaration to match prototype. * hesiod/nss_hesiod/hesiod-pwd.c (_nss_hesiod_setpwent): Likewise. * hesiod/nss_hesiod/hesiod-grp.c (_nss_hesiod_setgrent): Likewise. * hesiod/nss_hesiod/hesiod-service.c (_nss_hesiod_setservent): Likewise. * nis/nss_nis/nis-grp.c (_nss_nis_setgrent): Likewise. * nis/nss_nis/nis-pwd.c (_nss_nis_setpwent): Likewise. * nis/nss_nis/nis-proto.c (_nss_nis_setprotoent): Likewise. * nis/nss_nis/nis-service.c (_nss_nis_setservent): Likewise. (_nss_nis_getservbyport_r): Likewise. * nis/nss_nis/nis-hosts.c (_nss_nis_sethostent): Likewise. * nis/nss_nis/nis-spwd.c (_nss_nis_setspent): Likewise. * nis/nss_nis/nis-network.c (_nss_nis_getnetent_r): Likewise. (_nss_nis_setnetent): Likewise * nis/nss_nis/nis-netgrp.c (_nss_nis_setnetgrent): Likewise. (_nss_nis_endnetgrent): Likewise. * nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_endnetgrent): Likewise. (_nss_nisplus_setnetgrent): Likewise. * nis/nss_nisplus/nisplus-spwd.c (_nss_nisplus_setspent): Likewise. * nis/nss_nisplus/nisplus-pwd.c (_nss_nisplus_setpwent): Likewise. * nis/nss_nisplus/nisplus-grp.c (_nss_nisplus_setgrent): Likewise. * nis/nss_nisplus/nisplus-network.c (_nss_nisplus_setnetent): Likewise. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_sethostent): Likewise. * nis/nss_nisplus/nisplus-service.c (_nss_nisplus_setservent): Likewise. * nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_setprotoent): Likewise. * nis/nss_compat/compat-spwd.c (_nss_compat_setspent): Likewise. * nis/nss_compat/compat-pwd.c (_nss_compat_setpwent): Likewise. * nis/nss_compat/compat-grp.c (_nss_compat_setgrent): Likewise. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr_r): Likewise. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r): Likewise. (_nss_dns_getnetbyaddr_r): Likewise.
2000-12-18 17:40:40 +01:00
} *temp_name_list;
/* Add temporary files in list. */
static void
add_temp_file (const char *name)
{
Update. 2000-12-18 Andreas Jaeger <aj@suse.de> * test-skeleton.c: Use temp_name_list instead of temp_name_list to avoid collision with name_list from inet/netgroup.h. * nss/nss_files/files-network.c (NEED_H_ERRNO): Define. * include/grp.h (DECLARE_NSS_PROTOTYPES): New. * include/pwd.h (DECLARE_NSS_PROTOTYPES): New. * include/netdb.h (DECLARE_NSS_PROTOTYPES): New. * include/shadow.h (DECLARE_NSS_PROTOTYPES): New. * hesiod/nss_hesiod/hesiod-proto.c (_nss_hesiod_setprotoent): Fix declaration to match prototype. * hesiod/nss_hesiod/hesiod-pwd.c (_nss_hesiod_setpwent): Likewise. * hesiod/nss_hesiod/hesiod-grp.c (_nss_hesiod_setgrent): Likewise. * hesiod/nss_hesiod/hesiod-service.c (_nss_hesiod_setservent): Likewise. * nis/nss_nis/nis-grp.c (_nss_nis_setgrent): Likewise. * nis/nss_nis/nis-pwd.c (_nss_nis_setpwent): Likewise. * nis/nss_nis/nis-proto.c (_nss_nis_setprotoent): Likewise. * nis/nss_nis/nis-service.c (_nss_nis_setservent): Likewise. (_nss_nis_getservbyport_r): Likewise. * nis/nss_nis/nis-hosts.c (_nss_nis_sethostent): Likewise. * nis/nss_nis/nis-spwd.c (_nss_nis_setspent): Likewise. * nis/nss_nis/nis-network.c (_nss_nis_getnetent_r): Likewise. (_nss_nis_setnetent): Likewise * nis/nss_nis/nis-netgrp.c (_nss_nis_setnetgrent): Likewise. (_nss_nis_endnetgrent): Likewise. * nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_endnetgrent): Likewise. (_nss_nisplus_setnetgrent): Likewise. * nis/nss_nisplus/nisplus-spwd.c (_nss_nisplus_setspent): Likewise. * nis/nss_nisplus/nisplus-pwd.c (_nss_nisplus_setpwent): Likewise. * nis/nss_nisplus/nisplus-grp.c (_nss_nisplus_setgrent): Likewise. * nis/nss_nisplus/nisplus-network.c (_nss_nisplus_setnetent): Likewise. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_sethostent): Likewise. * nis/nss_nisplus/nisplus-service.c (_nss_nisplus_setservent): Likewise. * nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_setprotoent): Likewise. * nis/nss_compat/compat-spwd.c (_nss_compat_setspent): Likewise. * nis/nss_compat/compat-pwd.c (_nss_compat_setpwent): Likewise. * nis/nss_compat/compat-grp.c (_nss_compat_setgrent): Likewise. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr_r): Likewise. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r): Likewise. (_nss_dns_getnetbyaddr_r): Likewise.
2000-12-18 17:40:40 +01:00
struct temp_name_list *newp
= (struct temp_name_list *) calloc (sizeof (*newp), 1);
if (newp != NULL)
{
newp->name = name;
Update. 2000-12-18 Andreas Jaeger <aj@suse.de> * test-skeleton.c: Use temp_name_list instead of temp_name_list to avoid collision with name_list from inet/netgroup.h. * nss/nss_files/files-network.c (NEED_H_ERRNO): Define. * include/grp.h (DECLARE_NSS_PROTOTYPES): New. * include/pwd.h (DECLARE_NSS_PROTOTYPES): New. * include/netdb.h (DECLARE_NSS_PROTOTYPES): New. * include/shadow.h (DECLARE_NSS_PROTOTYPES): New. * hesiod/nss_hesiod/hesiod-proto.c (_nss_hesiod_setprotoent): Fix declaration to match prototype. * hesiod/nss_hesiod/hesiod-pwd.c (_nss_hesiod_setpwent): Likewise. * hesiod/nss_hesiod/hesiod-grp.c (_nss_hesiod_setgrent): Likewise. * hesiod/nss_hesiod/hesiod-service.c (_nss_hesiod_setservent): Likewise. * nis/nss_nis/nis-grp.c (_nss_nis_setgrent): Likewise. * nis/nss_nis/nis-pwd.c (_nss_nis_setpwent): Likewise. * nis/nss_nis/nis-proto.c (_nss_nis_setprotoent): Likewise. * nis/nss_nis/nis-service.c (_nss_nis_setservent): Likewise. (_nss_nis_getservbyport_r): Likewise. * nis/nss_nis/nis-hosts.c (_nss_nis_sethostent): Likewise. * nis/nss_nis/nis-spwd.c (_nss_nis_setspent): Likewise. * nis/nss_nis/nis-network.c (_nss_nis_getnetent_r): Likewise. (_nss_nis_setnetent): Likewise * nis/nss_nis/nis-netgrp.c (_nss_nis_setnetgrent): Likewise. (_nss_nis_endnetgrent): Likewise. * nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_endnetgrent): Likewise. (_nss_nisplus_setnetgrent): Likewise. * nis/nss_nisplus/nisplus-spwd.c (_nss_nisplus_setspent): Likewise. * nis/nss_nisplus/nisplus-pwd.c (_nss_nisplus_setpwent): Likewise. * nis/nss_nisplus/nisplus-grp.c (_nss_nisplus_setgrent): Likewise. * nis/nss_nisplus/nisplus-network.c (_nss_nisplus_setnetent): Likewise. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_sethostent): Likewise. * nis/nss_nisplus/nisplus-service.c (_nss_nisplus_setservent): Likewise. * nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_setprotoent): Likewise. * nis/nss_compat/compat-spwd.c (_nss_compat_setspent): Likewise. * nis/nss_compat/compat-pwd.c (_nss_compat_setpwent): Likewise. * nis/nss_compat/compat-grp.c (_nss_compat_setgrent): Likewise. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr_r): Likewise. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r): Likewise. (_nss_dns_getnetbyaddr_r): Likewise.
2000-12-18 17:40:40 +01:00
if (temp_name_list == NULL)
temp_name_list = (struct temp_name_list *) &newp->q;
else
Update. 2000-12-18 Andreas Jaeger <aj@suse.de> * test-skeleton.c: Use temp_name_list instead of temp_name_list to avoid collision with name_list from inet/netgroup.h. * nss/nss_files/files-network.c (NEED_H_ERRNO): Define. * include/grp.h (DECLARE_NSS_PROTOTYPES): New. * include/pwd.h (DECLARE_NSS_PROTOTYPES): New. * include/netdb.h (DECLARE_NSS_PROTOTYPES): New. * include/shadow.h (DECLARE_NSS_PROTOTYPES): New. * hesiod/nss_hesiod/hesiod-proto.c (_nss_hesiod_setprotoent): Fix declaration to match prototype. * hesiod/nss_hesiod/hesiod-pwd.c (_nss_hesiod_setpwent): Likewise. * hesiod/nss_hesiod/hesiod-grp.c (_nss_hesiod_setgrent): Likewise. * hesiod/nss_hesiod/hesiod-service.c (_nss_hesiod_setservent): Likewise. * nis/nss_nis/nis-grp.c (_nss_nis_setgrent): Likewise. * nis/nss_nis/nis-pwd.c (_nss_nis_setpwent): Likewise. * nis/nss_nis/nis-proto.c (_nss_nis_setprotoent): Likewise. * nis/nss_nis/nis-service.c (_nss_nis_setservent): Likewise. (_nss_nis_getservbyport_r): Likewise. * nis/nss_nis/nis-hosts.c (_nss_nis_sethostent): Likewise. * nis/nss_nis/nis-spwd.c (_nss_nis_setspent): Likewise. * nis/nss_nis/nis-network.c (_nss_nis_getnetent_r): Likewise. (_nss_nis_setnetent): Likewise * nis/nss_nis/nis-netgrp.c (_nss_nis_setnetgrent): Likewise. (_nss_nis_endnetgrent): Likewise. * nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_endnetgrent): Likewise. (_nss_nisplus_setnetgrent): Likewise. * nis/nss_nisplus/nisplus-spwd.c (_nss_nisplus_setspent): Likewise. * nis/nss_nisplus/nisplus-pwd.c (_nss_nisplus_setpwent): Likewise. * nis/nss_nisplus/nisplus-grp.c (_nss_nisplus_setgrent): Likewise. * nis/nss_nisplus/nisplus-network.c (_nss_nisplus_setnetent): Likewise. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_sethostent): Likewise. * nis/nss_nisplus/nisplus-service.c (_nss_nisplus_setservent): Likewise. * nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_setprotoent): Likewise. * nis/nss_compat/compat-spwd.c (_nss_compat_setspent): Likewise. * nis/nss_compat/compat-pwd.c (_nss_compat_setpwent): Likewise. * nis/nss_compat/compat-grp.c (_nss_compat_setgrent): Likewise. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr_r): Likewise. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r): Likewise. (_nss_dns_getnetbyaddr_r): Likewise.
2000-12-18 17:40:40 +01:00
insque (newp, temp_name_list);
}
}
/* Delete all temporary files. */
static void
delete_temp_files (void)
{
Update. 2000-12-18 Andreas Jaeger <aj@suse.de> * test-skeleton.c: Use temp_name_list instead of temp_name_list to avoid collision with name_list from inet/netgroup.h. * nss/nss_files/files-network.c (NEED_H_ERRNO): Define. * include/grp.h (DECLARE_NSS_PROTOTYPES): New. * include/pwd.h (DECLARE_NSS_PROTOTYPES): New. * include/netdb.h (DECLARE_NSS_PROTOTYPES): New. * include/shadow.h (DECLARE_NSS_PROTOTYPES): New. * hesiod/nss_hesiod/hesiod-proto.c (_nss_hesiod_setprotoent): Fix declaration to match prototype. * hesiod/nss_hesiod/hesiod-pwd.c (_nss_hesiod_setpwent): Likewise. * hesiod/nss_hesiod/hesiod-grp.c (_nss_hesiod_setgrent): Likewise. * hesiod/nss_hesiod/hesiod-service.c (_nss_hesiod_setservent): Likewise. * nis/nss_nis/nis-grp.c (_nss_nis_setgrent): Likewise. * nis/nss_nis/nis-pwd.c (_nss_nis_setpwent): Likewise. * nis/nss_nis/nis-proto.c (_nss_nis_setprotoent): Likewise. * nis/nss_nis/nis-service.c (_nss_nis_setservent): Likewise. (_nss_nis_getservbyport_r): Likewise. * nis/nss_nis/nis-hosts.c (_nss_nis_sethostent): Likewise. * nis/nss_nis/nis-spwd.c (_nss_nis_setspent): Likewise. * nis/nss_nis/nis-network.c (_nss_nis_getnetent_r): Likewise. (_nss_nis_setnetent): Likewise * nis/nss_nis/nis-netgrp.c (_nss_nis_setnetgrent): Likewise. (_nss_nis_endnetgrent): Likewise. * nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_endnetgrent): Likewise. (_nss_nisplus_setnetgrent): Likewise. * nis/nss_nisplus/nisplus-spwd.c (_nss_nisplus_setspent): Likewise. * nis/nss_nisplus/nisplus-pwd.c (_nss_nisplus_setpwent): Likewise. * nis/nss_nisplus/nisplus-grp.c (_nss_nisplus_setgrent): Likewise. * nis/nss_nisplus/nisplus-network.c (_nss_nisplus_setnetent): Likewise. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_sethostent): Likewise. * nis/nss_nisplus/nisplus-service.c (_nss_nisplus_setservent): Likewise. * nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_setprotoent): Likewise. * nis/nss_compat/compat-spwd.c (_nss_compat_setspent): Likewise. * nis/nss_compat/compat-pwd.c (_nss_compat_setpwent): Likewise. * nis/nss_compat/compat-grp.c (_nss_compat_setgrent): Likewise. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr_r): Likewise. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r): Likewise. (_nss_dns_getnetbyaddr_r): Likewise.
2000-12-18 17:40:40 +01:00
while (temp_name_list != NULL)
{
Update. 2000-12-18 Andreas Jaeger <aj@suse.de> * test-skeleton.c: Use temp_name_list instead of temp_name_list to avoid collision with name_list from inet/netgroup.h. * nss/nss_files/files-network.c (NEED_H_ERRNO): Define. * include/grp.h (DECLARE_NSS_PROTOTYPES): New. * include/pwd.h (DECLARE_NSS_PROTOTYPES): New. * include/netdb.h (DECLARE_NSS_PROTOTYPES): New. * include/shadow.h (DECLARE_NSS_PROTOTYPES): New. * hesiod/nss_hesiod/hesiod-proto.c (_nss_hesiod_setprotoent): Fix declaration to match prototype. * hesiod/nss_hesiod/hesiod-pwd.c (_nss_hesiod_setpwent): Likewise. * hesiod/nss_hesiod/hesiod-grp.c (_nss_hesiod_setgrent): Likewise. * hesiod/nss_hesiod/hesiod-service.c (_nss_hesiod_setservent): Likewise. * nis/nss_nis/nis-grp.c (_nss_nis_setgrent): Likewise. * nis/nss_nis/nis-pwd.c (_nss_nis_setpwent): Likewise. * nis/nss_nis/nis-proto.c (_nss_nis_setprotoent): Likewise. * nis/nss_nis/nis-service.c (_nss_nis_setservent): Likewise. (_nss_nis_getservbyport_r): Likewise. * nis/nss_nis/nis-hosts.c (_nss_nis_sethostent): Likewise. * nis/nss_nis/nis-spwd.c (_nss_nis_setspent): Likewise. * nis/nss_nis/nis-network.c (_nss_nis_getnetent_r): Likewise. (_nss_nis_setnetent): Likewise * nis/nss_nis/nis-netgrp.c (_nss_nis_setnetgrent): Likewise. (_nss_nis_endnetgrent): Likewise. * nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_endnetgrent): Likewise. (_nss_nisplus_setnetgrent): Likewise. * nis/nss_nisplus/nisplus-spwd.c (_nss_nisplus_setspent): Likewise. * nis/nss_nisplus/nisplus-pwd.c (_nss_nisplus_setpwent): Likewise. * nis/nss_nisplus/nisplus-grp.c (_nss_nisplus_setgrent): Likewise. * nis/nss_nisplus/nisplus-network.c (_nss_nisplus_setnetent): Likewise. * nis/nss_nisplus/nisplus-hosts.c (_nss_nisplus_sethostent): Likewise. * nis/nss_nisplus/nisplus-service.c (_nss_nisplus_setservent): Likewise. * nis/nss_nisplus/nisplus-proto.c (_nss_nisplus_setprotoent): Likewise. * nis/nss_compat/compat-spwd.c (_nss_compat_setspent): Likewise. * nis/nss_compat/compat-pwd.c (_nss_compat_setpwent): Likewise. * nis/nss_compat/compat-grp.c (_nss_compat_setgrent): Likewise. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyaddr_r): Likewise. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r): Likewise. (_nss_dns_getnetbyaddr_r): Likewise.
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;
}
}
/* Timeout handler. We kill the child and exit with an error. */
static void
__attribute__ ((noreturn))
timeout_handler (int sig __attribute__ ((unused)))
{
int killed;
/* Send signal. */
kill (pid, SIGKILL);
/* Wait for it to terminate. */
killed = waitpid (pid, NULL, WNOHANG);
if (killed != 0 && killed != pid)
{
perror ("Failed to killed test process");
exit (1);
}
#ifdef CLEANUP_HANDLER
CLEANUP_HANDLER;
#endif
fputs ("Timed out: killed the child process\n", stderr);
/* Exit with an error. */
exit (1);
}
/* We provide the entry point here. */
int
main (int argc, char *argv[])
{
int direct = 0; /* Directly call the test function? */
int status;
int opt;
#ifdef STDOUT_UNBUFFERED
setbuf (stdout, NULL);
#endif
while ((opt = getopt_long (argc, argv, "", options, NULL)) != -1)
switch (opt)
{
case '?':
exit (1);
case OPT_DIRECT:
direct = 1;
break;
case OPT_TESTDIR:
test_dir = optarg;
break;
#ifdef CMDLINE_PROCESS
CMDLINE_PROCESS
#endif
}
/* Set TMPDIR to specified test directory. */
if (test_dir != NULL)
{
setenv ("TMPDIR", test_dir, 1);
if (chdir (test_dir) < 0)
{
perror ("chdir");
exit (1);
}
}
else
{
test_dir = getenv ("TMPDIR");
if (test_dir == NULL || test_dir[0] == '\0')
test_dir = "/tmp";
}
/* Make sure we see all message, even those on stdout. */
setvbuf (stdout, NULL, _IONBF, 0);
Update. 1998-04-14 16:34 Ulrich Drepper <drepper@cygnus.com> * test-skeleton.c: Provide hook for initializing code before the fork. * rt/tst-aio.c: Use PREPARE hook to make suer temp files are always removed. * libio/fcloseall.c (__fcloseall): Return return value of _IO_cleanup. * libio/genops.c (_IO_cleanup): Return return value of _IO_flush_all. * libio/libioP.h: Adopt _IO_cleanup prototype. * stdlib/Makefile (tests): Add test-canon2. * stdlib/test-canon2.c: New file. * stdlib/canonicalize.c (canonicalize): Allow RESOLVED parameter to be NULL. Use __lxstat, not __lstat. Correctly recognize long symlink sequences. (__realpath): Make real function which checks RESOLVED parameter for not being NULL. 1998-04-14 Ulrich Drepper <drepper@cygnus.com> * catgets/open_catalog.c (__open_catalog): Fix problems with reading non-files. Always close file. Reported by Cristian Gafton <gafton@redhat.com>. * elf/dl-minimal.c (__strtol_internal): Prevent overflow warnings. 1998-04-14 13:28 Ulrich Drepper <drepper@cygnus.com> * libc.map: Add various low-level I/O functions. 1998-04-14 10:35 Ulrich Drepper <drepper@cygnus.com> * string/Makefile (routines): Remove strerror_r. * string/strerror_r.c: Removed. * string/strerror.c: Call __strerror_r for doing the real work. * sysdeps/generic/_strerror.c: Rename function to __strerror_r and add weak alias strerror_r. * sysdeps/mach/_strerror.c: Likewise. * assert/assert-perr.c: Use __strerror_r instead of _strerror_internal. * elf/dl-error.c (_dl_signal_error): Likewise. * elf/dl-profile.c (_dl_start_profile): Likewise. * gmon/gmon.c (write_gmon): Likewise. * stdio-common/perror.c: Likewise. * stdio-common/vfprintf.c: Likewise. 1998-04-10 Mark Kettenis <kettenis@phys.uva.nl> * sysdeps/unix/sysv/linux/Makefile [$(subdir)=inet] (sysdep_headers): Add netatalk/at.h. 1998-04-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * manual/socket.texi, manual/creature.texi, manual/time.texi: Formatting fixes. 1998-04-13 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * posix/regex.c: Rename __re_syntax_options back to re_syntax_options, aliases do not work with global variables due to copy relocations. (regex_compile): Use syntax parameter instead of re_syntax_options. 1998-04-14 Andreas Jaeger <aj@arthur.rhein-neckar.de> * configure.in: Document that enable-force-install is default.
1998-04-14 18:51:08 +02:00
/* make sure temporary files are deleted. */
atexit (delete_temp_files);
/* Correct for the possible parameters. */
argv += optind - 1;
argc -= optind - 1;
Update. 1998-04-14 16:34 Ulrich Drepper <drepper@cygnus.com> * test-skeleton.c: Provide hook for initializing code before the fork. * rt/tst-aio.c: Use PREPARE hook to make suer temp files are always removed. * libio/fcloseall.c (__fcloseall): Return return value of _IO_cleanup. * libio/genops.c (_IO_cleanup): Return return value of _IO_flush_all. * libio/libioP.h: Adopt _IO_cleanup prototype. * stdlib/Makefile (tests): Add test-canon2. * stdlib/test-canon2.c: New file. * stdlib/canonicalize.c (canonicalize): Allow RESOLVED parameter to be NULL. Use __lxstat, not __lstat. Correctly recognize long symlink sequences. (__realpath): Make real function which checks RESOLVED parameter for not being NULL. 1998-04-14 Ulrich Drepper <drepper@cygnus.com> * catgets/open_catalog.c (__open_catalog): Fix problems with reading non-files. Always close file. Reported by Cristian Gafton <gafton@redhat.com>. * elf/dl-minimal.c (__strtol_internal): Prevent overflow warnings. 1998-04-14 13:28 Ulrich Drepper <drepper@cygnus.com> * libc.map: Add various low-level I/O functions. 1998-04-14 10:35 Ulrich Drepper <drepper@cygnus.com> * string/Makefile (routines): Remove strerror_r. * string/strerror_r.c: Removed. * string/strerror.c: Call __strerror_r for doing the real work. * sysdeps/generic/_strerror.c: Rename function to __strerror_r and add weak alias strerror_r. * sysdeps/mach/_strerror.c: Likewise. * assert/assert-perr.c: Use __strerror_r instead of _strerror_internal. * elf/dl-error.c (_dl_signal_error): Likewise. * elf/dl-profile.c (_dl_start_profile): Likewise. * gmon/gmon.c (write_gmon): Likewise. * stdio-common/perror.c: Likewise. * stdio-common/vfprintf.c: Likewise. 1998-04-10 Mark Kettenis <kettenis@phys.uva.nl> * sysdeps/unix/sysv/linux/Makefile [$(subdir)=inet] (sysdep_headers): Add netatalk/at.h. 1998-04-12 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * manual/socket.texi, manual/creature.texi, manual/time.texi: Formatting fixes. 1998-04-13 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * posix/regex.c: Rename __re_syntax_options back to re_syntax_options, aliases do not work with global variables due to copy relocations. (regex_compile): Use syntax parameter instead of re_syntax_options. 1998-04-14 Andreas Jaeger <aj@arthur.rhein-neckar.de> * configure.in: Document that enable-force-install is default.
1998-04-14 18:51:08 +02:00
/* Call the initializing function, if one is available. */
#ifdef PREPARE
PREPARE (argc, argv);
#endif
/* 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
/* Execute the test function and exit with the return value. */
exit (TEST_FUNCTION);
}
else if (pid < 0)
{
perror ("Cannot fork test program");
exit (1);
}
/* Set timeout. */
#ifndef TIMEOUT
/* Default timeout is two seconds. */
# define TIMEOUT 2
#endif
alarm (TIMEOUT);
signal (SIGALRM, timeout_handler);
/* Wait for the regular termination. */
if (waitpid (pid, &status, 0) != pid)
{
perror ("Oops, wrong test program terminated");
exit (1);
}
#ifndef EXPECTED_SIGNAL
/* We don't expect any signal. */
# define EXPECTED_SIGNAL 0
#endif
Update. 1998-03-23 07:52 H.J. Lu <hjl@gnu.org> * elf/dl-close.c (_dl_close): Fix byte count while removing the shared object from the global scope list and optimize a little bit. 1998-03-22 Andreas Jaeger <aj@arthur.rhein-neckar.de> * manual/filesys.texi (Scanning Directory Content): Add missing closing brace. (Scanning Directory Content): Fix text. 1998-03-22 Andreas Jaeger <aj@arthur.rhein-neckar.de> * manual/memory.texi (Heap Consistency Checking): Add paragraph explaining difference of -lmcheck and MALLOC_CHECK_. 1998-03-23 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/sysv/linux/fstatvfs.c (fstatvfs): Correct some typos in comments. 1998-03-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * test-skeleton.c (main): Fix test for exit signal. 1998-03-22 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/generic/strtok_r.c: Undefine __strtok_r. 1998-03-22 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/generic/memcmp.c [_LIBC]: Define WORDS_BIGENDIAN as appropriate. 1998-03-23 11:14 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * libc.map: Export __strtok_r. 1998-03-23 Ulrich Drepper <drepper@cygnus.com> * posix/regex.c (re_compile_fastmap): Remove unused variable num_regs and adjust comment. Patch by Jim Meyering <meyering@ascend.com>. * math/math.h (M_*l): Extend long double constants to be usable for 128 bit floats. Patch by Richard Henderson. 1998-03-23 11:16 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> Patch by Tim Waugh and Andreas Schwab.
1998-03-23 12:53:10 +01:00
if (WTERMSIG (status) != 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, "Didn't expect signal from child: got `%s'\n",
strsignal (WTERMSIG (status)));
exit (1);
}
/* Simply exit with the return value of the test. */
return WEXITSTATUS (status);
}