diff options
author | Geir Storli <geirst@verizonmedia.com> | 2019-02-22 15:02:56 +0000 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2019-02-22 15:02:56 +0000 |
commit | 218640e48925608f019bc10bc17a52b6fe56ec47 (patch) | |
tree | 047e0b5f391988c814ad1abf5ddca5c2230fb330 | |
parent | a56fbe36bd898a24c8e5a30b6988a8e76192bf91 (diff) |
Reduce code duplication in gtest runners.
-rw-r--r-- | document/src/tests/gtest_runner.cpp | 10 | ||||
-rw-r--r-- | metrics/src/tests/gtest_runner.cpp | 10 | ||||
-rw-r--r-- | staging_vespalib/src/vespa/vespalib/gtest/gtest.h | 14 | ||||
-rw-r--r-- | storage/src/tests/gtest_runner.cpp | 10 | ||||
-rw-r--r-- | storageapi/src/tests/gtest_runner.cpp | 10 | ||||
-rw-r--r-- | storageframework/src/tests/gtest_runner.cpp | 10 | ||||
-rw-r--r-- | vdslib/src/tests/gtest_runner.cpp | 10 |
7 files changed, 26 insertions, 48 deletions
diff --git a/document/src/tests/gtest_runner.cpp b/document/src/tests/gtest_runner.cpp index efe108c2042..fed042acceb 100644 --- a/document/src/tests/gtest_runner.cpp +++ b/document/src/tests/gtest_runner.cpp @@ -1,14 +1,8 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <gtest/gtest.h> +#include <vespa/vespalib/gtest/gtest.h> #include <vespa/log/log.h> LOG_SETUP("document_gtest_runner"); -int -main(int argc, char* argv[]) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} - +GTEST_MAIN_RUN_ALL_TESTS diff --git a/metrics/src/tests/gtest_runner.cpp b/metrics/src/tests/gtest_runner.cpp index 35475ba19a9..2f0e0705792 100644 --- a/metrics/src/tests/gtest_runner.cpp +++ b/metrics/src/tests/gtest_runner.cpp @@ -1,14 +1,8 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <gtest/gtest.h> +#include <vespa/vespalib/gtest/gtest.h> #include <vespa/log/log.h> LOG_SETUP("metrics_gtest_runner"); -int -main(int argc, char* argv[]) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} - +GTEST_MAIN_RUN_ALL_TESTS diff --git a/staging_vespalib/src/vespa/vespalib/gtest/gtest.h b/staging_vespalib/src/vespa/vespalib/gtest/gtest.h new file mode 100644 index 00000000000..ed4e65b71cb --- /dev/null +++ b/staging_vespalib/src/vespa/vespalib/gtest/gtest.h @@ -0,0 +1,14 @@ +// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include <gtest/gtest.h> + +/** + * Macro for creating a main function that runs all gtests. + */ +#define GTEST_MAIN_RUN_ALL_TESTS \ +int \ +main(int argc, char* argv[]) \ +{ \ + ::testing::InitGoogleTest(&argc, argv); \ + return RUN_ALL_TESTS(); \ +} diff --git a/storage/src/tests/gtest_runner.cpp b/storage/src/tests/gtest_runner.cpp index f3400187ff4..762f6dba6db 100644 --- a/storage/src/tests/gtest_runner.cpp +++ b/storage/src/tests/gtest_runner.cpp @@ -1,14 +1,8 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <gtest/gtest.h> +#include <vespa/vespalib/gtest/gtest.h> #include <vespa/log/log.h> LOG_SETUP("storage_gtest_runner"); -int -main(int argc, char* argv[]) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} - +GTEST_MAIN_RUN_ALL_TESTS diff --git a/storageapi/src/tests/gtest_runner.cpp b/storageapi/src/tests/gtest_runner.cpp index c37be7231ac..d499a54af50 100644 --- a/storageapi/src/tests/gtest_runner.cpp +++ b/storageapi/src/tests/gtest_runner.cpp @@ -1,14 +1,8 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <gtest/gtest.h> +#include <vespa/vespalib/gtest/gtest.h> #include <vespa/log/log.h> LOG_SETUP("storageapi_gtest_runner"); -int -main(int argc, char* argv[]) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} - +GTEST_MAIN_RUN_ALL_TESTS diff --git a/storageframework/src/tests/gtest_runner.cpp b/storageframework/src/tests/gtest_runner.cpp index ce0310d7fa1..e9a1c9b1ed8 100644 --- a/storageframework/src/tests/gtest_runner.cpp +++ b/storageframework/src/tests/gtest_runner.cpp @@ -1,14 +1,8 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <gtest/gtest.h> +#include <vespa/vespalib/gtest/gtest.h> #include <vespa/log/log.h> LOG_SETUP("storageframework_gtest_runner"); -int -main(int argc, char* argv[]) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} - +GTEST_MAIN_RUN_ALL_TESTS diff --git a/vdslib/src/tests/gtest_runner.cpp b/vdslib/src/tests/gtest_runner.cpp index d10f7182c07..e200813ef61 100644 --- a/vdslib/src/tests/gtest_runner.cpp +++ b/vdslib/src/tests/gtest_runner.cpp @@ -1,14 +1,8 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <gtest/gtest.h> +#include <vespa/vespalib/gtest/gtest.h> #include <vespa/log/log.h> LOG_SETUP("vdslib_gtest_runner"); -int -main(int argc, char* argv[]) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} - +GTEST_MAIN_RUN_ALL_TESTS |