unit-test: merge test-heap into ovstest
authorAndy Zhou <azhou@nicira.com>
Mon, 31 Mar 2014 01:20:07 +0000 (18:20 -0700)
committerAndy Zhou <azhou@nicira.com>
Tue, 1 Apr 2014 02:08:02 +0000 (19:08 -0700)
Modify test-heap.c to use ovstest framework.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
tests/automake.mk
tests/heap.at
tests/test-heap.c

index fc584d6..6c59c6e 100644 (file)
@@ -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
index 4e6e8ff..5267564 100644 (file)
@@ -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])
index ccb1484..3e0940c 100644 (file)
@@ -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);