summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2021-02-17 12:29:27 +0100
committerAndreas Schneider <asn@samba.org>2021-03-15 08:04:58 +0100
commitba970e5d32cceb0750eaa71fb83da3e2eef881d5 (patch)
tree6c7b485096014361c8dff27ca42cd1626ed53621 /tests
parentefd2967e060a3a7ca3de589a23511bb38151ed8b (diff)
downloadsocket_wrapper-ba970e5d32cceb0750eaa71fb83da3e2eef881d5.tar.gz
socket_wrapper-ba970e5d32cceb0750eaa71fb83da3e2eef881d5.tar.xz
socket_wrapper-ba970e5d32cceb0750eaa71fb83da3e2eef881d5.zip
swrap: export a public socket_wrapper_indicate_no_inet_fd() helper function
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14640 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_public_functions.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_public_functions.c b/tests/test_public_functions.c
index 11d03ef..816cd7d 100644
--- a/tests/test_public_functions.c
+++ b/tests/test_public_functions.c
@@ -60,6 +60,31 @@ static void test_call_enabled_false(void **state)
assert_false(s != NULL);
}
+static void test_call_indicate_no_inet_fd(void **state)
+{
+ int rc;
+ int s = -1;
+
+ (void) state; /* unused */
+
+ socket_wrapper_indicate_no_inet_fd(987654321);
+ socket_wrapper_indicate_no_inet_fd(-1);
+
+ rc = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ if (rc >= 0) {
+ s = rc;
+ rc = 0;
+ }
+ assert_return_code(rc, errno);
+
+ socket_wrapper_indicate_no_inet_fd(987654321);
+ socket_wrapper_indicate_no_inet_fd(-1);
+ socket_wrapper_indicate_no_inet_fd(s);
+ socket_wrapper_indicate_no_inet_fd(0);
+ socket_wrapper_indicate_no_inet_fd(1);
+ socket_wrapper_indicate_no_inet_fd(2);
+}
+
int main(void) {
int rc;
@@ -70,6 +95,12 @@ int main(void) {
cmocka_unit_test_setup_teardown(test_call_enabled_false,
setup_disabled,
teardown_disabled),
+ cmocka_unit_test_setup_teardown(test_call_indicate_no_inet_fd,
+ setup_enabled,
+ teardown_enabled),
+ cmocka_unit_test_setup_teardown(test_call_indicate_no_inet_fd,
+ setup_disabled,
+ teardown_disabled),
};
rc = cmocka_run_group_tests(max_sockets_tests, NULL, NULL);