Remove extra `int main`s from unit tests.
authorMichael Lee <mzlee@fb.com>
Mon, 22 Feb 2016 16:42:18 +0000 (08:42 -0800)
committerfacebook-github-bot-0 <folly-bot@fb.com>
Mon, 22 Feb 2016 17:20:28 +0000 (09:20 -0800)
Summary: test/common/TestMain.cpp should provide the necessary initialization.

Reviewed By: yfeldblum

Differential Revision: D2947245

fb-gh-sync-id: 75b9d241673667badf4dc8fb81285c60cbb8166a
shipit-source-id: 75b9d241673667badf4dc8fb81285c60cbb8166a

19 files changed:
folly/gen/test/FileTest.cpp
folly/gen/test/StringTest.cpp
folly/io/test/IOBufQueueTest.cpp
folly/io/test/IOBufTest.cpp
folly/io/test/ShutdownSocketSetTest.cpp
folly/test/AtomicStructTest.cpp
folly/test/DynamicConverterTest.cpp
folly/test/DynamicTest.cpp
folly/test/ExceptionTest.cpp
folly/test/FBVectorTest.cpp
folly/test/FileTest.cpp
folly/test/FileUtilTest.cpp
folly/test/FutexTest.cpp
folly/test/IndexedMemPoolTest.cpp
folly/test/JsonTest.cpp
folly/test/MPMCQueueTest.cpp
folly/test/ScopeGuardTest.cpp
folly/test/SingletonTest.cpp
folly/test/TraitsTest.cpp

index 5aefacead82bbb851a72744068188d7ef8ab27a0..a32714e096fa2f8061a02b2d799d2d7c6e0a2706 100644 (file)
@@ -93,9 +93,3 @@ INSTANTIATE_TEST_CASE_P(
     DifferentBufferSizes,
     FileGenBufferedTest,
     ::testing::Values(0, 1, 2, 4, 8, 64, 4096));
     DifferentBufferSizes,
     FileGenBufferedTest,
     ::testing::Values(0, 1, 2, 4, 8, 64, 4096));
-
-int main(int argc, char *argv[]) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index 15454be601b32f0175ba0560c734d1b6899d6052..65c79462013ec9053bbe8381f118bc1e5dc1221b 100644 (file)
@@ -361,9 +361,3 @@ TEST(StringGen, Batch) {
   EXPECT_EQ(lines, from(chunks) | resplit('\n') | eachTo<std::string>() |
                        batch(3) | rconcat | as<vector>());
 }
   EXPECT_EQ(lines, from(chunks) | resplit('\n') | eachTo<std::string>() |
                        batch(3) | rconcat | as<vector>());
 }
-
-int main(int argc, char *argv[]) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index f9bc9925450e88d3ec9b7b1d008b2337b18e437d..59066228c15b76993ea302e7c1896a605b0538fd 100644 (file)
@@ -385,10 +385,3 @@ TEST(IOBufQueue, AppendToString) {
   queue.appendToString(s);
   EXPECT_EQ("hello world", s);
 }
   queue.appendToString(s);
   EXPECT_EQ("hello world", s);
 }
-
-int main(int argc, char** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-
-  return RUN_ALL_TESTS();
-}
index db43be6be81d4b29602e7fde66baf8e96374280c..ca39013dd987580ab3d9ab0ebfcae6b8c6421afe 100644 (file)
@@ -1233,10 +1233,3 @@ TEST(IOBuf, Managed) {
   writableStr(*buf2)[0] = 'x';
   EXPECT_EQ("jelloxorldhelloxorld", toString(*buf1));
 }
   writableStr(*buf2)[0] = 'x';
   EXPECT_EQ("jelloxorldhelloxorld", toString(*buf1));
 }
-
-int main(int argc, char** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-
-  return RUN_ALL_TESTS();
-}
index 528783c7b0d56aa7a83262f5116d7982c7ff966e..88b9e9894af3490b84b99c36b4ec35699828ba55 100644 (file)
@@ -223,9 +223,3 @@ TEST(ShutdownSocketSetTest, AbortiveKill) {
 }
 
 }}  // namespaces
 }
 
 }}  // namespaces
-
-int main(int argc, char *argv[]) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index 3e54b875498834a0e0a0509e1c48986b7e419f4a..b6d0a07499a941f2c3fce65c3be7b395608aabf3 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <folly/AtomicStruct.h>
 
 
 #include <folly/AtomicStruct.h>
 
-#include <gflags/gflags.h>
 #include <gtest/gtest.h>
 
 using namespace folly;
 #include <gtest/gtest.h>
 
 using namespace folly;
@@ -68,9 +67,3 @@ TEST(AtomicStruct, size_selection) {
   EXPECT_EQ(sizeof(AtomicStruct<S7>), 8);
   EXPECT_EQ(sizeof(AtomicStruct<S8>), 8);
 }
   EXPECT_EQ(sizeof(AtomicStruct<S7>), 8);
   EXPECT_EQ(sizeof(AtomicStruct<S8>), 8);
 }
-
-int main(int argc, char** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index 625aff07449379f745b8612da9685ccd56a2e259..5c10d82474fa2ef26a6e3105bf3945ffcb9ee9e3 100644 (file)
 #include <folly/DynamicConverter.h>
 
 #include <algorithm>
 #include <folly/DynamicConverter.h>
 
 #include <algorithm>
-#include <gflags/gflags.h>
 #include <gtest/gtest.h>
 #include <map>
 #include <vector>
 
 #include <gtest/gtest.h>
 #include <map>
 #include <vector>
 
-#include <folly/Benchmark.h>
-
 using namespace folly;
 using namespace folly::dynamicconverter_detail;
 
 using namespace folly;
 using namespace folly::dynamicconverter_detail;
 
@@ -364,12 +361,3 @@ TEST(DynamicConverter, errors) {
   dynamic d2 = floatOver;
   EXPECT_THROW(convertTo<float>(d2), std::range_error);
 }
   dynamic d2 = floatOver;
   EXPECT_THROW(convertTo<float>(d2), std::range_error);
 }
-
-int main(int argc, char ** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  if (FLAGS_benchmark) {
-    folly::runBenchmarks();
-  }
-  return RUN_ALL_TESTS();
-}
index 7b85e5c47bdef0fe462e26ba28d0e5cc54d3209c..93034db8339b3b3a954f840b39f13746c5faf890 100644 (file)
@@ -17,7 +17,6 @@
 #include <folly/dynamic.h>
 
 #include <boost/next_prior.hpp>
 #include <folly/dynamic.h>
 
 #include <boost/next_prior.hpp>
-#include <gflags/gflags.h>
 #include <gtest/gtest.h>
 
 using folly::dynamic;
 #include <gtest/gtest.h>
 
 using folly::dynamic;
@@ -480,9 +479,3 @@ TEST(Dynamic, PrintNull) {
   ss << folly::dynamic(nullptr);
   EXPECT_EQ("null", ss.str());
 }
   ss << folly::dynamic(nullptr);
   EXPECT_EQ("null", ss.str());
 }
-
-int main(int argc, char** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index ad54cbb2881f946dc58485646399bef981af1afe..49232faad1294b1c75e5fa5e0d45e5c6f2037dbc 100644 (file)
@@ -88,9 +88,3 @@ TEST(ExceptionTest, Simple) {
 }
 
 }}  // namespaces
 }
 
 }}  // namespaces
-
-int main(int argc, char *argv[]) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index 4fadf2cdbff6763165fca98d156d838fe0b72782..ce4fa978bdcda3041d07e76be8766845c8d41334 100644 (file)
@@ -23,8 +23,6 @@
 #include <folly/FBString.h>
 #include <folly/FBVector.h>
 
 #include <folly/FBString.h>
 #include <folly/FBVector.h>
 
-#include <gflags/gflags.h>
-
 #include <gtest/gtest.h>
 #include <list>
 #include <map>
 #include <gtest/gtest.h>
 #include <list>
 #include <map>
@@ -282,9 +280,3 @@ TEST(FBVector, shrink_to_fit_after_clear) {
   EXPECT_EQ(fb1.size(), 0);
   EXPECT_EQ(fb1.capacity(), 0);
 }
   EXPECT_EQ(fb1.size(), 0);
   EXPECT_EQ(fb1.capacity(), 0);
 }
-
-int main(int argc, char** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index 2bed3c03aca066a8356a4beb6338f55a27e2fdf8..ffe0bc196c616396ac4ce151e0622ede2b119ca3 100644 (file)
@@ -22,7 +22,6 @@
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 
-#include <folly/Benchmark.h>
 #include <folly/String.h>
 #include <folly/Subprocess.h>
 #include <folly/experimental/io/FsUtil.h>
 #include <folly/String.h>
 #include <folly/Subprocess.h>
 #include <folly/experimental/io/FsUtil.h>
index adedc5226bd810b151f48f04bbe1b86285c41997..6a7f5e2ea57a759046629e5bc03527f4e54ddbc0 100644 (file)
 #include <deque>
 
 #include <glog/logging.h>
 #include <deque>
 
 #include <glog/logging.h>
-#include <gflags/gflags.h>
 #include <gtest/gtest.h>
 
 #include <gtest/gtest.h>
 
-#include <folly/Benchmark.h>
 #include <folly/Range.h>
 #include <folly/String.h>
 
 #include <folly/Range.h>
 #include <folly/String.h>
 
@@ -308,9 +306,3 @@ TEST(String, readFile) {
 }
 
 }}  // namespaces
 }
 
 }}  // namespaces
-
-int main(int argc, char *argv[]) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index 3348af3a75d660ba05c0d1ca0c3edbc25bc276f6..86682c5e9b6760bd447be1c3f410548658b2323b 100644 (file)
@@ -22,7 +22,6 @@
 #include <ratio>
 #include <thread>
 
 #include <ratio>
 #include <thread>
 
-#include <gflags/gflags.h>
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 #include <time.h>
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 #include <time.h>
@@ -207,9 +206,3 @@ TEST(Futex, basic_deterministic) {
   run_basic_tests<DeterministicAtomic>();
   run_wait_until_tests<DeterministicAtomic>();
 }
   run_basic_tests<DeterministicAtomic>();
   run_wait_until_tests<DeterministicAtomic>();
 }
-
-int main(int argc, char ** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index 606d9565abbb3ac16f34086c5def6020cf93ddf1..5c7a9733d297b8e0ba4526ebaf4de845bbf24368 100644 (file)
@@ -20,7 +20,6 @@
 #include <thread>
 #include <unistd.h>
 #include <semaphore.h>
 #include <thread>
 #include <unistd.h>
 #include <semaphore.h>
-#include <gflags/gflags.h>
 #include <gtest/gtest.h>
 
 using namespace folly;
 #include <gtest/gtest.h>
 
 using namespace folly;
@@ -216,9 +215,3 @@ TEST(IndexedMemPool, late_recycle) {
   }
   EXPECT_EQ(NonTrivialStruct::count, 0);
 }
   }
   EXPECT_EQ(NonTrivialStruct::count, 0);
 }
-
-int main(int argc, char** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index ec27a901605612c9b0b62cccc7d71e3775d8f061..185401691a6775c1cbc7d2b49214998f28b20da2 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <boost/next_prior.hpp>
 #include <folly/json.h>
 
 #include <boost/next_prior.hpp>
 #include <folly/json.h>
-#include <gflags/gflags.h>
 #include <gtest/gtest.h>
 
 using folly::dynamic;
 #include <gtest/gtest.h>
 
 using folly::dynamic;
@@ -521,9 +520,3 @@ TEST(Json, PrintTo) {
   PrintTo(value, &oss);
   EXPECT_EQ(expected, oss.str());
 }
   PrintTo(value, &oss);
   EXPECT_EQ(expected, oss.str());
 }
-
-int main(int argc, char** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index 6c7cf2581504d36b0f1920ae3b036cab8259e7a2..394b58381043410464be75661d755653bdcd567a 100644 (file)
@@ -28,7 +28,6 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 
 #include <sys/time.h>
 #include <sys/resource.h>
 
-#include <gflags/gflags.h>
 #include <gtest/gtest.h>
 
 FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(boost::intrusive_ptr);
 #include <gtest/gtest.h>
 
 FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(boost::intrusive_ptr);
@@ -715,10 +714,3 @@ TEST(MPMCQueue, queue_moving) {
 TEST(MPMCQueue, explicit_zero_capacity_fail) {
   ASSERT_THROW(MPMCQueue<int> cq(0), std::invalid_argument);
 }
 TEST(MPMCQueue, explicit_zero_capacity_fail) {
   ASSERT_THROW(MPMCQueue<int> cq(0), std::invalid_argument);
 }
-
-
-int main(int argc, char ** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index 790484f9eff5314b548a8de0c0d0888d6ead425c..5310eff765af8c001d3b6520b1ceff7982c83f5f 100644 (file)
@@ -17,7 +17,6 @@
 #include <folly/ScopeGuard.h>
 #include <folly/Portability.h>
 
 #include <folly/ScopeGuard.h>
 #include <folly/Portability.h>
 
-#include <gflags/gflags.h>
 #include <gtest/gtest.h>
 #include <glog/logging.h>
 
 #include <gtest/gtest.h>
 #include <glog/logging.h>
 
@@ -290,9 +289,3 @@ TEST(ScopeGuard, TEST_SCOPE_SUCCESS_THROW) {
   };
   EXPECT_THROW(lambda(), std::runtime_error);
 }
   };
   EXPECT_THROW(lambda(), std::runtime_error);
 }
-
-int main(int argc, char** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  return RUN_ALL_TESTS();
-}
index 46463554e5ca49be56aa66b0c832d58cc179fc4f..b36b47091123d28b265683fc470faf7c506cfac0 100644 (file)
@@ -580,15 +580,3 @@ TEST(Singleton, MockTest) {
   // If serial_count value is the same, then singleton was not replaced.
   EXPECT_NE(serial_count_first, serial_count_mock);
 }
   // If serial_count value is the same, then singleton was not replaced.
   EXPECT_NE(serial_count_first, serial_count_mock);
 }
-
-int main(int argc, char* argv[]) {
-  testing::InitGoogleTest(&argc, argv);
-  google::InitGoogleLogging(argv[0]);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-
-  SingletonVault::singleton()->registrationComplete();
-
-  auto ret = RUN_ALL_TESTS();
-
-  return ret;
-}
index 80fb220579f05fe191bf7fa8e2a8742e1a3179fb..c76f1daa4e5628e3a15cb27f9e272494287de2a9 100644 (file)
  * limitations under the License.
  */
 
  * limitations under the License.
  */
 
-#include <folly/Benchmark.h>
 #include <folly/Traits.h>
 
 #include <folly/Traits.h>
 
-#include <gflags/gflags.h>
 #include <gtest/gtest.h>
 
 using namespace folly;
 #include <gtest/gtest.h>
 
 using namespace folly;
@@ -118,12 +116,3 @@ TEST(Traits, has_member_type) {
   EXPECT_FALSE(bool(has_member_type_x<membership_no>::value));
   EXPECT_TRUE(bool(has_member_type_x<membership_yes>::value));
 }
   EXPECT_FALSE(bool(has_member_type_x<membership_no>::value));
   EXPECT_TRUE(bool(has_member_type_x<membership_yes>::value));
 }
-
-int main(int argc, char ** argv) {
-  testing::InitGoogleTest(&argc, argv);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-  if (FLAGS_benchmark) {
-    folly::runBenchmarks();
-  }
-  return RUN_ALL_TESTS();
-}