Modify test-heap.c to use ovstest framework.
Signed-off-by: Andy Zhou <[email protected]>
---
v1-v2: Coding style fixes
---
tests/automake.mk | 8 ++------
tests/heap.at | 2 +-
tests/test-heap.c | 12 +++++++-----
3 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/tests/automake.mk b/tests/automake.mk
index fc584d6..6c59c6e 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -109,7 +109,6 @@ valgrind_wrappers = \
tests/valgrind/test-file_name \
tests/valgrind/test-flows \
tests/valgrind/test-hash \
- tests/valgrind/test-heap \
tests/valgrind/test-hindex \
tests/valgrind/test-hmap \
tests/valgrind/test-json \
@@ -220,10 +219,6 @@ noinst_PROGRAMS += tests/test-hash
tests_test_hash_SOURCES = tests/test-hash.c
tests_test_hash_LDADD = lib/libopenvswitch.la
-noinst_PROGRAMS += tests/test-heap
-tests_test_heap_SOURCES = tests/test-heap.c
-tests_test_heap_LDADD = lib/libopenvswitch.la
-
noinst_PROGRAMS += tests/test-hindex
tests_test_hindex_SOURCES = tests/test-hindex.c
tests_test_hindex_LDADD = lib/libopenvswitch.la
@@ -300,7 +295,8 @@ tests/idltest.c: tests/idltest.h
noinst_PROGRAMS += tests/ovstest
tests_ovstest_SOURCES = tests/ovstest.c \
- tests/ovstest.h
+ tests/ovstest.h \
+ tests/test-heap.c
tests_ovstest_LDADD = lib/libopenvswitch.la
noinst_PROGRAMS += tests/test-reconnect
diff --git a/tests/heap.at b/tests/heap.at
index 4e6e8ff..5267564 100644
--- a/tests/heap.at
+++ b/tests/heap.at
@@ -2,7 +2,7 @@ AT_BANNER([heap library])
m4_define([TEST_HEAP],
[AT_SETUP([heap library -- m4_bpatsubst([$1], [-], [ ])])
- AT_CHECK([test-heap $1])
+ AT_CHECK([ovstest test-heap $1])
AT_CLEANUP])
TEST_HEAP([insert-delete-same-order])
diff --git a/tests/test-heap.c b/tests/test-heap.c
index ccb1484..dfb0981 100644
--- a/tests/test-heap.c
+++ b/tests/test-heap.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 Nicira, Inc.
+ * Copyright (c) 2012, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
#include "command-line.h"
#include "random.h"
#include "util.h"
+#include "ovstest.h"
#undef NDEBUG
#include <assert.h>
@@ -473,14 +474,15 @@ static const struct command commands[] = {
test_heap_insert_delete_same_order_with_dups, },
{ "raw-insert", 0, 0, test_heap_raw_insert, },
{ "raw-delete", 0, 0, test_heap_raw_delete, },
+ { NULL, 0, 0, NULL, },
};
-int
-main(int argc, char *argv[])
+static void
+test_heap_main(int argc, char *argv[])
{
set_program_name(argv[0]);
run_command(argc - 1, argv + 1, commands);
-
- return 0;
}
+
+OVSTEST_REGISTER(test-heap, test_heap_main, commands);
--
1.7.9.5
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev