aboutsummaryrefslogtreecommitdiff
path: root/tests/testutil.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-11-21 22:11:21 -0800
committerGarrett D'Amore <garrett@damore.org>2020-11-23 22:20:12 -0800
commitd1218d7309475193b53911667911c4f59a1a7752 (patch)
tree6ea796998fb60d2cb8afa704faa77fe7fddd644c /tests/testutil.c
parentb826bfc171d90f8bde7bd672c0ac14201b8b2742 (diff)
downloadnng-d1218d7309475193b53911667911c4f59a1a7752.tar.gz
nng-d1218d7309475193b53911667911c4f59a1a7752.tar.bz2
nng-d1218d7309475193b53911667911c4f59a1a7752.zip
New NUTS test framework (NNG Unit Test Support).
This is based on testutil/acutest, but is cleaner and fixes some short-comings. We will be adding more support for additional common paradigms to better facilitate transport tests. While here we added some more test cases, and fixed a possible symbol collision in the the stats framework (due to Linux use of a macro definition of "si_value" in a standard OS header). Test coverage may regress slightly as we are no longer using some of the legacy APIs.
Diffstat (limited to 'tests/testutil.c')
-rw-r--r--tests/testutil.c666
1 files changed, 0 insertions, 666 deletions
diff --git a/tests/testutil.c b/tests/testutil.c
deleted file mode 100644
index ea8386b1..00000000
--- a/tests/testutil.c
+++ /dev/null
@@ -1,666 +0,0 @@
-//
-// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
-// Copyright 2018 Capitar IT Group BV <info@capitar.com>
-//
-// This software is supplied under the terms of the MIT License, a
-// copy of which should be located in the distribution where this
-// file was obtained (LICENSE.txt). A copy of the license may also be
-// found online at https://opensource.org/licenses/MIT.
-//
-
-#ifdef _WIN32
-
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-#include <winsock2.h>
-// order counts
-#include <mswsock.h>
-#define poll WSAPoll
-#include <io.h>
-#else
-#include <fcntl.h>
-#include <poll.h>
-#include <stdint.h>
-#include <sys/time.h>
-#include <time.h>
-#include <unistd.h>
-#endif
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#if !defined(_WIN32) && !defined(CLOCK_MONOTONIC)
-#include <poll.h>
-#endif
-
-#include "testutil.h"
-
-#include <nng/supplemental/util/platform.h>
-
-uint64_t
-testutil_clock(void)
-{
-#ifdef _WIN32
- return (GetTickCount64());
-#elif defined(CLOCK_MONTONIC)
- struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
- uint64_t val;
-
- val = ts.tv_sec;
- val *= 1000;
- val += ts.tv_nsec / 1000000;
- return (val);
-#else
- static time_t epoch;
- struct timeval tv;
-
- if (epoch == 0) {
- epoch = time(NULL);
- }
- gettimeofday(&tv, NULL);
-
- if (tv.tv_sec < epoch) {
- // Broken clock.
- // This will force all other timing tests to fail
- return (0);
- }
- tv.tv_sec -= epoch;
- return (
- ((uint64_t)(tv.tv_sec) * 1000) + (uint64_t)(tv.tv_usec / 1000));
-#endif
-
-#ifdef _WIN32
-#else
-#include <fcntl.h>
-#include <unistd.h>
-#endif
-}
-
-bool
-testutil_pollfd(int fd)
-{
-#ifdef _WIN32
- struct pollfd pfd;
- pfd.fd = (SOCKET) fd;
- pfd.events = POLLRDNORM;
- pfd.revents = 0;
-
- switch (WSAPoll(&pfd, 1, 0)) {
- case 0:
- return (false);
- case 1:
- return (true);
- }
-#else
- struct pollfd pfd;
-
- pfd.fd = fd;
- pfd.events = POLLRDNORM;
- pfd.revents = 0;
-
- switch (poll(&pfd, 1, 0)) {
- case 0:
- return (false);
- case 1:
- return (true);
- }
-#endif
- return (false);
-}
-
-bool
-testutil_is_little_endian(void)
-{
- uint16_t num = 0x1;
- uint8_t *ptr = (uint8_t *) (void *) (&num);
- return (ptr[0] == 1);
-}
-
-uint16_t
-testutil_htons(uint16_t in)
-{
- if (testutil_is_little_endian()) {
- in = ((in / 0x100) + ((in % 0x100) * 0x100));
- }
- return (in);
-}
-
-uint32_t
-testutil_htonl(uint32_t in)
-{
- if (testutil_is_little_endian()) {
- in = ((in >> 24u) & 0xffu) | ((in >> 8u) & 0xff00u) |
- ((in << 8u) & 0xff0000u) | ((in << 24u) & 0xff000000u);
- }
- return (in);
-}
-
-void
-testutil_scratch_addr(const char *scheme, size_t sz, char *addr)
-{
- if ((strcmp(scheme, "inproc") == 0) ||
- (strcmp(scheme, "abstract") == 0)) {
- (void) snprintf(addr, sz, "%s://testutil%04x%04x%04x%04x",
- scheme, nng_random(), nng_random(), nng_random(),
- nng_random());
- return;
- }
-
- if ((strncmp(scheme, "tcp", 3) == 0) ||
- (strncmp(scheme, "tls", 3) == 0)) {
- (void) snprintf(addr, sz, "%s://127.0.0.1:%u", scheme,
- testutil_next_port());
- return;
- }
-
- if (strncmp(scheme, "ws", 2) == 0) {
- (void) snprintf(addr, sz,
- "%s://127.0.0.1:%u/testutil%04x%04x%04x%04x", scheme,
- testutil_next_port(), nng_random(), nng_random(),
- nng_random(), nng_random());
- return;
- }
-
- if ((strncmp(scheme, "ipc", 3) == 0) ||
- (strncmp(scheme, "unix", 4) == 0)) {
-#ifdef _WIN32
- // Windows doesn't place IPC names in the filesystem.
- (void) snprintf(addr, sz, "%s://testutil%04x%04x%04x%04x",
- scheme, nng_random(), nng_random(), nng_random(),
- nng_random());
- return;
-#else
- char *tmpdir;
-
- if (((tmpdir = getenv("TMPDIR")) == NULL) &&
- ((tmpdir = getenv("TEMP")) == NULL) &&
- ((tmpdir = getenv("TMP")) == NULL)) {
- tmpdir = "/tmp";
- }
-
- (void) snprintf(addr, sz, "%s://%s/testutil%04x%04x%04x%04x",
- scheme, tmpdir, nng_random(), nng_random(), nng_random(),
- nng_random());
- return;
-#endif
- }
-
- // We should not be here.
- abort();
-}
-
-// testutil_next_port returns a "next" allocation port.
-// Ports are chosen by starting from a random point within a
-// range (normally 38000-40000, but other good places to choose
-// might be 36000-37000, 42000-43000, 45000-47000, 48000-49000.
-// These are non-ephemeral ports. Successive calls to this function
-// will return the next port in the range (wrapping). This works even
-// across process boundaries, as the range is tracked in a file named
-// by $TEST_PORT_FILE. The range of ports can be configured by using
-// $TEST_PORT_RANGE (the range is specified as "lo:hi" where the actual
-// port will be in the range [lo,hi).
-uint16_t
-testutil_next_port(void)
-{
- char * pfile;
- FILE * f;
- uint16_t port;
- uint16_t base;
- uint16_t end;
- char * str;
-#ifdef _WIN32
- OVERLAPPED olp;
- HANDLE h;
-#endif
-
- pfile = getenv("TEST_PORT_FILE");
- if (pfile == NULL) {
- pfile = ".nng_ports";
- }
- if (((str = getenv("TEST_PORT_RANGE")) == NULL) ||
- ((sscanf(str, "%hu:%hu", &base, &end)) != 1) ||
- ((int) end - (int) base) < 1) {
- base = 38000;
- end = 40000;
- }
-
- if (((f = fopen(pfile, "r+")) == NULL) &&
- ((f = fopen(pfile, "w+")) == NULL)) {
- return (0);
- }
- (void) fseek(f, 0, SEEK_SET);
-
-#ifdef _WIN32
- h = (HANDLE) _get_osfhandle(_fileno(f));
-
- // This contains the offset information for LockFileEx.
- ZeroMemory(&olp, sizeof(olp));
-
- if (LockFileEx(h, LOCKFILE_EXCLUSIVE_LOCK, 0, MAXDWORD, MAXDWORD,
- &olp) == FALSE) {
- fclose(f);
- return (0);
- }
-#else
- if (lockf(fileno(f), 0, F_LOCK) != 0) {
- (void) fclose(f);
- return (0);
- }
-#endif
- if (fscanf(f, "%hu", &port) != 1) {
- unsigned seed = (unsigned) time(NULL);
-
-#ifdef _WIN32
- port = base + rand_s(&seed) % (end - base);
-#else
- port = base + rand_r(&seed) % (end - base);
-#endif
- }
- port++;
- if ((port < base) || (port >= (base + end))) {
- port = base;
- }
-
-#ifdef _WIN32
- fseek(f, 0, SEEK_SET);
- SetEndOfFile(h);
- (void) fprintf(f, "%u", port);
- ZeroMemory(&olp, sizeof(olp));
- (void) UnlockFileEx(h, 0, MAXDWORD, MAXDWORD, &olp);
-#else
- fseek(f, 0, SEEK_SET);
- if (ftruncate(fileno(f), 0) != 0) {
- (void) fclose(f);
- return (0);
- }
-
- (void) fprintf(f, "%u", port);
- (void) lockf(fileno(f), 0, F_ULOCK);
-
-#endif
- (void) fclose(f);
- return (port);
-}
-
-void
-testutil_sleep(int msec)
-{
-#ifdef _WIN32
- Sleep(msec);
-#elif defined(CLOCK_MONOTONIC)
- struct timespec ts;
-
- ts.tv_sec = msec / 1000;
- ts.tv_nsec = (msec % 1000) * 1000000;
-
- // Do this in a loop, so that interrupts don't actually wake us.
- while (ts.tv_sec || ts.tv_nsec) {
- if (nanosleep(&ts, &ts) == 0) {
- break;
- }
- }
-#else
- poll(NULL, 0, msec);
-#endif
-}
-
-struct marriage_notice {
- nng_mtx *mx;
- nng_cv * cv;
- int s1;
- int s2;
- int cnt1;
- int cnt2;
- nng_pipe p1;
- nng_pipe p2;
-};
-
-static void
-married(nng_pipe p, nng_pipe_ev ev, void *arg)
-{
- struct marriage_notice *notice = arg;
- (void) ev;
-
- nng_mtx_lock(notice->mx);
- if (nng_socket_id(nng_pipe_socket(p)) == notice->s1) {
- notice->cnt1++;
- notice->p1 = p;
- } else if (nng_socket_id(nng_pipe_socket(p)) == notice->s2) {
- notice->cnt2++;
- notice->p2 = p;
- }
- nng_cv_wake(notice->cv);
- nng_mtx_unlock(notice->mx);
-}
-
-int
-testutil_marry(nng_socket s1, nng_socket s2)
-{
- return (testutil_marry_ex(s1, s2, NULL, NULL, NULL));
-}
-
-int
-testutil_marry_ex(
- nng_socket s1, nng_socket s2, const char *url, nng_pipe *p1, nng_pipe *p2)
-{
- struct marriage_notice note;
- nng_time timeout;
- int rv;
- char addr[32];
-
- if (url == NULL) {
- (void) snprintf(addr, sizeof(addr),
- "inproc://marry%04x%04x%04x%04x", nng_random(),
- nng_random(), nng_random(), nng_random());
- url = addr;
- }
-
- note.cnt1 = 0;
- note.cnt2 = 0;
- note.s1 = nng_socket_id(s1);
- note.s2 = nng_socket_id(s2);
- timeout = nng_clock() + 1000; // 1 second
-
- if (((rv = nng_mtx_alloc(&note.mx)) != 0) ||
- ((rv = nng_cv_alloc(&note.cv, note.mx)) != 0) ||
- ((rv = nng_pipe_notify(
- s1, NNG_PIPE_EV_ADD_POST, married, &note)) != 0) ||
- ((rv = nng_pipe_notify(
- s2, NNG_PIPE_EV_ADD_POST, married, &note)) != 0) ||
- ((rv = nng_listen(s1, url, NULL, 0)) != 0) ||
- ((rv = nng_dial(s2, url, NULL, 0)) != 0)) {
- goto done;
- }
-
- nng_mtx_lock(note.mx);
- while ((note.cnt1 == 0) || (note.cnt2 == 0)) {
- if ((rv = nng_cv_until(note.cv, timeout)) != 0) {
- break;
- }
- }
- nng_mtx_unlock(note.mx);
- if (p1 != NULL) {
- *p1 = note.p1;
- }
- if (p2 != NULL) {
- *p2 = note.p2;
- }
-
-done:
- nng_pipe_notify(s1, NNG_PIPE_EV_ADD_POST, NULL, NULL);
- nng_pipe_notify(s2, NNG_PIPE_EV_ADD_POST, NULL, NULL);
- if (note.cv != NULL) {
- nng_cv_free(note.cv);
- }
- if (note.mx != NULL) {
- nng_mtx_free(note.mx);
- }
- return (rv);
-}
-
-typedef struct {
- uint8_t * base;
- size_t rem;
- nng_iov iov;
- nng_aio * upper_aio;
- nng_aio * lower_aio;
- nng_stream *s;
- void (*submit)(nng_stream *, nng_aio *);
-} stream_xfr_t;
-
-static void
-stream_xfr_free(stream_xfr_t *x)
-{
- if (x == NULL) {
- return;
- }
- if (x->upper_aio != NULL) {
- nng_aio_free(x->upper_aio);
- }
- if (x->lower_aio != NULL) {
- nng_aio_free(x->lower_aio);
- }
- nng_free(x, sizeof(*x));
-}
-
-static void
-stream_xfr_start(stream_xfr_t *x)
-{
- nng_iov iov;
- iov.iov_buf = x->base;
- iov.iov_len = x->rem;
-
- nng_aio_set_iov(x->lower_aio, 1, &iov);
- x->submit(x->s, x->lower_aio);
-}
-
-static void
-stream_xfr_cb(void *arg)
-{
- stream_xfr_t *x = arg;
- int rv;
- size_t n;
-
- rv = nng_aio_result(x->lower_aio);
- if (rv != 0) {
- nng_aio_finish(x->upper_aio, rv);
- return;
- }
- n = nng_aio_count(x->lower_aio);
-
- x->rem -= n;
- x->base += n;
-
- if (x->rem == 0) {
- nng_aio_finish(x->upper_aio, 0);
- return;
- }
-
- stream_xfr_start(x);
-}
-
-static stream_xfr_t *
-stream_xfr_alloc(nng_stream *s, void (*submit)(nng_stream *, nng_aio *),
- void *buf, size_t size)
-{
- stream_xfr_t *x;
-
- if ((x = nng_alloc(size)) == NULL) {
- return (NULL);
- }
- if (nng_aio_alloc(&x->upper_aio, NULL, NULL) != 0) {
- stream_xfr_free(x);
- return (NULL);
- }
- if (nng_aio_alloc(&x->lower_aio, stream_xfr_cb, x) != 0) {
- stream_xfr_free(x);
- return (NULL);
- }
-
- // Upper should not take more than 30 seconds, lower not more than 5.
- nng_aio_set_timeout(x->upper_aio, 30000);
- nng_aio_set_timeout(x->lower_aio, 5000);
-
- nng_aio_begin(x->upper_aio);
-
- x->s = s;
- x->rem = size;
- x->base = buf;
- x->submit = submit;
-
- return (x);
-}
-
-static int
-stream_xfr_wait(stream_xfr_t *x)
-{
- int rv;
- if (x == NULL) {
- return (NNG_ENOMEM);
- }
- nng_aio_wait(x->upper_aio);
- rv = nng_aio_result(x->upper_aio);
- stream_xfr_free(x);
- return (rv);
-}
-
-void *
-testutil_stream_recv_start(nng_stream *s, void *buf, size_t size)
-{
- stream_xfr_t *x;
-
- x = stream_xfr_alloc(s, nng_stream_recv, buf, size);
- if (x == NULL) {
- return (x);
- }
- stream_xfr_start(x);
- return (x);
-}
-
-int
-testutil_stream_recv_wait(void *arg)
-{
- return (stream_xfr_wait(arg));
-}
-
-void *
-testutil_stream_send_start(nng_stream *s, void *buf, size_t size)
-{
- stream_xfr_t *x;
-
- x = stream_xfr_alloc(s, nng_stream_send, buf, size);
- if (x == NULL) {
- return (x);
- }
- stream_xfr_start(x);
- return (x);
-}
-
-int
-testutil_stream_send_wait(void *arg)
-{
- return (stream_xfr_wait(arg));
-}
-
-// TLS certificates. These are pre-generated, and should not be used outside
-// of these test cases. They are all using RSA 2048 with SHA256.
-// All certs are signed by the root key (making the root self-signed).
-// They all expire in about 100 years -- so we don't have to worry about
-// expiration.
-//
-// The server cert uses CN 127.0.0.1.
-//
-// Country = XX
-// State = Utopia
-// Locality = Paradise
-// Organization = NNG Tests, Inc.
-//
-
-const char *testutil_server_key =
- "-----BEGIN RSA PRIVATE KEY-----\n"
- "MIIEowIBAAKCAQEAyPdnRbMrQj9902TGQsmMbG6xTSl9XKbJr55BcnyZifsrqA7B\n"
- "bNSkndVw9Qq+OJQIDBTfRhGdG+o9j3h6SDVvIb62fWtwJ5Fe0eUmeYwPc1PKQzOm\n"
- "MFlMYekXiZsx60yu5LeuUhGlb84+csImH+m3NbutInPJcStSq0WfSV6VNk6DN353\n"
- "5ex66zV2Ms6ikys1vCC434YqIpe1VxUh+IC2widJcLDCxmmJt3TOlx5f9OcKMkxu\n"
- "H4fMAzgjIEpIrUjdb19CGNVvsNrEEB2CShBMgBdqMaAnKFxpKgfzS0JFulxRGNtp\n"
- "srweki+j+a4sJXTv40kELkRQS6uB6wWZNjcPywIDAQABAoIBAQCGSUsot+BgFCzv\n"
- "5JbWafb7Pbwb421xS8HZJ9Zzue6e1McHNVTqc+zLyqQAGX2iMMhvykKnf32L+anJ\n"
- "BKgxOANaeSVYCUKYLfs+JfDfp0druMGexhR2mjT/99FSkfF5WXREQLiq/j+dxiLU\n"
- "bActq+5QaWf3bYddp6VF7O/TBvCNqBfD0+S0o0wtBdvxXItrKPTD5iKr9JfLWdAt\n"
- "YNAk2QgFywFtY5zc2wt4queghF9GHeBzzZCuVj9QvPA4WdVq0mePaPTmvTYQUD0j\n"
- "GT6X5j9JhqCwfh7trb/HfkmLHwwc62zPDFps+Dxao80+vss5b/EYZ4zY3S/K3vpG\n"
- "f/e42S2BAoGBAP51HQYFJGC/wsNtOcX8RtXnRo8eYmyboH6MtBFrZxWl6ERigKCN\n"
- "5Tjni7EI3nwi3ONg0ENPFkoQ8h0bcVFS7iW5kz5te73WaOFtpkU9rmuFDUz37eLP\n"
- "d+JLZ5Kwfn2FM9HoiSAZAHowE0MIlmmIEXSnFtqA2z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fw0yMDA1MjMyMzMxMTlaGA8yMTIwMDQyOTIzMzExOVowXzELMAkGA1UEBhMCWFgx\n"
- "DzANBgNVBAgMBlV0b3BpYTERMA8GA1UEBwwIUGFyYWRpc2UxGDAWBgNVBAoMD05O\n"
- "RyBUZXN0cywgSW5jLjESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0B\n"
- "AQEFAAOCAQ8AMIIBCgKCAQEAyPdnRbMrQj9902TGQsmMbG6xTSl9XKbJr55BcnyZ\n"
- "ifsrqA7BbNSkndVw9Qq+OJQIDBTfRhGdG+o9j3h6SDVvIb62fWtwJ5Fe0eUmeYwP\n"
- "c1PKQzOmMFlMYekXiZsx60yu5LeuUhGlb84+csImH+m3NbutInPJcStSq0WfSV6V\n"
- "Nk6DN3535ex66zV2Ms6ikys1vCC434YqIpe1VxUh+IC2widJcLDCxmmJt3TOlx5f\n"
- "9OcKMkxuH4fMAzgjIEpIrUjdb19CGNVvsNrEEB2CShBMgBdqMaAnKFxpKgfzS0JF\n"
- "ulxRGNtpsrweki+j+a4sJXTv40kELkRQS6uB6wWZNjcPywIDAQABMA0GCSqGSIb3\n"
- "DQEBCwUAA4IBAQA86Fqrd4aiih6R3fwiMLwV6IQJv+u5rQeqA4D0xu6v6siP42SJ\n"
- "YMaI2DkNGrWdSFVSHUK/efceCrhnMlW7VM8I1cyl2F/qKMfnT72cxqqquiKtQKdT\n"
- "NDTzv61QMUP9n86HxMzGS7jg0Pknu55BsIRNK6ndDvI3D/K/rzZs4xbqWSSfNfQs\n"
- "fNFBbOuDrkS6/1h3p8SY1uPM18WLVv3GO2T3aeNMHn7YJAKSn+sfaxzAPyPIK3UT\n"
- "W8ecGQSHOqBJJQELyUfMu7lx/FCYKUhN7/1uhU5Qf1pCR8hkIMegtqr64yVBNMOn\n"
- "248fuiHbs9BRknuA/PqjxIDDZTwtDrfVSO/S\n"
- "-----END CERTIFICATE-----\n";
-
-const char *testutil_client_key =
- "-----BEGIN RSA PRIVAT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