t_api.c revision 9c3531d72aeaad6c5f01efe6a1c82023e1379e4d
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 1999, 2000 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Permission to use, copy, modify, and distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * copyright notice and this permission notice appear in all copies.
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
5e3affc6a0b155ee1cadac735c1a71f4d418ad69Evan Hunt * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt/* $Id: t_api.c,v 1.39 2000/06/22 22:00:21 tale Exp $ */
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Huntstatic const char *Usage =
2c089bf6d24936de631a57b4958ba6b8b5e3b23dMark Andrews "\t-a : run all tests\n"
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt "\t-b <dir> : chdir to dir before running tests"
2c089bf6d24936de631a57b4958ba6b8b5e3b23dMark Andrews "\t-c <config_file> : use specified config file\n"
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt "\t-d <debug_level> : set debug level to debug_level\n"
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt "\t-h : print test info\n"
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt "\t-u : print usage info\n"
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt "\t-n <test_name> : run specified test name\n"
2c089bf6d24936de631a57b4958ba6b8b5e3b23dMark Andrews "\t-t <test_number> : run specified test number\n"
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt "\t-x : don't execute tests in a subproc\n"
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt "\t-q <timeout> : use 'timeout' as the timeout value\n";
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt * -a --> run all tests
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt * -b dir --> chdir to dir before running tests
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt * -c config --> use config file 'config'
cf0d508b1eb836150fd2fc9c3d497525ed8fbe66Evan Hunt * -d --> turn on api debugging
0949306cb96f9ccbb7d0205584ed2db293a5aad2Evan Hunt * -h --> print out available test names
0949306cb96f9ccbb7d0205584ed2db293a5aad2Evan Hunt * -u --> print usage info
0949306cb96f9ccbb7d0205584ed2db293a5aad2Evan Hunt * -n name --> run test named name
0949306cb96f9ccbb7d0205584ed2db293a5aad2Evan Hunt * -tn --> run test n
0949306cb96f9ccbb7d0205584ed2db293a5aad2Evan Hunt * -x --> don't execute testcases in a subproc
int T_debug;
int T_timeout;
static const char * T_config;
static char * T_dir;
printhelp(void);
printusage(void);
static int T_int;
int tnum;
int subprocs;
int status;
int len;
if (first) {
tnum = 0;
if (first) {
sizeof(T_tvec));
++pts;
++tnum;
printhelp();
exit(0);
printusage();
exit(0);
subprocs = 0;
#ifdef SIGCHLD
if (T_debug)
tnum = 0;
if (subprocs) {
if (T_pid == 0) {
exit(0);
} else if (T_pid > 0) {
T_int = 0;
deadpid =
T_int) {
T_int = 0;
alarm(0);
errno);
++pts;
++tnum;
switch (result) {
case T_PASS:
case T_FAIL:
case T_UNRESOLVED:
case T_UNSUPPORTED:
case T_UNTESTED:
n = NULL;
p = &T_env[0];
while (*p != NULL) {
int rval;
p = &T_env[0];
while (n < T_MAXENV) {
if (*p == NULL)
(void)free(*p);
rval = 0;
return (rval);
int rval;
p = &T_env[0];
while (*p != NULL) {
rval = 0;
return(rval);
size_t n;
char *buf;
p = buf;
if ( n >= size ) {
size * sizeof(char));
p = buf + n;
return(NULL);
int rval;
return(rval);
size_t n;
time_t t;
struct tm *p;
p = localtime(&t);
struct dns_errormap {
const char *text;
} dns_errormap[] = {
++pmap;
return (result);
struct dc_method_map {
unsigned int dc_method;
const char *text;
} dc_method_map[] = {
{ 0, NULL }
unsigned int dc_method;
++pmap;
return(dc_method);
int cnt;
cnt = 0;
*toks++ = p;
++cnt;
return(cnt);
printhelp(void) {
int cnt;
++pts;
++cnt;
printusage(void) {
int line;
int cnt;
int result;
int nfails;
int nprobs;
nfails = 0;
nprobs = 0;
line = 0;
++line;
++nfails;
++nprobs;
++nprobs;
(void)free(p);
++nprobs;
else if (nfails)
return (result);