Commit d31eb712 authored by Michael Lee's avatar Michael Lee Committed by facebook-github-bot-0

Remove extra `int main`s from unit tests.

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
parent bb5ed807
...@@ -93,9 +93,3 @@ INSTANTIATE_TEST_CASE_P( ...@@ -93,9 +93,3 @@ INSTANTIATE_TEST_CASE_P(
DifferentBufferSizes, DifferentBufferSizes,
FileGenBufferedTest, FileGenBufferedTest,
::testing::Values(0, 1, 2, 4, 8, 64, 4096)); ::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();
}
...@@ -361,9 +361,3 @@ TEST(StringGen, Batch) { ...@@ -361,9 +361,3 @@ TEST(StringGen, Batch) {
EXPECT_EQ(lines, from(chunks) | resplit('\n') | eachTo<std::string>() | EXPECT_EQ(lines, from(chunks) | resplit('\n') | eachTo<std::string>() |
batch(3) | rconcat | as<vector>()); batch(3) | rconcat | as<vector>());
} }
int main(int argc, char *argv[]) {
testing::InitGoogleTest(&argc, argv);
gflags::ParseCommandLineFlags(&argc, &argv, true);
return RUN_ALL_TESTS();
}
...@@ -385,10 +385,3 @@ TEST(IOBufQueue, AppendToString) { ...@@ -385,10 +385,3 @@ TEST(IOBufQueue, AppendToString) {
queue.appendToString(s); queue.appendToString(s);
EXPECT_EQ("hello world", 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();
}
...@@ -1233,10 +1233,3 @@ TEST(IOBuf, Managed) { ...@@ -1233,10 +1233,3 @@ TEST(IOBuf, Managed) {
writableStr(*buf2)[0] = 'x'; writableStr(*buf2)[0] = 'x';
EXPECT_EQ("jelloxorldhelloxorld", toString(*buf1)); EXPECT_EQ("jelloxorldhelloxorld", toString(*buf1));
} }
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
gflags::ParseCommandLineFlags(&argc, &argv, true);
return RUN_ALL_TESTS();
}
...@@ -223,9 +223,3 @@ TEST(ShutdownSocketSetTest, AbortiveKill) { ...@@ -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();
}
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <folly/AtomicStruct.h> #include <folly/AtomicStruct.h>
#include <gflags/gflags.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
using namespace folly; using namespace folly;
...@@ -68,9 +67,3 @@ TEST(AtomicStruct, size_selection) { ...@@ -68,9 +67,3 @@ TEST(AtomicStruct, size_selection) {
EXPECT_EQ(sizeof(AtomicStruct<S7>), 8); EXPECT_EQ(sizeof(AtomicStruct<S7>), 8);
EXPECT_EQ(sizeof(AtomicStruct<S8>), 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();
}
...@@ -19,13 +19,10 @@ ...@@ -19,13 +19,10 @@
#include <folly/DynamicConverter.h> #include <folly/DynamicConverter.h>
#include <algorithm> #include <algorithm>
#include <gflags/gflags.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <map> #include <map>
#include <vector> #include <vector>
#include <folly/Benchmark.h>
using namespace folly; using namespace folly;
using namespace folly::dynamicconverter_detail; using namespace folly::dynamicconverter_detail;
...@@ -364,12 +361,3 @@ TEST(DynamicConverter, errors) { ...@@ -364,12 +361,3 @@ TEST(DynamicConverter, errors) {
dynamic d2 = floatOver; dynamic d2 = floatOver;
EXPECT_THROW(convertTo<float>(d2), std::range_error); 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();
}
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <folly/dynamic.h> #include <folly/dynamic.h>
#include <boost/next_prior.hpp> #include <boost/next_prior.hpp>
#include <gflags/gflags.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
using folly::dynamic; using folly::dynamic;
...@@ -480,9 +479,3 @@ TEST(Dynamic, PrintNull) { ...@@ -480,9 +479,3 @@ TEST(Dynamic, PrintNull) {
ss << folly::dynamic(nullptr); ss << folly::dynamic(nullptr);
EXPECT_EQ("null", ss.str()); EXPECT_EQ("null", ss.str());
} }
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
gflags::ParseCommandLineFlags(&argc, &argv, true);
return RUN_ALL_TESTS();
}
...@@ -88,9 +88,3 @@ TEST(ExceptionTest, Simple) { ...@@ -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();
}
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#include <folly/FBString.h> #include <folly/FBString.h>
#include <folly/FBVector.h> #include <folly/FBVector.h>
#include <gflags/gflags.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <list> #include <list>
#include <map> #include <map>
...@@ -282,9 +280,3 @@ TEST(FBVector, shrink_to_fit_after_clear) { ...@@ -282,9 +280,3 @@ TEST(FBVector, shrink_to_fit_after_clear) {
EXPECT_EQ(fb1.size(), 0); EXPECT_EQ(fb1.size(), 0);
EXPECT_EQ(fb1.capacity(), 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();
}
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <folly/Benchmark.h>
#include <folly/String.h> #include <folly/String.h>
#include <folly/Subprocess.h> #include <folly/Subprocess.h>
#include <folly/experimental/io/FsUtil.h> #include <folly/experimental/io/FsUtil.h>
......
...@@ -21,10 +21,8 @@ ...@@ -21,10 +21,8 @@
#include <deque> #include <deque>
#include <glog/logging.h> #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/Range.h>
#include <folly/String.h> #include <folly/String.h>
...@@ -308,9 +306,3 @@ TEST(String, readFile) { ...@@ -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();
}
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <ratio> #include <ratio>
#include <thread> #include <thread>
#include <gflags/gflags.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <time.h> #include <time.h>
...@@ -207,9 +206,3 @@ TEST(Futex, basic_deterministic) { ...@@ -207,9 +206,3 @@ TEST(Futex, basic_deterministic) {
run_basic_tests<DeterministicAtomic>(); run_basic_tests<DeterministicAtomic>();
run_wait_until_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();
}
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <thread> #include <thread>
#include <unistd.h> #include <unistd.h>
#include <semaphore.h> #include <semaphore.h>
#include <gflags/gflags.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
using namespace folly; using namespace folly;
...@@ -216,9 +215,3 @@ TEST(IndexedMemPool, late_recycle) { ...@@ -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();
}
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <boost/next_prior.hpp> #include <boost/next_prior.hpp>
#include <folly/json.h> #include <folly/json.h>
#include <gflags/gflags.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
using folly::dynamic; using folly::dynamic;
...@@ -521,9 +520,3 @@ TEST(Json, PrintTo) { ...@@ -521,9 +520,3 @@ TEST(Json, PrintTo) {
PrintTo(value, &oss); PrintTo(value, &oss);
EXPECT_EQ(expected, oss.str()); EXPECT_EQ(expected, oss.str());
} }
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
gflags::ParseCommandLineFlags(&argc, &argv, true);
return RUN_ALL_TESTS();
}
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
#include <gflags/gflags.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(boost::intrusive_ptr); FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(boost::intrusive_ptr);
...@@ -715,10 +714,3 @@ TEST(MPMCQueue, queue_moving) { ...@@ -715,10 +714,3 @@ TEST(MPMCQueue, queue_moving) {
TEST(MPMCQueue, explicit_zero_capacity_fail) { TEST(MPMCQueue, explicit_zero_capacity_fail) {
ASSERT_THROW(MPMCQueue<int> cq(0), std::invalid_argument); 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();
}
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <folly/ScopeGuard.h> #include <folly/ScopeGuard.h>
#include <folly/Portability.h> #include <folly/Portability.h>
#include <gflags/gflags.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <glog/logging.h> #include <glog/logging.h>
...@@ -290,9 +289,3 @@ TEST(ScopeGuard, TEST_SCOPE_SUCCESS_THROW) { ...@@ -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();
}
...@@ -580,15 +580,3 @@ TEST(Singleton, MockTest) { ...@@ -580,15 +580,3 @@ TEST(Singleton, MockTest) {
// If serial_count value is the same, then singleton was not replaced. // If serial_count value is the same, then singleton was not replaced.
EXPECT_NE(serial_count_first, serial_count_mock); 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;
}
...@@ -14,10 +14,8 @@ ...@@ -14,10 +14,8 @@
* 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> #include <gtest/gtest.h>
using namespace folly; using namespace folly;
...@@ -118,12 +116,3 @@ TEST(Traits, has_member_type) { ...@@ -118,12 +116,3 @@ TEST(Traits, has_member_type) {
EXPECT_FALSE(bool(has_member_type_x<membership_no>::value)); EXPECT_FALSE(bool(has_member_type_x<membership_no>::value));
EXPECT_TRUE(bool(has_member_type_x<membership_yes>::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();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment