vlog: Rename the currently used term 'facility' as 'destination'.
[cascardo/ovs.git] / tests / test-reconnect.c
index d3ff6e8..7d39339 100644 (file)
  */
 
 #include <config.h>
-
+#undef NDEBUG
 #include "reconnect.h"
-
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-
 #include "command-line.h"
 #include "compiler.h"
+#include "ovstest.h"
 #include "svec.h"
 #include "util.h"
-#include "vlog.h"
-#include "ovstest.h"
+#include "openvswitch/vlog.h"
 
 static struct reconnect *reconnect;
 static int now;
 
-static const struct command commands[];
-
 static void diff_stats(const struct reconnect_stats *old,
                        const struct reconnect_stats *new,
                        int delta);
+static const struct command *get_all_commands(void);
 
 static void
 test_reconnect_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
@@ -48,7 +45,7 @@ test_reconnect_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
     int old_time;
     char line[128];
 
-    vlog_set_levels(&VLM_reconnect, VLF_ANY_FACILITY, VLL_OFF);
+    vlog_set_levels(&VLM_reconnect, VLF_ANY_DESTINATION, VLL_OFF);
 
     now = 1000;
     reconnect = reconnect_create(now);
@@ -70,7 +67,7 @@ test_reconnect_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
         svec_parse_words(&args, line);
         svec_terminate(&args);
         if (!svec_is_empty(&args)) {
-            run_command(args.n, args.names, commands);
+            run_command(args.n, args.names, get_all_commands());
         }
         svec_destroy(&args);
 
@@ -271,23 +268,29 @@ do_listen_error(int argc OVS_UNUSED, char *argv[])
     reconnect_listen_error(reconnect, now, atoi(argv[1]));
 }
 
-static const struct command commands[] = {
-    { "enable", 0, 0, do_enable },
-    { "disable", 0, 0, do_disable },
-    { "force-reconnect", 0, 0, do_force_reconnect },
-    { "disconnected", 0, 1, do_disconnected },
-    { "connecting", 0, 0, do_connecting },
-    { "connect-failed", 0, 1, do_connect_failed },
-    { "connected", 0, 0, do_connected },
-    { "activity", 0, 0, do_activity },
-    { "run", 0, 1, do_run },
-    { "advance", 1, 1, do_advance },
-    { "timeout", 0, 0, do_timeout },
-    { "set-max-tries", 1, 1, do_set_max_tries },
-    { "passive", 0, 0, do_set_passive },
-    { "listening", 0, 0, do_listening },
-    { "listen-error", 1, 1, do_listen_error },
-    { NULL, 0, 0, NULL },
+static const struct command all_commands[] = {
+    { "enable", NULL, 0, 0, do_enable },
+    { "disable", NULL, 0, 0, do_disable },
+    { "force-reconnect", NULL, 0, 0, do_force_reconnect },
+    { "disconnected", NULL, 0, 1, do_disconnected },
+    { "connecting", NULL, 0, 0, do_connecting },
+    { "connect-failed", NULL, 0, 1, do_connect_failed },
+    { "connected", NULL, 0, 0, do_connected },
+    { "activity", NULL, 0, 0, do_activity },
+    { "run", NULL, 0, 1, do_run },
+    { "advance", NULL, 1, 1, do_advance },
+    { "timeout", NULL, 0, 0, do_timeout },
+    { "set-max-tries", NULL, 1, 1, do_set_max_tries },
+    { "passive", NULL, 0, 0, do_set_passive },
+    { "listening", NULL, 0, 0, do_listening },
+    { "listen-error", NULL, 1, 1, do_listen_error },
+    { NULL, NULL, 0, 0, NULL },
 };
 
+static const struct command *
+get_all_commands(void)
+{
+    return all_commands;
+}
+
 OVSTEST_REGISTER("test-reconnect", test_reconnect_main);