From: Andy Zhou Date: Mon, 31 Mar 2014 01:20:07 +0000 (-0700) Subject: unit-test: merge test-heap into ovstest X-Git-Tag: sliver-openvswitch-2.2.90-1~6^2~1 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=a8513c7db801f7b87d241ca6c9a1eec832668983 unit-test: merge test-heap into ovstest Modify test-heap.c to use ovstest framework. Signed-off-by: Andy Zhou Acked-by: Ben Pfaff --- diff --git a/tests/automake.mk b/tests/automake.mk index fc584d612..6c59c6eb6 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 4e6e8ff1d..5267564b1 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 ccb14846a..3e0940ca6 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 @@ -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);