this repo has no description
at trunk 34 lines 1.1 kB view raw
1// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) 2#include "benchmark/benchmark.h" 3#include "gtest/gtest.h" 4 5extern std::string FLAGS_benchmark_filter; 6 7namespace py { 8namespace testing { 9extern const char* argv0; 10} // namespace testing 11} // namespace py 12 13// CPython leaks when Py_Initialize is called multiple times: 14// https://bugs.python.org/issue1635741 15extern "C" const char* __asan_default_options() { return "detect_leaks=0"; } 16 17int main(int argc, char* argv[]) { 18 // Run benchmarks instead of tests if there was a --benchmark_filter argument. 19 FLAGS_benchmark_filter.clear(); 20 benchmark::Initialize(&argc, argv); 21 if (!FLAGS_benchmark_filter.empty()) { 22 return (benchmark::RunSpecifiedBenchmarks() == 0); 23 } 24 25 py::testing::argv0 = argv[0]; 26 testing::InitGoogleTest(&argc, argv); 27 // Skip all tests whose name ends in "Pyro". 28 if (testing::GTEST_FLAG(filter).find('-') == std::string::npos) { 29 testing::GTEST_FLAG(filter) += "-*Pyro"; 30 } else { 31 testing::GTEST_FLAG(filter) += ":*Pyro"; 32 } 33 return RUN_ALL_TESTS(); 34}