def load_tests(loader, standard_tests, pattern): del loader, standard_tests, pattern # unused suite = progress_reporter.TestSuite() benchmarks_dir = os.path.dirname(__file__) top_level_dir = os.path.dirname(benchmarks_dir) # Using the default of |index_by_class_name=False| means that if a module # has multiple benchmarks, only the last one is returned. all_benchmarks = discover.DiscoverClasses( benchmarks_dir, top_level_dir, benchmark_module.Benchmark, index_by_class_name=False).values() for benchmark in all_benchmarks: if sys.modules[benchmark.__module__] in _BLACK_LIST_TEST_MODULES: continue # TODO(tonyg): Smoke doesn't work with session_restore yet. if (benchmark.Name().startswith('session_restore') or benchmark.Name().startswith('skpicture_printer')): continue if hasattr(benchmark, 'generated_profile_archive'): # We'd like to test these, but don't know how yet. continue class BenchmarkSmokeTest(unittest.TestCase): pass method = SmokeTestGenerator(benchmark) # Make sure any decorators are propagated from the original declaration. # (access to protected members) pylint: disable=W0212 # TODO(dpranke): Since we only pick the first test from every class # (above), if that test is disabled, we'll end up not running *any* # test from the class. We should probably discover all of the tests # in a class, and then throw the ones we don't need away instead. # Merge decorators. for attribute in ['_enabled_strings', '_disabled_strings']: # Do set union of attributes to eliminate duplicates. merged_attributes = list( set( getattr(method, attribute, []) + getattr(benchmark, attribute, []))) if merged_attributes: setattr(method, attribute, merged_attributes) # Handle the case where the benchmark is Enabled/Disabled everywhere. if (getattr(method, attribute, None) == [] or getattr(benchmark, attribute, None) == []): setattr(method, attribute, []) setattr(BenchmarkSmokeTest, benchmark.Name(), method) suite.addTest(BenchmarkSmokeTest(benchmark.Name())) return suite
def load_tests(_, _2, _3): suite = progress_reporter.TestSuite() benchmarks_dir = os.path.dirname(__file__) top_level_dir = os.path.dirname(benchmarks_dir) measurements_dir = os.path.join(top_level_dir, 'measurements') all_measurements = discover.DiscoverClasses(measurements_dir, top_level_dir, page_test.PageTest).values() # Using the default of |index_by_class_name=False| means that if a module # has multiple benchmarks, only the last one is returned. all_benchmarks = discover.DiscoverClasses( benchmarks_dir, top_level_dir, benchmark_module.Benchmark, index_by_class_name=False).values() for benchmark in all_benchmarks: if hasattr(benchmark, 'test') and benchmark.test not in all_measurements: # If the benchmark does not have a measurement, then it is not composable. # Ideally we'd like to test these as well, but the non-composable # benchmarks are usually long-running benchmarks. continue # TODO(tonyg): Smoke doesn't work with session_restore yet. if (benchmark.Name().startswith('session_restore') or benchmark.Name().startswith('skpicture_printer')): continue if hasattr(benchmark, 'generated_profile_archive'): # We'd like to test these, but don't know how yet. continue class BenchmarkSmokeTest(unittest.TestCase): pass method = SmokeTestGenerator(benchmark) # Make sure any decorators are propagated from the original declaration. # (access to protected members) pylint: disable=W0212 # TODO(dpranke): Since we only pick the first test from every class # (above), if that test is disabled, we'll end up not running *any* # test from the class. We should probably discover all of the tests # in a class, and then throw the ones we don't need away instead. if hasattr(benchmark, '_enabled_strings'): method._enabled_strings = benchmark._enabled_strings if hasattr(benchmark, '_disabled_strings'): method._disabled_strings = benchmark._disabled_strings setattr(BenchmarkSmokeTest, benchmark.Name(), method) suite.addTest(BenchmarkSmokeTest(benchmark.Name())) return suite
def load_tests(loader, standard_tests, pattern): del loader, standard_tests, pattern # unused suite = progress_reporter.TestSuite() _AddBenchmarkOptionsTests(suite) return suite
def load_tests(_, _2, _3): suite = progress_reporter.TestSuite() _AddBenchmarkOptionsTests(suite) return suite