X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Ftest-lockfile.c;h=0bf3fe6dd1529ba7729059470a676fc5fbef5c2f;hb=0ef165ecb57943e17a8ee8270df68ffb8d032e29;hp=fe258c24922a0c2b44183c24738af23c201f8a7a;hpb=db90f94066dc645d8e777a9c43ad3f7e745393f9;p=sliver-openvswitch.git diff --git a/tests/test-lockfile.c b/tests/test-lockfile.c index fe258c249..0bf3fe6dd 100644 --- a/tests/test-lockfile.c +++ b/tests/test-lockfile.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 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. @@ -28,13 +28,14 @@ #include "timeval.h" #include "util.h" #include "vlog.h" +#include "ovstest.h" struct test { const char *name; void (*function)(void); }; -static const struct test tests[]; +static void run_help(void); #define CHECK(A, B) check(A, B, #A, #B, __FILE__, __LINE__) static void @@ -96,7 +97,6 @@ do_fork(void) { switch (fork()) { case 0: - time_postfork(); lockfile_postfork(); return CHILD; @@ -237,19 +237,6 @@ run_lock_symlink_to_dir(void) lockfile_unlock(a); } -static void -run_help(void) -{ - size_t i; - - printf("usage: %s TESTNAME\n" - "where TESTNAME is one of the following:\n", - program_name); - for (i = 0; tests[i].name; i++) { - fprintf(stderr, "\t%s\n", tests[i].name); - } -} - static const struct test tests[] = { #define TEST(NAME) { #NAME, run_##NAME } TEST(lock_and_unlock), @@ -267,8 +254,21 @@ static const struct test tests[] = { #undef TEST }; -int -main(int argc, char *argv[]) +static void +run_help(void) +{ + size_t i; + + printf("usage: %s TESTNAME\n" + "where TESTNAME is one of the following:\n", + program_name); + for (i = 0; tests[i].name; i++) { + fprintf(stderr, "\t%s\n", tests[i].name); + } +} + +static void +test_lockfile_main(int argc, char *argv[]) { size_t i; @@ -279,7 +279,6 @@ main(int argc, char *argv[]) if (argc != 2) { ovs_fatal(0, "exactly one argument required; use \"%s help\" for help", program_name); - return 1; } for (i = 0; tests[i].name; i++) { @@ -311,3 +310,4 @@ main(int argc, char *argv[]) argv[1], program_name); } +OVSTEST_REGISTER("test-lockfile", test_lockfile_main);