t_api.c revision 48e26c1a805513a39b00cf711f5b12ce38a52b8c
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * Copyright (C) 1999 Internet Software Consortium.
7e09576b7739de29ade3fc4d11daa1836d300459Tinderbox User * Permission to use, copy, modify, and distribute this software for any
7e09576b7739de29ade3fc4d11daa1836d300459Tinderbox User * purpose with or without fee is hereby granted, provided that the above
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * copyright notice and this permission notice appear in all copies.
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews "\t-c <config_file> : use specified config file\n"
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews "\t-d <debug_level> : set debug level to debug_level\n"
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews "\t-h : print test info\n"
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews "\t-u : print usage info\n"
f5c17a057fc5974bb51d7bc8c5827a7fd6dc9aeeEvan Hunt "\t-n <test_name> : run specified test name\n"
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews "\t-t <test_number> : run specified test number\n";
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * -a --> run all tests
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * -tn --> run test n
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * -c config --> use config file 'config'
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * -d --> turn on api debugging
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews * -n name --> run test named name
78608b0a454246d0e1e0169f1d671b8427e48199Francis Dupont * -h --> print out available test names
f5c17a057fc5974bb51d7bc8c5827a7fd6dc9aeeEvan Huntextern char *optarg;
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrewsstatic int t_putinfo(const char *key, const char *info);
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrewsstatic char *t_getdate(void);
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrewsstatic void printhelp(void);
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrewsstatic void printusage(void);
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews /* parse args */
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews while ((c = getopt(argc, argv, ":at:c:d:n:hu")) != -1) {
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews if (c == 'a') {
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews /* flag all tests to be run */
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews memset(T_tvec, ~((unsigned)0), sizeof(T_tvec));
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews else if (c == 't') {
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews /* flag test tnum to be run */
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews else if (c == 'c') {
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews else if (c == 'd') {
f5c17a057fc5974bb51d7bc8c5827a7fd6dc9aeeEvan Hunt else if (c == 'n') {
printhelp();
exit(0);
printusage();
exit(0);
optopt);
if (T_debug)
tnum = 0;
++pts;
++tnum;
const char *what, ...)
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 ) {
p = buf + n;
int rval;
return(rval);
time_t t;
struct tm *p;
p = localtime(&t);
return(T_buf);
struct dns_errormap {
char *text;
} dns_errormap[] = {
++pmap;
return(result);
int cnt;
cnt = 0;
*toks++ = p;
++cnt;
return(cnt);
printhelp() {
int cnt;
++pts;
++cnt;
printusage() {