summaryrefslogtreecommitdiff
path: root/testcode
diff options
context:
space:
mode:
Diffstat (limited to 'testcode')
-rw-r--r--testcode/asynclook.c30
-rw-r--r--testcode/fake_event.c6
-rw-r--r--testcode/streamtcp.c2
-rw-r--r--testcode/testbound.c3
-rw-r--r--testcode/unitmain.c3
5 files changed, 39 insertions, 5 deletions
diff --git a/testcode/asynclook.c b/testcode/asynclook.c
index a2bdb62130b79..06bcf5ab862a8 100644
--- a/testcode/asynclook.c
+++ b/testcode/asynclook.c
@@ -56,6 +56,15 @@
#undef free
#undef strdup
#endif
+#ifdef HAVE_SSL
+#ifdef HAVE_OPENSSL_SSL_H
+#include <openssl/ssl.h>
+#endif
+#ifdef HAVE_OPENSSL_ERR_H
+#include <openssl/err.h>
+#endif
+#endif /* HAVE_SSL */
+
/** keeping track of the async ids */
struct track_id {
@@ -459,6 +468,27 @@ int main(int argc, char** argv)
argc -= optind;
argv += optind;
+#ifdef HAVE_SSL
+#ifdef HAVE_ERR_LOAD_CRYPTO_STRINGS
+ ERR_load_crypto_strings();
+#endif
+#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_SSL)
+ ERR_load_SSL_strings();
+#endif
+#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_CRYPTO)
+ OpenSSL_add_all_algorithms();
+#else
+ OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS
+ | OPENSSL_INIT_ADD_ALL_DIGESTS
+ | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
+#endif
+#if OPENSSL_VERSION_NUMBER < 0x10100000 || !defined(HAVE_OPENSSL_INIT_SSL)
+ (void)SSL_library_init();
+#else
+ (void)OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL);
+#endif
+#endif /* HAVE_SSL */
+
if(ext)
return ext_test(ctx, argc, argv);
diff --git a/testcode/fake_event.c b/testcode/fake_event.c
index 860e2e81e3247..80e3685c09efa 100644
--- a/testcode/fake_event.c
+++ b/testcode/fake_event.c
@@ -1125,7 +1125,7 @@ pending_tcp_query(struct serviced_query* sq, sldns_buffer* packet,
pend->addrlen = sq->addrlen;
pend->callback = callback;
pend->cb_arg = callback_arg;
- pend->timeout = timeout;
+ pend->timeout = timeout/1000;
pend->transport = transport_tcp;
pend->pkt = NULL;
pend->zone = NULL;
@@ -1218,7 +1218,7 @@ struct serviced_query* outnet_serviced_query(struct outside_network* outnet,
log_assert(pend->zone);
pend->callback = callback;
pend->cb_arg = callback_arg;
- pend->timeout = UDP_AUTH_QUERY_TIMEOUT;
+ pend->timeout = UDP_AUTH_QUERY_TIMEOUT/1000;
pend->transport = transport_udp; /* pretend UDP */
pend->pkt = NULL;
pend->runtime = runtime;
@@ -1757,7 +1757,7 @@ int comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet,
}
pend->callback = fc->cb;
pend->cb_arg = fc->cb_arg;
- pend->timeout = UDP_AUTH_QUERY_TIMEOUT;
+ pend->timeout = UDP_AUTH_QUERY_TIMEOUT/1000;
pend->transport = transport_udp;
pend->pkt = NULL;
pend->runtime = runtime;
diff --git a/testcode/streamtcp.c b/testcode/streamtcp.c
index b494507def265..0a636395fd35c 100644
--- a/testcode/streamtcp.c
+++ b/testcode/streamtcp.c
@@ -284,7 +284,7 @@ send_em(const char* svr, int udp, int usessl, int noanswer, int num, char** qs)
SSL* ssl = NULL;
if(!buf) fatal_exit("out of memory");
if(usessl) {
- ctx = connect_sslctx_create(NULL, NULL, NULL);
+ ctx = connect_sslctx_create(NULL, NULL, NULL, 0);
if(!ctx) fatal_exit("cannot create ssl ctx");
ssl = outgoing_ssl_fd(ctx, fd);
if(!ssl) fatal_exit("cannot create ssl");
diff --git a/testcode/testbound.c b/testcode/testbound.c
index 56b89c7f0d7e1..071ac9c2a5b44 100644
--- a/testcode/testbound.c
+++ b/testcode/testbound.c
@@ -177,7 +177,8 @@ spool_temp_file(FILE* in, int* lineno, char* id)
while(isspace((unsigned char)*parse))
parse++;
if(strncmp(parse, "$INCLUDE_TEMPFILE", 17) == 0) {
- char l2[MAX_LINE_LEN];
+ char l2[MAX_LINE_LEN-30]; /* -30 makes it fit with
+ a preceding $INCLUDE in the buf line[] */
char* tid = parse+17;
while(isspace((unsigned char)*tid))
tid++;
diff --git a/testcode/unitmain.c b/testcode/unitmain.c
index 57883d183b9f1..fecde80cc3d13 100644
--- a/testcode/unitmain.c
+++ b/testcode/unitmain.c
@@ -905,6 +905,9 @@ main(int argc, char* argv[])
#ifdef CLIENT_SUBNET
ecs_test();
#endif /* CLIENT_SUBNET */
+ if(log_get_lock()) {
+ lock_quick_destroy((lock_quick_type*)log_get_lock());
+ }
checklock_stop();
printf("%d checks ok.\n", testcount);
#ifdef HAVE_SSL