*/
#include <config.h>
+#undef NDEBUG
#include "bitmap.h"
+#include <assert.h>
+#include "command-line.h"
#include "ovstest.h"
#include "timeval.h"
-#include "command-line.h"
-
-#undef NDEBUG
-#include <assert.h>
enum { MAX_BITS = 20 * BITMAP_ULONG_BITS };
}
static void
-run_tests(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+run_tests(struct ovs_cmdl_context *ctx OVS_UNUSED)
{
run_test(test_bitmap_equal);
run_test(test_bitmap_scan);
}
static void
-run_benchmarks(int argc OVS_UNUSED, char *argv[])
+run_benchmarks(struct ovs_cmdl_context *ctx)
{
- int n_iter = strtol(argv[1], NULL, 10);
+ int n_iter = strtol(ctx->argv[1], NULL, 10);
struct timeval start;
xgettimeofday(&start);
printf("\n");
}
-static const struct command commands[] = {
- {"check", 0, 0, run_tests},
- {"benchmark", 1, 1, run_benchmarks},
- {NULL, 0, 0, NULL},
+static const struct ovs_cmdl_command commands[] = {
+ {"check", NULL, 0, 0, run_tests},
+ {"benchmark", NULL, 1, 1, run_benchmarks},
+ {NULL, NULL, 0, 0, NULL},
};
static void
test_bitmap_main(int argc, char *argv[])
{
+ struct ovs_cmdl_context ctx = {
+ .argc = argc - 1,
+ .argv = argv + 1,
+ };
+
set_program_name(argv[0]);
- run_command(argc - 1, argv + 1, commands);
+ ovs_cmdl_run_command(&ctx, commands);
}
OVSTEST_REGISTER("test-bitmap", test_bitmap_main);