ofproto: Fix memory leak and memory exhaustion bugs in group_mod.
[cascardo/ovs.git] / tests / ovstest.h
index b4aad1b..ddd7f3e 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "compiler.h"
 
+#include "command-line.h"
+
 /* Overview
  * ========
  *
@@ -32,7 +34,7 @@
  * ovstest.
  *
  * With ovstest, each test programs now becomes a sub program of ovstest.
- * For example, 'mytest' program, can now be invoked as 'ovs mytest'.
+ * For example, 'mytest' program, can now be invoked as 'ovstest mytest'.
  *
  * 'ovstest --help' will list all test programs can be invoked.
  *
@@ -41,7 +43,8 @@
  */
 
 typedef void (*ovstest_func)(int argc, char *argv[]);
-void ovstest_register(const char *test_name, ovstest_func f);
+
+void ovstest_register(const char *test_name, ovs_cmdl_handler f);
 
 /* Usage
  * =====
@@ -72,8 +75,13 @@ void ovstest_register(const char *test_name, ovstest_func f);
  * OVSTEST_REGISTER("my-test", my_test_main);
  */
 #define OVSTEST_REGISTER(name, function) \
+    static void \
+    ovstest_wrapper_##function##__(struct ovs_cmdl_context *ctx) \
+    { \
+        function(ctx->argc, ctx->argv); \
+    } \
     OVS_CONSTRUCTOR(register_##function) { \
-        ovstest_register(name, function); \
+        ovstest_register(name, ovstest_wrapper_##function##__); \
     }
 
 #endif