summaryrefslogtreecommitdiff
path: root/testcode
diff options
context:
space:
mode:
Diffstat (limited to 'testcode')
-rw-r--r--testcode/asynclook.c2
-rw-r--r--testcode/dohclient.c6
-rw-r--r--testcode/fake_event.c4
-rw-r--r--testcode/lock_verify.c33
-rw-r--r--testcode/perf.c2
-rw-r--r--testcode/petal.c10
-rw-r--r--testcode/streamtcp.c2
-rw-r--r--testcode/testbound.c11
-rw-r--r--testcode/unitmain.c2
9 files changed, 62 insertions, 10 deletions
diff --git a/testcode/asynclook.c b/testcode/asynclook.c
index 660f72a7df8c..fffd14ed598a 100644
--- a/testcode/asynclook.c
+++ b/testcode/asynclook.c
@@ -406,10 +406,10 @@ int main(int argc, char** argv)
struct lookinfo* lookups;
int i, r, cancel=0, blocking=0, ext=0;
+ checklock_start();
/* init log now because solaris thr_key_create() is not threadsafe */
log_init(0,0,0);
/* lock debug start (if any) */
- checklock_start();
/* create context */
ctx = ub_ctx_create();
diff --git a/testcode/dohclient.c b/testcode/dohclient.c
index 93d84a83550d..d35f5a82c662 100644
--- a/testcode/dohclient.c
+++ b/testcode/dohclient.c
@@ -358,7 +358,7 @@ static int http2_data_chunk_recv_cb(nghttp2_session* ATTR_UNUSED(session),
}
if(sldns_buffer_remaining(h2_stream->buf) < len) {
- log_err("received data chunck does not fit into buffer");
+ log_err("received data chunk does not fit into buffer");
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
@@ -531,7 +531,7 @@ run(struct http2_session* h2_session, int port, int no_tls, int count, char** q)
h2_session->block_select = 1;
- /* hande query */
+ /* handle query */
for(i=0; i<count; i+=3) {
buf = make_query(q[i], q[i+1], q[i+2]);
submit_query(h2_session, buf);
@@ -571,8 +571,8 @@ int main(int argc, char** argv)
return 1;
}
#endif
- log_init(0, 0, 0);
checklock_start();
+ log_init(0, 0, 0);
h2_session = http2_session_create();
if(!h2_session) fatal_exit("out of memory");
diff --git a/testcode/fake_event.c b/testcode/fake_event.c
index 5f81b9eb808c..6a8245d4a6ab 100644
--- a/testcode/fake_event.c
+++ b/testcode/fake_event.c
@@ -1244,7 +1244,9 @@ struct serviced_query* outnet_serviced_query(struct outside_network* outnet,
client_string_addr->string_len,
client_string_addr->string, qstate->region);
}
- edns.opt_list = qstate->edns_opts_back_out;
+ edns.opt_list_in = NULL;
+ edns.opt_list_out = qstate->edns_opts_back_out;
+ edns.opt_list_inplace_cb_out = NULL;
attach_edns_record(pend->buffer, &edns);
}
memcpy(&pend->addr, addr, addrlen);
diff --git a/testcode/lock_verify.c b/testcode/lock_verify.c
index 666a7029d64d..b0cffe292ae1 100644
--- a/testcode/lock_verify.c
+++ b/testcode/lock_verify.c
@@ -387,6 +387,37 @@ static void check_order(rbtree_type* all_locks)
fprintf(stderr, "\n");
}
+/** delete lock ref */
+static void dellockref(rbnode_type* node, void* ATTR_UNUSED(arg))
+{
+ struct lock_ref* o = (struct lock_ref*)node;
+ if(!o) return;
+ free(o->file);
+ free(o);
+}
+
+/** delete lock node */
+static void delnode(rbnode_type* node, void* ATTR_UNUSED(arg))
+{
+ struct order_lock* o = (struct order_lock*)node;
+ if(!o) return;
+ free(o->create_file);
+ if(o->smaller) {
+ traverse_postorder(o->smaller, &dellockref, NULL);
+ free(o->smaller);
+ }
+ free(o);
+}
+
+/** delete allocated memory */
+static void locks_free(rbtree_type* all_locks)
+{
+ if(!all_locks)
+ return;
+ traverse_postorder(all_locks, &delnode, NULL);
+ free(all_locks);
+}
+
/** main program to verify all traces passed */
int
main(int argc, char* argv[])
@@ -403,6 +434,7 @@ main(int argc, char* argv[])
usage();
return 1;
}
+ checklock_start();
log_init(NULL, 0, NULL);
log_ident_set("lock-verify");
/* init */
@@ -421,6 +453,7 @@ main(int argc, char* argv[])
printf("checked %d locks in %d seconds with %d errors.\n",
(int)all_locks->count, (int)(time(NULL)-starttime),
errors_detected);
+ locks_free(all_locks);
if(errors_detected) return 1;
return 0;
}
diff --git a/testcode/perf.c b/testcode/perf.c
index b13eca6d3946..55d6483c7cf9 100644
--- a/testcode/perf.c
+++ b/testcode/perf.c
@@ -575,9 +575,9 @@ int main(int argc, char* argv[])
memset(&info, 0, sizeof(info));
info.io_num = 16;
+ checklock_start();
log_init(NULL, 0, NULL);
log_ident_set("perf");
- checklock_start();
#ifdef USE_WINSOCK
if((r = WSAStartup(MAKEWORD(2,2), &wsa_data)) != 0)
fatal_exit("WSAStartup failed: %s", wsa_strerror(r));
diff --git a/testcode/petal.c b/testcode/petal.c
index a1a37615518a..6ea3c34cdaa5 100644
--- a/testcode/petal.c
+++ b/testcode/petal.c
@@ -220,8 +220,11 @@ read_http_headers(SSL* ssl, char* file, size_t flen, char* host, size_t hlen,
host[0] = 0;
while(read_ssl_line(ssl, buf, sizeof(buf))) {
if(verb>=2) printf("read: %s\n", buf);
- if(buf[0] == 0)
+ if(buf[0] == 0) {
+ int e = ERR_peek_error();
+ printf("error string: %s\n", ERR_reason_error_string(e));
return 1;
+ }
if(!process_one_header(buf, file, flen, host, hlen, vs))
return 0;
}
@@ -241,8 +244,11 @@ setup_ctx(char* key, char* cert)
#ifdef HAVE_SSL_CTX_SET_SECURITY_LEVEL
SSL_CTX_set_security_level(ctx, 0); /* for keys in tests */
#endif
- if(!SSL_CTX_use_certificate_chain_file(ctx, cert))
+ if(!SSL_CTX_use_certificate_chain_file(ctx, cert)) {
+ int e = ERR_peek_error();
+ printf("error string: %s\n", ERR_reason_error_string(e));
print_exit("cannot read cert");
+ }
if(!SSL_CTX_use_PrivateKey_file(ctx, key, SSL_FILETYPE_PEM))
print_exit("cannot read key");
if(!SSL_CTX_check_private_key(ctx))
diff --git a/testcode/streamtcp.c b/testcode/streamtcp.c
index 2bd076ee5db2..ecc83c1cff30 100644
--- a/testcode/streamtcp.c
+++ b/testcode/streamtcp.c
@@ -437,8 +437,8 @@ int main(int argc, char** argv)
#endif
/* lock debug start (if any) */
- log_init(0, 0, 0);
checklock_start();
+ log_init(0, 0, 0);
#ifdef SIGPIPE
if(signal(SIGPIPE, &sigh) == SIG_ERR) {
diff --git a/testcode/testbound.c b/testcode/testbound.c
index c92900142870..ec627cc8deb1 100644
--- a/testcode/testbound.c
+++ b/testcode/testbound.c
@@ -374,6 +374,7 @@ main(int argc, char* argv[])
(void)unsetenv("NOTIFY_SOCKET");
#endif /* HAVE_SYSTEMD */
+ checklock_start();
log_init(NULL, 0, NULL);
/* determine commandline options for the daemon */
pass_argc = 1;
@@ -604,3 +605,13 @@ int squelch_err_ssl_handshake(unsigned long ATTR_UNUSED(err))
{
return 0;
}
+
+void listen_setup_locks(void)
+{
+ /* nothing */
+}
+
+void listen_desetup_locks(void)
+{
+ /* nothing */
+}
diff --git a/testcode/unitmain.c b/testcode/unitmain.c
index c18be7be3a08..16aa88450210 100644
--- a/testcode/unitmain.c
+++ b/testcode/unitmain.c
@@ -861,6 +861,7 @@ void ecdsa_evp_workaround_init(void);
int
main(int argc, char* argv[])
{
+ checklock_start();
log_init(NULL, 0, NULL);
if(argc != 1) {
printf("usage: %s\n", argv[0]);
@@ -888,7 +889,6 @@ main(int argc, char* argv[])
if(NSS_NoDB_Init(".") != SECSuccess)
fatal_exit("could not init NSS");
#endif /* HAVE_SSL or HAVE_NSS*/
- checklock_start();
authzone_test();
neg_test();
rnd_test();