raw: Modify tests messages & structure
authorroot (spook.local) <root@spook.local>
Sun, 20 Mar 2011 16:14:16 +0000 (18:14 +0200)
committerroot (spook.local) <root@spook.local>
Sun, 20 Mar 2011 16:14:16 +0000 (18:14 +0200)
15 files changed:
src/raw/test/Makefile
src/raw/test/test.c
src/raw/test/test.h
src/raw/test/test_dummy.c
src/raw/test/test_sw.h
src/raw/test/test_sw_bind.c
src/raw/test/test_sw_close.c
src/raw/test/test_sw_getsockname.c
src/raw/test/test_sw_getsockopt.c
src/raw/test/test_sw_recvfrom.c
src/raw/test/test_sw_recvmsg.c
src/raw/test/test_sw_sendmsg.c
src/raw/test/test_sw_sendto.c
src/raw/test/test_sw_shutdown.c
src/raw/test/test_sw_socket.c

index 46ca48a..6137f0a 100644 (file)
@@ -6,7 +6,7 @@ CFLAGS = -Wall -g
 all: test
 
 test: test.o test_sw_socket.o test_sw_bind.o test_sw_getsockname.o \
-       test_sw_sendto.o test_sw_recvfrom.o test_sw_sendmsg.o \
+       test_sw_getsockopt.o test_sw_sendto.o test_sw_recvfrom.o test_sw_sendmsg.o \
        test_sw_recvmsg.o test_sw_setsockopt.o test_sw_getsockopt.o \
        test_sw_shutdown.o test_sw_close.o test_dummy.o
 
index 3364e05..df5bafb 100644 (file)
 
 static void (*test_fun_array[])(void) = {
        NULL,
-       dummy_1_eq_1,
-       dummy_1_neq_0,
-       socket_dummy,
-       bind_dummy,
-       getsockname_dummy,
-       sendto_dummy,
-       recvfrom_dummy,
-       sendmsg_dummy,
-       recvmsg_dummy,
-       shutdown_dummy,
-       close_dummy,
+       test_dummy,
+       socket_test_suite,
+       bind_test_suite,
+       getsockname_test_suite,
+       getsockopt_test_suite,
+       sendto_test_suite,
+       recvfrom_test_suite,
+       sendmsg_test_suite,
+       recvmsg_test_suite,
+       shutdown_test_suite,
+       close_test_suite,
 };
 
 static void usage(const char *argv0)
index 1de3cb1..a830632 100644 (file)
@@ -54,6 +54,10 @@ extern "C" {
                fflush(stdout);                                 \
        } while (0)
 
+#define start_suite()                  \
+       do {                                            \
+                       printf("\n==== Starting %s ====\n", __FUNCTION__); \
+       } while (0)
 #ifdef __cplusplus
 }
 #endif
index 99f29d2..3141301 100644 (file)
@@ -4,12 +4,22 @@
 
 #include "test.h"
 
-void dummy_1_eq_1(void)
+static void dummy_1_eq_1(void);
+static void dummy_1_neq_0(void);
+
+void test_dummy(void) 
+{
+       start_suite();
+       dummy_1_eq_1();
+       dummy_1_neq_0();
+}
+
+static void dummy_1_eq_1(void)
 {
        test(1 == 1);
 }
 
-void dummy_1_neq_0(void)
+static void dummy_1_neq_0(void)
 {
        test(1 != 0);
 }
index 145fa45..c47f278 100644 (file)
@@ -9,17 +9,17 @@
 extern "C" {
 #endif
 
-void dummy_1_eq_1(void);
-void dummy_1_neq_0(void);
-void socket_dummy(void);
-void bind_dummy(void);
-void getsockname_dummy(void);
-void sendto_dummy(void);
-void recvfrom_dummy(void);
-void sendmsg_dummy(void);
-void recvmsg_dummy(void);
-void shutdown_dummy(void);
-void close_dummy(void);
+void test_dummy(void);
+void socket_test_suite(void);
+void bind_test_suite(void);
+void getsockname_test_suite(void);
+void getsockopt_test_suite(void);
+void sendto_test_suite(void);
+void recvfrom_test_suite(void);
+void sendmsg_test_suite(void);
+void recvmsg_test_suite(void);
+void shutdown_test_suite(void);
+void close_test_suite(void);
 
 /* TODO: fill with test function headers. */
 
index b3ee88e..27cabdf 100644 (file)
@@ -5,7 +5,15 @@
 #include "test_sw.h"
 #include "test.h"
 
-void bind_dummy(void)
+static void bind_dummy(void);
+
+void bind_test_suite(void)
+{
+       start_suite();
+       bind_dummy();
+}
+
+static void bind_dummy(void)
 {
        test(1 == 1);
 }
index 734bc43..11ad085 100644 (file)
@@ -5,7 +5,15 @@
 #include "test_sw.h"
 #include "test.h"
 
-void close_dummy(void)
+static void close_dummy(void);
+
+void close_test_suite(void)
+{
+       start_suite();
+       close_dummy();
+}
+
+static void close_dummy(void)
 {
        test(1 == 1);
 }
index e93ec0e..597b699 100644 (file)
@@ -5,7 +5,15 @@
 #include "test_sw.h"
 #include "test.h"
 
-void getsockname_dummy(void)
+static void getsockname_dummy(void);
+
+void getsockname_test_suite(void)
+{
+       start_suite();
+       getsockname_dummy();
+}
+
+static void getsockname_dummy(void)
 {
        test(1 == 1);
 }
index e727802..bce215c 100644 (file)
@@ -5,7 +5,15 @@
 #include "test_sw.h"
 #include "test.h"
 
-void getsockopt_dummy(void)
+static void getsockopt_dummy(void);
+
+void getsockopt_test_suite(void)
+{
+       start_suite();
+       getsockopt_dummy();
+}
+
+static void getsockopt_dummy(void)
 {
        test(1 == 1);
 }
index aec8cf1..031b839 100644 (file)
@@ -5,7 +5,15 @@
 #include "test_sw.h"
 #include "test.h"
 
-void recvfrom_dummy(void)
+static void recvfrom_dummy(void);
+
+void recvfrom_test_suite(void)
+{
+       start_suite();
+       recvfrom_dummy();
+}
+
+static void recvfrom_dummy(void)
 {
        test(1 == 1);
 }
index 8d07d18..0a25e2f 100644 (file)
@@ -5,7 +5,15 @@
 #include "test_sw.h"
 #include "test.h"
 
-void recvmsg_dummy(void)
+static void recvmsg_dummy(void);
+
+void recvmsg_test_suite(void)
+{
+       start_suite();
+       recvmsg_dummy();
+}
+
+static void recvmsg_dummy(void) 
 {
        test(1 == 1);
 }
index 9be7d22..67348e1 100644 (file)
@@ -5,7 +5,15 @@
 #include "test_sw.h"
 #include "test.h"
 
-void sendmsg_dummy(void)
+static void sendmsg_dummy(void);
+
+void sendmsg_test_suite(void)
+{
+       start_suite();
+       sendmsg_dummy();
+}
+
+static void sendmsg_dummy(void)
 {
        test(1 == 1);
 }
index 97f8d29..2204d34 100644 (file)
@@ -5,7 +5,15 @@
 #include "test_sw.h"
 #include "test.h"
 
-void sendto_dummy(void)
+static void sendto_dummy(void);
+
+void sendto_test_suite(void)
+{
+       start_suite();
+       sendto_dummy();
+}
+
+static void sendto_dummy(void)
 {
        test(1 == 1);
 }
index 0777d80..93df05a 100644 (file)
@@ -5,7 +5,15 @@
 #include "test_sw.h"
 #include "test.h"
 
-void shutdown_dummy(void)
+static void shutdown_dummy(void);
+
+void shutdown_test_suite(void)
 {
-       test(1 == 1);
+       start_suite();
+       shutdown_dummy();
 }
+
+static void shutdown_dummy(void) 
+{
+       test(1 == 1);
+}      
index 89d4baa..c6f3f83 100644 (file)
@@ -5,7 +5,15 @@
 #include "test_sw.h"
 #include "test.h"
 
-void socket_dummy(void)
+static void socket_dummy(void);
+
+void socket_test_suite(void)
+{
+       start_suite();
+       socket_dummy();
+}
+
+static void socket_dummy(void)
 {
        test(1 == 1);
 }