aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-11-23 18:25:08 -0800
committerGarrett D'Amore <garrett@damore.org>2024-11-23 18:25:08 -0800
commit47b22e7e91ee8e881d1b46094871f0440961f1ba (patch)
treef154af615b7573b6ff190635deddac3dbf1a6e9b
parent52408ba30c0d2babeab27eae9bf5e91b0d61c8cd (diff)
downloadnng-47b22e7e91ee8e881d1b46094871f0440961f1ba.tar.gz
nng-47b22e7e91ee8e881d1b46094871f0440961f1ba.tar.bz2
nng-47b22e7e91ee8e881d1b46094871f0440961f1ba.zip
Remove pollfd test - covered in protocol tests
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/pollfd.c113
2 files changed, 0 insertions, 114 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index a42dd23a..3868a955 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -134,7 +134,6 @@ add_nng_test(multistress 60)
add_nng_test(nonblock 60)
add_nng_test(options 5)
add_nng_test(pipe 5)
-add_nng_test(pollfd 5)
add_nng_test(scalability 20 ON)
add_nng_test(synch 5)
add_nng_test(tcpsupp 10)
diff --git a/tests/pollfd.c b/tests/pollfd.c
deleted file mode 100644
index 5cc2d89a..00000000
--- a/tests/pollfd.c
+++ /dev/null
@@ -1,113 +0,0 @@
-//
-// Copyright 2024 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.
-//
-
-#include <string.h>
-
-#ifndef _WIN32
-#include <poll.h>
-#include <unistd.h>
-#define INVALID_SOCKET -1
-#else
-
-#define poll WSAPoll
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#include <windows.h>
-#include <winsock2.h>
-
-#include <mswsock.h>
-#include <ws2tcpip.h>
-
-#endif
-
-#include <nng/nng.h>
-#include <nng/protocol/pair1/pair.h>
-#include <nng/protocol/pipeline0/pull.h>
-#include <nng/protocol/pipeline0/push.h>
-
-#include "convey.h"
-#include "stubs.h"
-
-TestMain("Poll FDs", {
- Convey("Given a connected pair of sockets", {
- nng_socket s1;
- nng_socket s2;
-
- So(nng_pair1_open(&s1) == 0);
- So(nng_pair1_open(&s2) == 0);
- Reset({
- nng_close(s1);
- nng_close(s2);
- });
- So(nng_listen(s1, "inproc://yeahbaby", NULL, 0) == 0);
- So(nng_dial(s2, "inproc://yeahbaby", NULL, 0) == 0);
- nng_msleep(50);
-
- Convey("We can get a recv FD", {
- int fd;
-
- So(nng_socket_get_recv_poll_fd(s1, &fd) == 0);
- So(fd != (int) INVALID_SOCKET);
-
- Convey("And it is always the same fd", {
- int fd2;
- So(nng_socket_get_recv_poll_fd(s1, &fd2) == 0);
- So(fd2 == fd);
- });
-
- Convey("And they start non pollable", {
- struct pollfd pfd;
- pfd.fd = fd;
- pfd.events = POLLIN;
- pfd.revents = 0;
-
- So(poll(&pfd, 1, 0) == 0);
- So(pfd.revents == 0);
- });
-
- Convey("But if we write they are pollable", {
- struct pollfd pfd;
- pfd.fd = fd;
- pfd.events = POLLIN;
- pfd.revents = 0;
-
- So(nng_send(s2, "kick", 5, 0) == 0);
- So(poll(&pfd, 1, 1000) == 1);
- So((pfd.revents & POLLIN) != 0);
- });
- });
-
- Convey("We can get a send FD", {
- int fd;
-
- So(nng_socket_get_send_poll_fd(s1, &fd) == 0);
- So(fd != (int) INVALID_SOCKET);
- So(nng_send(s1, "oops", 4, 0) == 0);
- });
- });
-
- Convey("We cannot get a send FD for PULL", {
- nng_socket s3;
- int fd;
- So(nng_pull0_open(&s3) == 0);
- Reset({ nng_close(s3); });
- So(nng_socket_get_send_poll_fd(s3, &fd) == NNG_ENOTSUP);
- });
-
- Convey("We cannot get a recv FD for PUSH", {
- nng_socket s3;
- int fd;
- So(nng_push0_open(&s3) == 0);
- Reset({ nng_close(s3); });
- So(nng_socket_get_recv_poll_fd(s3, &fd) == NNG_ENOTSUP);
- });
-})