def _RunGpuIntegrationTests(self, test_name, extra_args=None): extra_args = extra_args or [] temp_file = tempfile.NamedTemporaryFile(delete=False) temp_file.close() try: sys.argv = [ run_gpu_integration_test.__file__, test_name, '--write-full-results-to=%s' % temp_file.name, ] + extra_args gpu_project_config.CONFIG = chromium_config.ChromiumConfig( top_level_dir=path_util.GetGpuTestDir(), benchmark_dirs=[ os.path.join(path_util.GetGpuTestDir(), 'unittest_data')]) run_gpu_integration_test.main() with open(temp_file.name) as f: self._test_result = json.load(f) finally: temp_file.close()
def testTestNamePrefixGenerationInRunGpuIntegrationTests(self): temp_file = tempfile.NamedTemporaryFile(delete=False) temp_file.close() try: sys.argv = [ run_gpu_integration_test.__file__, 'simple_integration_unittest', '--write-full-results-to=%s' % temp_file.name ] gpu_project_config.CONFIG = chromium_config.ChromiumConfig( top_level_dir=path_util.GetGpuTestDir(), benchmark_dirs=[ os.path.join(path_util.GetGpuTestDir(), 'unittest_data') ]) run_gpu_integration_test.main() with open(temp_file.name) as f: results = json.load(f) self.assertIn('expected_failure', results['tests']) self.assertEqual(results['test_name_prefix'], 'unittest_data.integration_tests.SimpleTest.') finally: temp_file.close()