1 /* $NetBSD: t_api.h,v 1.6 2014/12/10 04:38:02 christos Exp $ */ 2 3 /* 4 * Copyright (C) 2004-2007, 2010, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") 5 * Copyright (C) 1999-2001 Internet Software Consortium. 6 * 7 * Permission to use, copy, modify, and/or distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /* Id: t_api.h,v 1.24 2010/06/08 23:50:24 tbox Exp */ 21 22 #ifndef TESTS_T_API_H 23 #define TESTS_T_API_H 1 24 25 /*! \file tests/t_api.h */ 26 27 #include <stdio.h> 28 29 #include <isc/lang.h> 30 #include <isc/platform.h> 31 #include <isc/result.h> 32 #include <isc/formatcheck.h> 33 34 /* 35 * 36 * Result codes. 37 * 38 */ 39 40 #define T_PASS 0x1 41 #define T_FAIL 0x2 42 #define T_UNRESOLVED 0x3 43 #define T_SKIPPED 0x4 44 #define T_UNTESTED 0x5 45 #define T_THREADONLY 0x6 46 #define T_PKCS11ONLY 0x7 47 48 /* 49 * 50 * Assertion class codes. 51 * 52 */ 53 54 #define T_OPTIONAL 0x0 55 #define T_REQUIRED 0x1 56 57 /* 58 * Misc 59 */ 60 61 #define T_MAXTOKS 16 62 #define T_ARG(n) (*(av + (n))) 63 64 typedef void (*PFV)(void); 65 66 typedef struct { 67 PFV pfv; 68 const char *func_name; 69 } testspec_t; 70 71 LIBTESTS_EXTERNAL_DATA extern int T_debug; 72 #ifndef WIN32 73 extern testspec_t T_testlist[]; 74 #endif 75 76 ISC_LANG_BEGINDECLS 77 78 #ifdef WIN32 79 void 80 t_settests(const testspec_t list[]); 81 82 int 83 t_main(int argc, char **argv); 84 #endif 85 86 void 87 t_assert(const char *component, int anum, int class, const char *what, ...) 88 ISC_FORMAT_PRINTF(4, 5); 89 90 void 91 t_info(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); 92 93 void 94 t_result(int result); 95 96 char * 97 t_getenv(const char *name); 98 99 char * 100 t_fgetbs(FILE *fp); 101 102 isc_result_t 103 t_dns_result_fromtext(char *result); 104 105 unsigned int 106 t_dc_method_fromtext(char *dc_method); 107 108 int 109 t_bustline(char *line, char **toks); 110 111 int 112 t_eval(const char *filename, int (*func)(char **), int nargs); 113 114 ISC_LANG_ENDDECLS 115 116 #endif /* TESTS_T_API_H */ 117 118