Commit a3c4f190 authored by Juan Antonio Navarro Perez's avatar Juan Antonio Navarro Perez Committed by Commit Bot

[tools/perf] Add more debug info to scripts smoke test

To debug testRunPerformanceTestsTelemetrySharded_end2end, add more
information and a better formatted output to help figure out the
cause of problems when things go wrong.

Also re-enable the test on linux to see if previous failures reoccur.

Bug: 996003
Change-Id: I86ed6ca3c03943674bc77483688ea24fa5193225
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1886680Reviewed-by: default avatarCaleb Rouleau <crouleau@chromium.org>
Commit-Queue: Juan Antonio Navarro Pérez <perezju@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711673}
parent f49052ad
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
import json import json
import logging
import os import os
import shutil import shutil
import subprocess import subprocess
...@@ -161,8 +162,7 @@ class ScriptsSmokeTest(unittest.TestCase): ...@@ -161,8 +162,7 @@ class ScriptsSmokeTest(unittest.TestCase):
# Android: crbug.com/932301 # Android: crbug.com/932301
# ChromeOS: crbug.com/754913 # ChromeOS: crbug.com/754913
# Linux: crbug.com/996003 @decorators.Disabled('chromeos', 'android')
@decorators.Disabled('chromeos', 'android', 'linux')
def testRunPerformanceTestsTelemetrySharded_end2end(self): def testRunPerformanceTestsTelemetrySharded_end2end(self):
tempdir = tempfile.mkdtemp() tempdir = tempfile.mkdtemp()
env = os.environ.copy() env = os.environ.copy()
...@@ -182,34 +182,39 @@ class ScriptsSmokeTest(unittest.TestCase): ...@@ -182,34 +182,39 @@ class ScriptsSmokeTest(unittest.TestCase):
self.options.browser_type, self.options.browser_type,
os.path.join(tempdir, 'output.json') os.path.join(tempdir, 'output.json')
), env=env) ), env=env)
self.assertEquals(return_code, 0, stdout) test_results = None
try: try:
self.assertEquals(return_code, 0)
expected_benchmark_folders = ( expected_benchmark_folders = (
'dummy_benchmark.stable_benchmark_1', 'dummy_benchmark.stable_benchmark_1',
'dummy_benchmark.stable_benchmark_1.reference') 'dummy_benchmark.stable_benchmark_1.reference')
with open(os.path.join(tempdir, 'output.json')) as f: with open(os.path.join(tempdir, 'output.json')) as f:
test_results = json.load(f) test_results = json.load(f)
self.assertIsNotNone(
test_results, 'json_test_results should be populated.')
test_repeats = test_results['num_failures_by_type']['PASS']
self.assertEqual(
test_repeats, 2, '--isolated-script-test-repeat=2 should work.')
for folder in expected_benchmark_folders:
with open(os.path.join(tempdir, folder, 'test_results.json')) as f:
test_results = json.load(f)
self.assertIsNotNone( self.assertIsNotNone(
test_results, 'json_test_results should be populated: ' + stdout) test_results, 'json test results should be populated.')
test_repeats = test_results['num_failures_by_type']['PASS'] test_repeats = test_results['num_failures_by_type']['PASS']
self.assertEqual( self.assertEqual(
test_repeats, 2, '--isolated-script-test-repeat=2 should work.') test_repeats, 2, '--isolated-script-test-repeat=2 should work.')
for folder in expected_benchmark_folders:
with open(os.path.join(tempdir, folder, 'test_results.json')) as f:
test_results = json.load(f)
self.assertIsNotNone(
test_results, 'json test results should be populated: ' + stdout)
test_repeats = test_results['num_failures_by_type']['PASS']
self.assertEqual(
test_repeats, 2, '--isolated-script-test-repeat=2 should work.')
with open(os.path.join(tempdir, folder, 'perf_results.json')) as f: with open(os.path.join(tempdir, folder, 'perf_results.json')) as f:
perf_results = json.load(f) perf_results = json.load(f)
self.assertIsNotNone( self.assertIsNotNone(
perf_results, 'json perf results should be populated: ' + stdout) perf_results, 'json perf results should be populated.')
except IOError as e: except Exception as exc:
self.fail('IOError: ' + stdout + str(e)) logging.error(
except KeyError as e: 'Failed with error: %s\nOutput from run_performance_tests.py:\n\n%s',
self.fail('KeyError: ' + stdout + str(e)) exc, stdout)
if test_results is not None:
logging.error(
'Got test_results: %s\n', json.dumps(test_results, indent=2))
raise
finally: finally:
shutil.rmtree(tempdir) shutil.rmtree(tempdir)
......
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