Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: scripts/slave/recipe_modules/chromium_tests/steps.py

Issue 2439213002: Add step to process Render Test results. (Closed)
Patch Set: Add step to process Render Test results. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import datetime 5 import datetime
6 import json 6 import json
7 import re 7 import re
8 import string 8 import string
9 9
10 10
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 use_swarming = True 508 use_swarming = True
509 swarming_shards = swarming_spec.get('shards', 1) 509 swarming_shards = swarming_spec.get('shards', 1)
510 swarming_dimension_sets = swarming_spec.get('dimension_sets') 510 swarming_dimension_sets = swarming_spec.get('dimension_sets')
511 swarming_priority = swarming_spec.get('priority_adjustment') 511 swarming_priority = swarming_spec.get('priority_adjustment')
512 swarming_expiration = swarming_spec.get('expiration') 512 swarming_expiration = swarming_spec.get('expiration')
513 if use_swarming and swarming_dimension_sets: 513 if use_swarming and swarming_dimension_sets:
514 for dimensions in swarming_dimension_sets: 514 for dimensions in swarming_dimension_sets:
515 # TODO(stip): Swarmify instrumentation tests 515 # TODO(stip): Swarmify instrumentation tests
516 pass 516 pass
517 else: 517 else:
518 yield AndroidInstrumentationTest( 518 yield AndroidInstrumentationTest(
jbudorick 2016/11/21 18:08:50 Add a way for the JSON to set the render results d
mikecase (-- gone --) 2016/11/21 23:03:12 Done. Just named the field 'render_results_dir' in
519 test_name, 519 test_name,
520 compile_targets=test.get('override_compile_targets'), 520 compile_targets=test.get('override_compile_targets'),
521 timeout_scale=test.get('timeout_scale'), 521 timeout_scale=test.get('timeout_scale'),
522 result_details=True, 522 result_details=True,
523 store_tombstones=True) 523 store_tombstones=True)
524 524
525 525
526 def generate_junit_test(api, chromium_tests_api, mastername, buildername, 526 def generate_junit_test(api, chromium_tests_api, mastername, buildername,
527 test_spec, bot_update_step, enable_swarming=False, 527 test_spec, bot_update_step, enable_swarming=False,
528 swarming_dimensions=None, 528 swarming_dimensions=None,
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 1479
1480 Args: 1480 Args:
1481 api: Caller's API. 1481 api: Caller's API.
1482 suffix: Suffix added to the test name. 1482 suffix: Suffix added to the test name.
1483 json_results_file: File to output the test results. 1483 json_results_file: File to output the test results.
1484 """ 1484 """
1485 raise NotImplementedError() # pragma: no cover 1485 raise NotImplementedError() # pragma: no cover
1486 1486
1487 def run(self, api, suffix, test_filter=None): 1487 def run(self, api, suffix, test_filter=None):
1488 assert api.chromium.c.TARGET_PLATFORM == 'android' 1488 assert api.chromium.c.TARGET_PLATFORM == 'android'
1489 json_results_file = api.test_utils.gtest_results(add_json_log=False)
1490 try:
1491 self.run_tests(api, suffix, json_results_file)
1492 finally:
1493 step_result = api.step.active_result
1494 self._test_runs[suffix] = {'valid': False}
1495 if (hasattr(step_result, 'test_utils') and
1496 hasattr(step_result.test_utils, 'gtest_results')):
1497 gtest_results = step_result.test_utils.gtest_results
1498 1489
1499 failures = gtest_results.failures 1490 nested_step_name = '%s%s' % (self._name, ' (%s)' % suffix if suffix else '')
1500 self._test_runs[suffix] = {'valid': True, 'failures': failures} 1491 with api.step.nest(nested_step_name) as nested_step:
1501 step_result.presentation.step_text += ( 1492 json_results_file = api.test_utils.gtest_results(add_json_log=False)
1502 api.test_utils.format_step_text([['failures:', failures]])) 1493 try:
1494 step_result = self.run_tests(api, suffix, json_results_file)
1495 except api.step.StepFailure as f:
1496 step_result = f.result
1497 raise
1498 finally:
1499 nested_step.presentation.status = step_result.presentation.status
1500 self._test_runs[suffix] = {'valid': False}
1501 if (hasattr(step_result, 'test_utils') and
1502 hasattr(step_result.test_utils, 'gtest_results')):
1503 gtest_results = step_result.test_utils.gtest_results
1503 1504
1504 api.test_results.upload( 1505 failures = gtest_results.failures
1505 api.json.input(gtest_results.raw), 1506 self._test_runs[suffix] = {'valid': True, 'failures': failures}
1506 test_type=self.name, 1507 nested_step.presentation.step_text += (
1507 chrome_revision=api.bot_update.last_returned_properties.get( 1508 api.test_utils.format_step_text([['failures:', failures]]))
1508 'got_revision_cp', 'x@{#0}'), 1509
1509 test_results_server='test-results.appspot.com') 1510 api.test_results.upload(
1511 api.json.input(gtest_results.raw),
1512 test_type=self.name,
1513 chrome_revision=api.bot_update.last_returned_properties.get(
1514 'got_revision_cp', 'x@{#0}'),
1515 test_results_server='test-results.appspot.com')
1510 1516
1511 def compile_targets(self, _): 1517 def compile_targets(self, _):
1512 return self._compile_targets 1518 return self._compile_targets
1513 1519
1514 def has_valid_results(self, api, suffix): 1520 def has_valid_results(self, api, suffix):
1515 if suffix not in self._test_runs: 1521 if suffix not in self._test_runs:
1516 return False # pragma: no cover 1522 return False # pragma: no cover
1517 return self._test_runs[suffix]['valid'] 1523 return self._test_runs[suffix]['valid']
1518 1524
1519 def failures(self, api, suffix): 1525 def failures(self, api, suffix):
1520 assert self.has_valid_results(api, suffix) 1526 assert self.has_valid_results(api, suffix)
1521 return self._test_runs[suffix]['failures'] 1527 return self._test_runs[suffix]['failures']
1522 1528
1523 1529
1524 class AndroidJunitTest(AndroidTest): 1530 class AndroidJunitTest(AndroidTest):
1525 def __init__(self, name): 1531 def __init__(self, name):
1526 super(AndroidJunitTest, self).__init__(name, compile_targets=[name], 1532 super(AndroidJunitTest, self).__init__(name, compile_targets=[name],
1527 isolate_file_path=None) 1533 isolate_file_path=None)
1528 1534
1529 @property 1535 @property
1530 def uses_local_devices(self): 1536 def uses_local_devices(self):
1531 return False 1537 return False
1532 1538
1533 #override 1539 #override
1534 def run_tests(self, api, suffix, json_results_file): 1540 def run_tests(self, api, suffix, json_results_file):
1535 api.chromium_android.run_java_unit_test_suite( 1541 return api.chromium_android.run_java_unit_test_suite(
1536 self.name, verbose=True, suffix=suffix, 1542 self.name, verbose=True, suffix=suffix,
1537 json_results_file=json_results_file, 1543 json_results_file=json_results_file,
1538 step_test_data=lambda: api.test_utils.test_api.canned_gtest_output(False )) 1544 step_test_data=lambda: api.test_utils.test_api.canned_gtest_output(False ))
1539 1545
1540 1546
1541 class AndroidInstrumentationTest(AndroidTest): 1547 class AndroidInstrumentationTest(AndroidTest):
1542 _DEFAULT_SUITES = { 1548 _DEFAULT_SUITES = {
1543 'AndroidWebViewTest': { 1549 'AndroidWebViewTest': {
1544 'compile_target': 'android_webview_test_apk', 1550 'compile_target': 'android_webview_test_apk',
1545 }, 1551 },
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 'remoting_test_apk': _DEFAULT_SUITES['ChromotingTest'], 1591 'remoting_test_apk': _DEFAULT_SUITES['ChromotingTest'],
1586 'system_webview_shell_layout_test_apk': 1592 'system_webview_shell_layout_test_apk':
1587 _DEFAULT_SUITES['SystemWebViewShellLayoutTest'], 1593 _DEFAULT_SUITES['SystemWebViewShellLayoutTest'],
1588 'webview_ui_test_app_test_apk': _DEFAULT_SUITES['WebViewUiTest'], 1594 'webview_ui_test_app_test_apk': _DEFAULT_SUITES['WebViewUiTest'],
1589 } 1595 }
1590 1596
1591 def __init__(self, name, compile_targets=None, apk_under_test=None, 1597 def __init__(self, name, compile_targets=None, apk_under_test=None,
1592 test_apk=None, isolate_file_path=None, timeout_scale=None, 1598 test_apk=None, isolate_file_path=None, timeout_scale=None,
1593 annotation=None, except_annotation=None, screenshot=False, 1599 annotation=None, except_annotation=None, screenshot=False,
1594 verbose=True, tool=None, additional_apks=None, 1600 verbose=True, tool=None, additional_apks=None,
1595 store_tombstones=False, result_details=False): 1601 store_tombstones=False, result_details=False,
1602 render_results_dir=None):
1596 suite_defaults = ( 1603 suite_defaults = (
1597 AndroidInstrumentationTest._DEFAULT_SUITES.get(name) 1604 AndroidInstrumentationTest._DEFAULT_SUITES.get(name)
1598 or AndroidInstrumentationTest._DEFAULT_SUITES_BY_TARGET.get(name) 1605 or AndroidInstrumentationTest._DEFAULT_SUITES_BY_TARGET.get(name)
1599 or {}) 1606 or {})
1600 if not compile_targets: 1607 if not compile_targets:
1601 compile_targets = [suite_defaults.get('compile_target', name)] 1608 compile_targets = [suite_defaults.get('compile_target', name)]
1602 compile_targets.extend( 1609 compile_targets.extend(
1603 suite_defaults.get('additional_compile_targets', [])) 1610 suite_defaults.get('additional_compile_targets', []))
1604 1611
1605 super(AndroidInstrumentationTest, self).__init__( 1612 super(AndroidInstrumentationTest, self).__init__(
1606 name, 1613 name,
1607 compile_targets, 1614 compile_targets,
1608 isolate_file_path or suite_defaults.get('isolate_file_path')) 1615 isolate_file_path or suite_defaults.get('isolate_file_path'))
1609 self._additional_apks = ( 1616 self._additional_apks = (
1610 additional_apks or suite_defaults.get('additional_apks')) 1617 additional_apks or suite_defaults.get('additional_apks'))
1611 self._annotation = annotation 1618 self._annotation = annotation
1612 self._apk_under_test = ( 1619 self._apk_under_test = (
1613 apk_under_test or suite_defaults.get('apk_under_test')) 1620 apk_under_test or suite_defaults.get('apk_under_test'))
1614 self._except_annotation = except_annotation 1621 self._except_annotation = except_annotation
1615 self._screenshot = screenshot 1622 self._screenshot = screenshot
1616 self._test_apk = test_apk or suite_defaults.get('test_apk') 1623 self._test_apk = test_apk or suite_defaults.get('test_apk')
1617 self._timeout_scale = timeout_scale 1624 self._timeout_scale = timeout_scale
1618 self._tool = tool 1625 self._tool = tool
1619 self._verbose = verbose 1626 self._verbose = verbose
1620 self._wrapper_script_suite_name = compile_targets[0] 1627 self._wrapper_script_suite_name = compile_targets[0]
1621 self._store_tombstones = store_tombstones 1628 self._store_tombstones = store_tombstones
1622 self._result_details = result_details 1629 self._result_details = result_details
1630 self._render_results_dir = render_results_dir
1623 1631
1624 @property 1632 @property
1625 def uses_local_devices(self): 1633 def uses_local_devices(self):
1626 return True 1634 return True
1627 1635
1628 #override 1636 #override
1629 def run_tests(self, api, suffix, json_results_file): 1637 def run_tests(self, api, suffix, json_results_file):
1630 api.chromium_android.run_instrumentation_suite( 1638 return api.chromium_android.run_instrumentation_suite(
1631 self.name, 1639 self.name,
1632 test_apk=api.chromium_android.apk_path(self._test_apk), 1640 test_apk=api.chromium_android.apk_path(self._test_apk),
1633 apk_under_test=api.chromium_android.apk_path(self._apk_under_test), 1641 apk_under_test=api.chromium_android.apk_path(self._apk_under_test),
1634 additional_apks=[ 1642 additional_apks=[
1635 api.chromium_android.apk_path(a) 1643 api.chromium_android.apk_path(a)
1636 for a in self._additional_apks or []], 1644 for a in self._additional_apks or []],
1637 suffix=suffix, 1645 suffix=suffix,
1638 isolate_file_path=self.isolate_file_path, 1646 isolate_file_path=self.isolate_file_path,
1639 annotation=self._annotation, except_annotation=self._except_annotation, 1647 annotation=self._annotation, except_annotation=self._except_annotation,
1640 screenshot=self._screenshot, verbose=self._verbose, tool=self._tool, 1648 screenshot=self._screenshot, verbose=self._verbose, tool=self._tool,
1641 json_results_file=json_results_file, 1649 json_results_file=json_results_file,
1642 timeout_scale=self._timeout_scale, 1650 timeout_scale=self._timeout_scale,
1643 result_details=self._result_details, 1651 result_details=self._result_details,
1644 store_tombstones=self._store_tombstones, 1652 store_tombstones=self._store_tombstones,
1645 wrapper_script_suite_name=self._wrapper_script_suite_name, 1653 wrapper_script_suite_name=self._wrapper_script_suite_name,
1654 render_results_dir=self._render_results_dir,
1646 step_test_data=lambda: api.test_utils.test_api.canned_gtest_output(False )) 1655 step_test_data=lambda: api.test_utils.test_api.canned_gtest_output(False ))
1647 1656
1648 1657
1649 class BlinkTest(Test): 1658 class BlinkTest(Test):
1650 # TODO(dpranke): This should be converted to a PythonBasedTest, although it 1659 # TODO(dpranke): This should be converted to a PythonBasedTest, although it
1651 # will need custom behavior because we archive the results as well. 1660 # will need custom behavior because we archive the results as well.
1652 def __init__(self, extra_args=None): 1661 def __init__(self, extra_args=None):
1653 super(BlinkTest, self).__init__() 1662 super(BlinkTest, self).__init__()
1654 self._extra_args = extra_args 1663 self._extra_args = extra_args
1655 1664
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 args=args) 1897 args=args)
1889 api.gsutil.upload( 1898 api.gsutil.upload(
1890 temp_output_dir.join( 1899 temp_output_dir.join(
1891 '%s-android-chrome.json' % timestamp_string), 1900 '%s-android-chrome.json' % timestamp_string),
1892 'chromium-annotated-tests', 'android') 1901 'chromium-annotated-tests', 'android')
1893 1902
1894 GOMA_TESTS = [ 1903 GOMA_TESTS = [
1895 GTestTest('base_unittests'), 1904 GTestTest('base_unittests'),
1896 GTestTest('content_unittests'), 1905 GTestTest('content_unittests'),
1897 ] 1906 ]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698