summaryrefslogtreecommitdiffstats
path: root/tests/test_echo_tcp_socket.c
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2018-03-23 17:12:49 +0530
committerAndreas Schneider <asn@samba.org>2018-03-26 09:09:32 +0200
commit142024a641ca43f842584499b5694d26853dd3d9 (patch)
tree925f35f961e521f765fcc325c6d379cc56ecd8ba /tests/test_echo_tcp_socket.c
parent33da03f478955daa04adca67fc012379bf0d2a39 (diff)
downloadsocket_wrapper-142024a641ca43f842584499b5694d26853dd3d9.tar.gz
socket_wrapper-142024a641ca43f842584499b5694d26853dd3d9.tar.xz
socket_wrapper-142024a641ca43f842584499b5694d26853dd3d9.zip
tests: Remove extra test by moving getsockname() to another
test_echo_tcp_socket currently tests socket() and getsockname() network calls. The test name was misleading as it does not require echo server to be setup. Moreover it failed to create socket_wrapper directory which is the pre-requisite for testing with libsocket_wrapper. Therefore it is better to integrate getsockname() test into existing test_tcp_listen test and remove useless test_echo_tcp_socket Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlet <abartlet@samba.org>
Diffstat (limited to 'tests/test_echo_tcp_socket.c')
-rw-r--r--tests/test_echo_tcp_socket.c69
1 files changed, 0 insertions, 69 deletions
diff --git a/tests/test_echo_tcp_socket.c b/tests/test_echo_tcp_socket.c
deleted file mode 100644
index 57b92de..0000000
--- a/tests/test_echo_tcp_socket.c
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
-#include "config.h"
-#include "torture.h"
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-
-static void test_socket_getsockname(void **state)
-{
- struct torture_address addr = {
- .sa_socklen = sizeof(struct sockaddr_in),
- };
- int rc;
- int s;
-
- (void) state; /* unused */
-
- s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- assert_int_not_equal(s, -1);
-
- rc = getsockname(s, &addr.sa.s, &addr.sa_socklen);
- assert_return_code(rc, errno);
- assert_int_equal(addr.sa.in.sin_family, AF_INET);
-}
-
-#ifdef HAVE_IPV6
-static void test_socket_getsockname6(void **state)
-{
- struct torture_address addr = {
- .sa_socklen = sizeof(struct sockaddr_in),
- };
- int rc;
- int s;
-
- (void) state; /* unused */
-
- s = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
- assert_int_not_equal(s, -1);
-
- rc = getsockname(s, &addr.sa.s, &addr.sa_socklen);
- assert_return_code(rc, errno);
- assert_int_equal(addr.sa.in6.sin6_family, AF_INET6);
-}
-#endif
-
-int main(void) {
- int rc;
-
- const struct CMUnitTest getsockname_tests[] = {
- cmocka_unit_test(test_socket_getsockname),
-#ifdef HAVE_IPV6
- cmocka_unit_test(test_socket_getsockname6),
-#endif
- };
-
- rc = cmocka_run_group_tests(getsockname_tests, NULL, NULL);
-
- return rc;
-}