Discussion:
[SCM] Socket Wrapper Repository - branch master updated
Andreas Schneider
2018-03-22 13:01:57 UTC
Permalink
The branch, master has been updated
via 33da03f cmake: Fix configure check for fall-through attribute
from f7fc3f5 cmake: Fix checks for attributes

https://git.samba.org/?p=socket_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 33da03f478955daa04adca67fc012379bf0d2a39
Author: Andreas Schneider <***@samba.org>
Date: Wed Feb 28 07:36:58 2018 +0100

cmake: Fix configure check for fall-through attribute

Signed-off-by: Andreas Schneider <***@samba.org>
Reviewed-by: Ralph Boehme <***@samba.org>

-----------------------------------------------------------------------

Summary of changes:
ConfigureChecks.cmake | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index f06e780..93010f4 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -205,22 +205,13 @@ int main(void) {
check_c_source_compiles("
#define FALL_THROUGH __attribute__((fallthrough))

-enum direction_e {
- UP = 0,
- DOWN,
-};
-
int main(void) {
- enum direction_e key = UP;
- int i = 10;
- int j = 0;
+ int i = 2;

- switch (key) {
- case UP:
- i = 5;
+ switch (i) {
+ case 0:
FALL_THROUGH;
- case DOWN:
- j = i * 2;
+ case 1:
break;
default:
break;
--
Socket Wrapper Repository
Andreas Schneider
2018-03-26 07:09:55 UTC
Permalink
The branch, master has been updated
via 142024a tests: Remove extra test by moving getsockname() to another
from 33da03f cmake: Fix configure check for fall-through attribute

https://git.samba.org/?p=socket_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 142024a641ca43f842584499b5694d26853dd3d9
Author: Anoop C S <***@redhat.com>
Date: Fri Mar 23 17:12:49 2018 +0530

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 <***@redhat.com>
Reviewed-by: Andreas Schneider <***@samba.org>
Reviewed-by: Andrew Bartlet <***@samba.org>

-----------------------------------------------------------------------

Summary of changes:
tests/CMakeLists.txt | 1 -
tests/test_echo_tcp_socket.c | 69 --------------------------------------------
tests/test_tcp_listen.c | 2 ++
3 files changed, 2 insertions(+), 70 deletions(-)
delete mode 100644 tests/test_echo_tcp_socket.c


Changeset truncated at 500 lines:

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index b86cc84..836a5e2 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -24,7 +24,6 @@ set(SWRAP_TESTS
test_tcp_listen
test_tcp_dup2
test_fcntl
- test_echo_tcp_socket
test_echo_tcp_connect
test_echo_tcp_bind
test_echo_tcp_socket_options
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;
-}
diff --git a/tests/test_tcp_listen.c b/tests/test_tcp_listen.c
index 5641c47..746620d 100644
--- a/tests/test_tcp_listen.c
+++ b/tests/test_tcp_listen.c
@@ -52,6 +52,7 @@ static void test_listen_unbound_ipv4(void **state)

rc = getsockname(s1, &addr.sa.s, &addr.sa_socklen);
assert_return_code(rc, errno);
+ assert_int_equal(addr.sa.in.sin_family, AF_INET);
assert_int_equal(addr.sa_socklen, sizeof(struct sockaddr_in));
assert_in_range(ntohs(addr.sa.in.sin_port), 1024, 65535);

@@ -85,6 +86,7 @@ static void test_listen_unbound_ipv6(void **state)

rc = getsockname(s1, &addr.sa.s, &addr.sa_socklen);
assert_return_code(rc, errno);
+ assert_int_equal(addr.sa.in6.sin6_family, AF_INET6);
assert_int_equal(addr.sa_socklen, sizeof(struct sockaddr_in6));
assert_in_range(ntohs(addr.sa.in6.sin6_port), 1024, 65535);
--
Socket Wrapper Repository
Loading...