commit 906b7f6d576b10a8f20d858e379595c9a94cabfc
parent 875b469a6dd588702a4d84a9e8f3f4002a482021
Author: jvoisin <julien.voisin@dustri.org>
Date: Mon, 10 Jul 2023 23:46:28 +0200
Add some dynamic tests for sys/socket.h
Diffstat:
9 files changed, 64 insertions(+), 4 deletions(-)
diff --git a/tests/Makefile b/tests/Makefile
@@ -58,10 +58,14 @@ TARGETS= \
test_vsnprintf \
test_vsprintf \
test_malloc \
- test_recv \
- test_recvfrom \
- test_send \
- test_sendto \
+ test_recv_static \
+ test_recv_dynamic \
+ test_recvfrom_static \
+ test_recvfrom_dynamic \
+ test_send_static \
+ test_send_dynamic \
+ test_sendto_static \
+ test_sendto_dynamic \
test_FD_CLR_negative \
test_FD_CLR_SETSIZE \
test_FD_SET_negative \
diff --git a/tests/test_recv_dynamic.c b/tests/test_recv_dynamic.c
@@ -0,0 +1,14 @@
+#include "common.h"
+
+#include <sys/socket.h>
+
+int main(int argc, char** argv) {
+ char buffer[8] = {0};
+
+ CHK_FAIL_START
+ recv(0, buffer, argc, 0);
+ CHK_FAIL_END
+
+ puts(buffer);
+ return ret;
+}
diff --git a/tests/test_recv.c b/tests/test_recv_static.c
diff --git a/tests/test_recvfrom_dynamic.c b/tests/test_recvfrom_dynamic.c
@@ -0,0 +1,14 @@
+#include "common.h"
+
+#include <sys/socket.h>
+
+int main(int argc, char** argv) {
+ char buffer[8] = {0};
+
+ CHK_FAIL_START
+ recvfrom(0, buffer, argc, 0, NULL, NULL);
+ CHK_FAIL_END
+
+ puts(buffer);
+ return ret;
+}
diff --git a/tests/test_recvfrom.c b/tests/test_recvfrom_static.c
diff --git a/tests/test_send_dynamic.c b/tests/test_send_dynamic.c
@@ -0,0 +1,14 @@
+#include "common.h"
+
+#include <sys/socket.h>
+
+int main(int argc, char** argv) {
+ char buffer[8] = {0};
+
+ CHK_FAIL_START
+ send(0, buffer, argc, 0);
+ CHK_FAIL_END
+
+ puts(buffer);
+ return ret;
+}
diff --git a/tests/test_send.c b/tests/test_send_static.c
diff --git a/tests/test_sendto_dynamic.c b/tests/test_sendto_dynamic.c
@@ -0,0 +1,14 @@
+#include "common.h"
+
+#include <sys/socket.h>
+
+int main(int argc, char** argv) {
+ char buffer[8] = {0};
+
+ CHK_FAIL_START
+ sendto(0, buffer, argc, 0, NULL, 0);
+ CHK_FAIL_END
+
+ puts(buffer);
+ return ret;
+}
diff --git a/tests/test_sendto.c b/tests/test_sendto_static.c