00001 /* 00002 * Copyright (C) 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") 00003 * 00004 * Permission to use, copy, modify, and/or distribute this software for any 00005 * purpose with or without fee is hereby granted, provided that the above 00006 * copyright notice and this permission notice appear in all copies. 00007 * 00008 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 00009 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00010 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 00011 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00012 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00013 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00014 * PERFORMANCE OF THIS SOFTWARE. 00015 */ 00016 00017 /* $Id$ */ 00018 00019 /*! \file */ 00020 00021 #include <config.h> 00022 00023 #include <isc/buffer.h> 00024 #include <isc/entropy.h> 00025 #include <isc/hash.h> 00026 #include <isc/log.h> 00027 #include <isc/mem.h> 00028 #include <isc/string.h> 00029 #include <isc/task.h> 00030 #include <isc/timer.h> 00031 #include <isc/util.h> 00032 00033 #include <dns/result.h> 00034 #include <dns/zone.h> 00035 00036 #define CHECK(r) \ 00037 do { \ 00038 result = (r); \ 00039 if (result != ISC_R_SUCCESS) \ 00040 goto cleanup; \ 00041 } while (0) 00042 00043 extern isc_mem_t *mctx; 00044 extern isc_entropy_t *ectx; 00045 extern isc_log_t *lctx; 00046 extern isc_taskmgr_t *taskmgr; 00047 extern isc_task_t *maintask; 00048 extern isc_timermgr_t *timermgr; 00049 extern isc_socketmgr_t *socketmgr; 00050 extern dns_zonemgr_t *zonemgr; 00051 extern isc_boolean_t app_running; 00052 extern int ncpus; 00053 00054 isc_result_t 00055 dns_test_begin(FILE *logfile, isc_boolean_t create_managers); 00056 00057 void 00058 dns_test_end(void); 00059 00060 isc_result_t 00061 dns_test_makeview(const char *name, dns_view_t **viewp); 00062 00063 isc_result_t 00064 dns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view, 00065 isc_boolean_t keepview); 00066 00067 isc_result_t 00068 dns_test_setupzonemgr(void); 00069 00070 isc_result_t 00071 dns_test_managezone(dns_zone_t *zone); 00072 00073 void 00074 dns_test_releasezone(dns_zone_t *zone); 00075 00076 void 00077 dns_test_closezonemgr(void); 00078 00079 void 00080 dns_test_nap(isc_uint32_t usec); 00081 00082 isc_result_t 00083 dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin, 00084 const char *testfile);