diff options
author | Cy Schubert <cy@FreeBSD.org> | 2020-08-21 22:56:05 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2020-08-21 22:56:05 +0000 |
commit | 7973006f41cdaf144441d1a39f9f075053435e2f (patch) | |
tree | 157d55b04796bb6f041656c0e84dd5106f4bc4be /testcode | |
parent | 6a53c00e64c4cf911eb00846733d9e6a47b2e7f4 (diff) |
Diffstat (limited to 'testcode')
-rw-r--r-- | testcode/fake_event.c | 8 | ||||
-rwxr-xr-x | testcode/run_vm.sh | 11 | ||||
-rw-r--r-- | testcode/streamtcp.c | 9 | ||||
-rw-r--r-- | testcode/testbound.c | 10 | ||||
-rw-r--r-- | testcode/unitmain.c | 8 |
5 files changed, 39 insertions, 7 deletions
diff --git a/testcode/fake_event.c b/testcode/fake_event.c index d6e904a4d3cb9..d89eedce8bd01 100644 --- a/testcode/fake_event.c +++ b/testcode/fake_event.c @@ -1031,6 +1031,7 @@ outside_network_create(struct comm_base* base, size_t bufsize, size_t ATTR_UNUSED(num_ports), char** ATTR_UNUSED(ifs), int ATTR_UNUSED(num_ifs), int ATTR_UNUSED(do_ip4), int ATTR_UNUSED(do_ip6), size_t ATTR_UNUSED(num_tcp), + int ATTR_UNUSED(dscp), struct infra_cache* infra, struct ub_randstate* ATTR_UNUSED(rnd), int ATTR_UNUSED(use_caps_for_id), int* ATTR_UNUSED(availports), @@ -1038,7 +1039,8 @@ outside_network_create(struct comm_base* base, size_t bufsize, int ATTR_UNUSED(outgoing_tcp_mss), void (*unwanted_action)(void*), void* ATTR_UNUSED(unwanted_param), int ATTR_UNUSED(do_udp), void* ATTR_UNUSED(sslctx), - int ATTR_UNUSED(delayclose), struct dt_env* ATTR_UNUSED(dtenv)) + int ATTR_UNUSED(delayclose), int ATTR_UNUSED(tls_use_sni), + struct dt_env* ATTR_UNUSED(dtenv)) { struct replay_runtime* runtime = (struct replay_runtime*)base; struct outside_network* outnet = calloc(1, @@ -1583,7 +1585,7 @@ int create_udp_sock(int ATTR_UNUSED(family), int ATTR_UNUSED(socktype), int* ATTR_UNUSED(noproto), int ATTR_UNUSED(rcv), int ATTR_UNUSED(snd), int ATTR_UNUSED(listen), int* ATTR_UNUSED(reuseport), int ATTR_UNUSED(transparent), int ATTR_UNUSED(freebind), - int ATTR_UNUSED(use_systemd)) + int ATTR_UNUSED(use_systemd), int ATTR_UNUSED(dscp)) { /* if you actually print to this, it'll be stdout during test */ return 1; @@ -1790,7 +1792,7 @@ int comm_point_send_udp_msg(struct comm_point *c, sldns_buffer* packet, } int outnet_get_tcp_fd(struct sockaddr_storage* ATTR_UNUSED(addr), - socklen_t ATTR_UNUSED(addrlen), int ATTR_UNUSED(tcp_mss)) + socklen_t ATTR_UNUSED(addrlen), int ATTR_UNUSED(tcp_mss), int ATTR_UNUSED(dscp)) { log_assert(0); return -1; diff --git a/testcode/run_vm.sh b/testcode/run_vm.sh index d4c2a2e11dda4..5f599e144a5be 100755 --- a/testcode/run_vm.sh +++ b/testcode/run_vm.sh @@ -26,15 +26,20 @@ cd testdata TPKG=../testcode/mini_tdir.sh #RUNLIST=`(ls -1d *.tdir|grep -v '^0[016]')` RUNLIST=`(ls -1d *.tdir)` -if test "$#" = "1"; then RUNLIST="$1"; fi +if test "$#" = "1"; then + RUNLIST="$1"; + if echo "$RUNLIST" | grep '/$' >/dev/null; then + RUNLIST=`echo "$RUNLIST" | sed -e 's?/$??'` + fi +fi # fix up tdir that was edited on keyboard interrupt. cleanup() { echo cleanup - if test -f "$t.bak"; then mv "$t.bak" "$t"; fi + if test -f "$t.bak"; then rm -fr "${t}"; mv "$t.bak" "$t"; fi exit 0 } -trap cleanup SIGINT +trap cleanup INT for t in $RUNLIST do diff --git a/testcode/streamtcp.c b/testcode/streamtcp.c index 65ea8d4bcae96..c49159d33a58b 100644 --- a/testcode/streamtcp.c +++ b/testcode/streamtcp.c @@ -200,6 +200,7 @@ write_q(int fd, int udp, SSL* ssl, sldns_buffer* buf, uint16_t id, static void recv_one(int fd, int udp, SSL* ssl, sldns_buffer* buf) { + size_t i; char* pktstr; uint16_t len; if(!udp) { @@ -270,7 +271,13 @@ recv_one(int fd, int udp, SSL* ssl, sldns_buffer* buf) len = (size_t)l; } printf("\nnext received packet\n"); - log_buf(0, "data", buf); + printf("data[%d] ", (int)sldns_buffer_limit(buf)); + for(i=0; i<sldns_buffer_limit(buf); i++) { + const char* hex = "0123456789ABCDEF"; + printf("%c%c", hex[(sldns_buffer_read_u8_at(buf, i)&0xf0)>>4], + hex[sldns_buffer_read_u8_at(buf, i)&0x0f]); + } + printf("\n"); pktstr = sldns_wire2str_pkt(sldns_buffer_begin(buf), len); printf("%s", pktstr); diff --git a/testcode/testbound.c b/testcode/testbound.c index 4405231c08626..602dffaff14a9 100644 --- a/testcode/testbound.c +++ b/testcode/testbound.c @@ -577,3 +577,13 @@ void wsvc_cron_cb(void* ATTR_UNUSED(arg)) } #endif /* UB_ON_WINDOWS */ +int tcp_connect_errno_needs_log(struct sockaddr* ATTR_UNUSED(addr), + socklen_t ATTR_UNUSED(addrlen)) +{ + return 1; +} + +int squelch_err_ssl_handshake(unsigned long ATTR_UNUSED(err)) +{ + return 0; +} diff --git a/testcode/unitmain.c b/testcode/unitmain.c index e8e7a44c7cb60..a42be424e9e9a 100644 --- a/testcode/unitmain.c +++ b/testcode/unitmain.c @@ -867,7 +867,13 @@ main(int argc, char* argv[]) printf("\tperforms unit tests.\n"); return 1; } + /* Disable roundrobin for the unit tests */ + RRSET_ROUNDROBIN = 0; +#ifdef USE_LIBEVENT + printf("Start of %s+libevent unit test.\n", PACKAGE_STRING); +#else printf("Start of %s unit test.\n", PACKAGE_STRING); +#endif #ifdef HAVE_SSL # ifdef HAVE_ERR_LOAD_CRYPTO_STRINGS ERR_load_crypto_strings(); @@ -917,7 +923,9 @@ main(int argc, char* argv[]) # ifdef HAVE_EVP_CLEANUP EVP_cleanup(); # endif +# if (OPENSSL_VERSION_NUMBER < 0x10100000) && !defined(OPENSSL_NO_ENGINE) && defined(HAVE_ENGINE_CLEANUP) ENGINE_cleanup(); +# endif CONF_modules_free(); # endif # ifdef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA |