summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-11-14 17:50:17 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-11-14 17:50:17 +0100
commit5a2f2088a19bf89945aec9f466080eb22eb6b62b (patch)
tree0bea4643c5ba14e60acf3f9e19087d8c7744f065 /tests
parentc307100af04e54067d9bdaa786306b63cf12d442 (diff)
downloadsocket_wrapper-5a2f2088a19bf89945aec9f466080eb22eb6b62b.tar.gz
socket_wrapper-5a2f2088a19bf89945aec9f466080eb22eb6b62b.tar.xz
socket_wrapper-5a2f2088a19bf89945aec9f466080eb22eb6b62b.zip
tests: Add simple ioctl test.
Diffstat (limited to 'tests')
-rw-r--r--tests/testsuite.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/testsuite.c b/tests/testsuite.c
index 5bb0adb..2223226 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -5,6 +5,7 @@
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/ioctl.h>
#include <errno.h>
#include <stdlib.h>
@@ -62,6 +63,20 @@ static void test_socket_wrapper_dir(void **state)
}
#endif
+static void test_swrap_ioctl(void **state)
+{
+ int fd;
+ int rc;
+
+ (void) state; /* unused */
+
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ assert_int_not_equal(fd, -1);
+
+ rc = ioctl(fd, FIONBIO);
+ assert_int_equal(rc, 0);
+}
+
static void test_swrap_socket(void **state)
{
int rc;
@@ -102,6 +117,7 @@ int main(void) {
const UnitTest tests[] = {
unit_test_setup_teardown(test_swrap_socket, setup, teardown),
+ unit_test_setup_teardown(test_swrap_ioctl, setup, teardown),
};
rc = run_tests(tests);