tools/perf/scripts_smoke_unittest.py
def testRunPerformanceTestsTelemetry_NoTestResults(self):
    """Test that test results output gets returned for complete failures."""
    tempdir = tempfile.mkdtemp()
    benchmarks = ['benchmark1', 'benchmark2']
    return_code, stdout = self.RunPerfScript(
        '../../testing/scripts/run_performance_tests.py '
        '../../tools/perf/testdata/fail_and_do_nothing '
        '--benchmarks=%s '
        '--browser=%s '
        '--isolated-script-test-output=%s' % (
            ','.join(benchmarks),
            self.options.browser_type,
            os.path.join(tempdir, 'output.json')
        ))
    self.assertNotEqual(return_code, 0)
    try:
      with open(os.path.join(tempdir, 'output.json')) as f:
        test_results = json.load(f)
        self.assertIsNotNone(
            test_results, 'json_test_results should be populated: ' + stdout)
        self.assertTrue(
            test_results['interrupted'],
            'if the benchmark does not populate test results, then we should '
            'populate it with a failure.')
      for benchmark in benchmarks:
        with open(os.path.join(tempdir, benchmark, 'test_results.json')) as f:
          test_results = json.load(f)
          self.assertIsNotNone(
              test_results, 'json_test_results should be populated: ' + stdout)
          self.assertTrue(
              test_results['interrupted'],
              'if the benchmark does not populate test results, then we should '
              'populate it with a failure.')
    except IOError as e:
      self.fail('json_test_results should be populated: ' + stdout + str(e))
    finally:
      shutil.rmtree(tempdir)
Test that test results output gets returned for complete failures.
Test that test results output gets returned for complete failures.
Test that test results output gets returned for complete failures .
def testRunPerformanceTestsTelemetry_NoTestResults(self):
    tempdir = tempfile.mkdtemp()
    benchmarks = ['benchmark1', 'benchmark2']
    return_code, stdout = self.RunPerfScript(
        '../../testing/scripts/run_performance_tests.py '
        '../../tools/perf/testdata/fail_and_do_nothing '
        '--benchmarks=%s '
        '--browser=%s '
        '--isolated-script-test-output=%s' % (
            ','.join(benchmarks),
            self.options.browser_type,
            os.path.join(tempdir, 'output.json')
        ))
    self.assertNotEqual(return_code, 0)
    try:
      with open(os.path.join(tempdir, 'output.json')) as f:
        test_results = json.load(f)
        self.assertIsNotNone(
            test_results, 'json_test_results should be populated: ' + stdout)
        self.assertTrue(
            test_results['interrupted'],
            'if the benchmark does not populate test results, then we should '
            'populate it with a failure.')
      for benchmark in benchmarks:
        with open(os.path.join(tempdir, benchmark, 'test_results.json')) as f:
          test_results = json.load(f)
          self.assertIsNotNone(
              test_results, 'json_test_results should be populated: ' + stdout)
          self.assertTrue(
              test_results['interrupted'],
              'if the benchmark does not populate test results, then we should '
              'populate it with a failure.')
    except IOError as e:
      self.fail('json_test_results should be populated: ' + stdout + str(e))
    finally:
      shutil.rmtree(tempdir)
def testRunPerformanceTestsTelemetry_NoTestResults ( self ) : tempdir = tempfile . mkdtemp ( ) benchmarks = [ 'benchmark1' , 'benchmark2' ] return_code , stdout = self . RunPerfScript ( '../../testing/scripts/run_performance_tests.py ' '../../tools/perf/testdata/fail_and_do_nothing ' '--benchmarks=%s ' '--browser=%s ' '--isolated-script-test-output=%s' % ( ',' . join ( benchmarks ) , self . options . browser_type , os . path . join ( tempdir , 'output.json' ) ) ) self . assertNotEqual ( return_code , 0 ) try : with open ( os . path . join ( tempdir , 'output.json' ) ) as f : test_results = json . load ( f ) self . assertIsNotNone ( test_results , 'json_test_results should be populated: ' + stdout ) self . assertTrue ( test_results [ 'interrupted' ] , 'if the benchmark does not populate test results, then we should ' 'populate it with a failure.' ) for benchmark in benchmarks : with open ( os . path . join ( tempdir , benchmark , 'test_results.json' ) ) as f : test_results = json . load ( f ) self . assertIsNotNone ( test_results , 'json_test_results should be populated: ' + stdout ) self . assertTrue ( test_results [ 'interrupted' ] , 'if the benchmark does not populate test results, then we should ' 'populate it with a failure.' ) except IOError as e : self . fail ( 'json_test_results should be populated: ' + stdout + str ( e ) ) finally : shutil . rmtree ( tempdir )
Test that test results output gets returned for complete failures.
Test that test results output gets returned for complete failures .
"""Test that test results output gets returned for complete failures."""
self