]> rtime.felk.cvut.cz Git - frescor/frsh-forb.git/blobdiff - src/forb/src/tests/discovery.c
forb: Convert some older tests to wvtest framework
[frescor/frsh-forb.git] / src / forb / src / tests / discovery.c
index 48b0a0888e7f7d790683db917d6cf4a44e70126c..51cf6fedd5f1caa2a59d3487c756eb2b5585f8ad 100644 (file)
@@ -66,6 +66,7 @@
 #include <error.h>
 #include <fosa.h>
 #include <stdio.h>
+#include <wvtest.h>
 
 #define NUM_ORBS 5
 
 #error This test should only work if there is some local protocol enabled.
 #endif
 
-int main(int argc, char *argv[])
+WVTEST_MAIN("Automatic discovery of FORB servers")
 {
+#ifndef CONFIG_FORB_PROTO_INET_DEFAULT
        forb_orb orb[NUM_ORBS];
        int i;
        bool all_peers_found = true;
        fosa_abs_time_t timeout;
 
-       for (i=0; i<NUM_ORBS; i++) {
-               orb[i] = forb_init(&argc, &argv, NULL);
-               if (!orb[i]) {
-                       error(1, errno, "Orb no. %d was not created\n", i);
-               }
-       }
+       for (i=0; i<NUM_ORBS; i++)
+               WVPASS(orb[i] = forb_init(0, NULL, NULL));
 
        fosa_clock_get_time(FOSA_CLOCK_ABSOLUTE, &timeout);
        timeout = fosa_abs_time_incr(timeout,
@@ -97,9 +95,9 @@ int main(int argc, char *argv[])
                forb_peer_t *peer;
                for (j=0; j<NUM_ORBS && all_peers_found; j++) {
                        if (i==j) continue;
-                       peer = forb_peer_find_timed(forb_data(orb[i]),
-                                                   &forb_data(orb[j])->server_id,
-                                                   &timeout);
+                       WVPASS(peer = forb_peer_find_timed(forb_data(orb[i]),
+                                                          &forb_data(orb[j])->server_id,
+                                                          &timeout));
 
                        all_peers_found &= (peer != NULL);
                        if (!all_peers_found) {
@@ -112,7 +110,5 @@ int main(int argc, char *argv[])
                        }
                }
        }
-
-       printf("OK\n");
-       return 0;
+#endif
 }