Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 5 |
| 6 class Test(object): | 6 class Test(object): |
| 7 """ | 7 """ |
| 8 Base class for tests that can be retried after deapplying a previously | 8 Base class for tests that can be retried after deapplying a previously |
| 9 applied patch. | 9 applied patch. |
| 10 """ | 10 """ |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 if not gtest_results.valid: # pragma: no cover | 381 if not gtest_results.valid: # pragma: no cover |
| 382 return False | 382 return False |
| 383 global_tags = gtest_results.raw.get('global_tags', []) | 383 global_tags = gtest_results.raw.get('global_tags', []) |
| 384 return 'UNRELIABLE_RESULTS' not in global_tags | 384 return 'UNRELIABLE_RESULTS' not in global_tags |
| 385 | 385 |
| 386 def failures(self, api, suffix): | 386 def failures(self, api, suffix): |
| 387 assert self.has_valid_results(api, suffix) | 387 assert self.has_valid_results(api, suffix) |
| 388 return self._results[suffix].failures | 388 return self._results[suffix].failures |
| 389 | 389 |
| 390 | 390 |
| 391 class TelemetryUnitTests(Test): | 391 class PythonBasedTest(Test): |
| 392 @staticmethod | |
| 393 def compile_targets(_): | |
| 394 return [] | |
| 395 | |
| 396 @classmethod | |
| 397 def path_to_harness(_cls, _api): | |
| 398 raise NotImplementedError | |
| 399 | |
| 400 def run_step(self, api, suffix, cmd_args, **kwargs): | |
| 401 return api.python(self._step_name(suffix), | |
| 402 self.path_to_harness(api), | |
| 403 cmd_args, **kwargs) | |
| 404 | |
| 405 def run(self, api, suffix): | |
| 406 args = ['--write-full-results-to', | |
| 407 api.json.test_results(add_json_log=False)] | |
| 408 if suffix == 'without patch': | |
| 409 args.extend(self.failures(api, 'with patch')) | |
| 410 | |
| 411 def followup_fn(step_result): | |
| 412 r = step_result.json.test_results | |
| 413 p = step_result.presentation | |
| 414 | |
| 415 p.step_text += api.test_utils.format_step_text([ | |
| 416 ['unexpected_failures:', r.unexpected_failures.keys()], | |
| 417 ]) | |
| 418 | |
| 419 return self.run_step( | |
| 420 api, suffix, args, can_fail_build=(not suffix), | |
| 421 step_test_data=lambda: api.json.test_api.canned_test_output( | |
| 422 True), followup_fn=followup_fn) | |
| 423 | |
| 424 def has_valid_results(self, api, suffix): | |
| 425 # TODO(dpranke): we should just return zero/nonzero for success/fail. | |
| 426 # crbug.com/357866 | |
| 427 step = api.step_history[self._step_name(suffix)] | |
| 428 return (step.json.test_results.valid and | |
| 429 step.retcode <= step.json.test_results.MAX_FAILURES_EXIT_STATUS) | |
| 430 | |
| 431 def failures(self, api, suffix): | |
| 432 sn = self._step_name(suffix) | |
| 433 return api.step_history[sn].json.test_results.unexpected_failures | |
| 434 | |
| 435 | |
| 436 class MojoPythonTests(PythonBasedTest): # pylint: disable=W0232 | |
| 437 name = 'mojo_python_tests' | |
| 438 | |
| 439 @staticmethod | |
| 440 def path_to_harness(api): | |
| 441 return api.path['checkout'].join('mojo', 'tools', | |
| 442 'run_mojo_python_tests.py') | |
| 443 | |
| 444 | |
| 445 class TelemetryUnitTests(PythonBasedTest): # pylint: disable=W0232 | |
| 392 name = 'telemetry_unittests' | 446 name = 'telemetry_unittests' |
| 393 | 447 |
| 394 def run(self, api, suffix): | 448 @staticmethod |
| 395 # Until telemetry tests output JSON, need to fail on failure with patch. | 449 def path_to_harness(_api): |
| 396 # Otherwise, if the tests were failing on trunks and a cl introduces a | 450 assert False, "This method should not be called." |
|
Paweł Hajdan Jr.
2014/07/24 15:00:34
Can we remove path_to_harness then?
I prefer a sl
Dirk Pranke
2014/07/24 16:02:44
Yeah, that seems like an improvement to me as well
| |
| 397 # new regression the cl would land since the failure text is hardcoded | 451 |
| 398 # below. http://crbug.com/359521. | 452 @staticmethod |
| 399 return api.chromium.run_telemetry_unittests( | 453 def compile_targets(_): |
| 400 suffix, always_run=True, can_fail_build=True) | 454 return ['chrome'] |
| 455 | |
| 456 def run_step(self, api, suffix, cmd_args, **kwargs): | |
| 457 return api.chromium.run_telemetry_unittests(suffix, cmd_args, **kwargs) | |
| 458 | |
| 459 | |
| 460 class TelemetryPerfUnitTests(PythonBasedTest): | |
| 461 name = 'telemetry_perf_unittests' | |
| 401 | 462 |
| 402 @staticmethod | 463 @staticmethod |
| 403 def compile_targets(_): | 464 def compile_targets(_): |
| 404 return ['chrome'] | 465 return ['chrome'] |
| 405 | 466 |
| 406 def has_valid_results(self, api, suffix): | 467 @staticmethod |
| 407 return True | 468 def path_to_harness(_api): |
| 469 assert False, "This method should not be called." | |
| 408 | 470 |
| 409 def failures(self, api, suffix): | 471 def run_step(self, api, suffix, cmd_args, **kwargs): |
| 410 # TODO(phajdan.jr): Make it possible to retry individual failing telemetry | 472 return api.chromium.run_telemetry_perf_unittests(suffix, cmd_args, |
| 411 # tests (add JSON). | 473 **kwargs) |
| 412 if api.step_history[self._step_name(suffix)].retcode: | |
| 413 return ['telemetry_unittest'] | |
| 414 return [] | |
| 415 | |
| 416 class TelemetryPerfUnitTests(Test): | |
| 417 name = 'telemetry_perf_unittests' | |
| 418 | |
| 419 def run(self, api, suffix): | |
| 420 # Until telemetry tests output JSON, need to fail on failure with patch. | |
| 421 # Otherwise, if the tests were failing on trunks and a cl introduces a | |
| 422 # new regression the cl would land since the failure text is hardcoded | |
| 423 # below. http://crbug.com/359521. | |
| 424 return api.chromium.run_telemetry_perf_unittests( | |
| 425 suffix, always_run=True, can_fail_build=True) | |
| 426 | |
| 427 @staticmethod | |
| 428 def compile_targets(_): | |
| 429 return ['chrome'] | |
| 430 | |
| 431 def has_valid_results(self, api, suffix): | |
| 432 return True | |
| 433 | |
| 434 def failures(self, api, suffix): | |
| 435 # TODO(phajdan.jr): Make it possible to retry individual failing telemetry | |
| 436 # tests (add JSON). | |
| 437 if api.step_history[self._step_name(suffix)].retcode: | |
| 438 return ['telemetry_perf_unittests'] | |
| 439 return [] | |
| 440 | 474 |
| 441 | 475 |
| 442 class NaclIntegrationTest(Test): # pylint: disable=W0232 | 476 class NaclIntegrationTest(Test): # pylint: disable=W0232 |
| 443 name = 'nacl_integration' | 477 name = 'nacl_integration' |
| 444 | 478 |
| 445 @staticmethod | 479 @staticmethod |
| 446 def compile_targets(_): | 480 def compile_targets(_): |
| 447 return ['chrome'] | 481 return ['chrome'] |
| 448 | 482 |
| 449 def run(self, api, suffix): | 483 def run(self, api, suffix): |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 502 self.adb_install_apk[0], self.adb_install_apk[1]) | 536 self.adb_install_apk[0], self.adb_install_apk[1]) |
| 503 yield api.chromium_android.run_instrumentation_suite( | 537 yield api.chromium_android.run_instrumentation_suite( |
| 504 self.name, test_data=self.test_data, | 538 self.name, test_data=self.test_data, |
| 505 flakiness_dashboard='test-results.appspot.com', | 539 flakiness_dashboard='test-results.appspot.com', |
| 506 verbose=True) | 540 verbose=True) |
| 507 | 541 |
| 508 def compile_targets(self, _): | 542 def compile_targets(self, _): |
| 509 return [self.compile_target] | 543 return [self.compile_target] |
| 510 | 544 |
| 511 | 545 |
| 512 class MojoPythonTests(Test): # pylint: disable=W0232 | 546 class BlinkTest(Test): |
| 513 name = 'mojo_python_tests' | 547 # TODO: This should be converted to a PythonBasedTest, although it |
|
Paweł Hajdan Jr.
2014/07/24 15:00:34
nit: TODO(dpranke)?
Dirk Pranke
2014/07/24 16:02:44
Sure, I can add that.
| |
| 548 # will need custom behavior because we archive the results as well. | |
| 514 | 549 |
| 515 @staticmethod | |
| 516 def compile_targets(_): | |
| 517 return [] | |
| 518 | |
| 519 def run(self, api, suffix): | |
| 520 args = ['--write-full-results-to', | |
| 521 api.json.test_results(add_json_log=False)] | |
| 522 if suffix == 'without patch': | |
| 523 args.extend(self.failures(api, 'with patch')) | |
| 524 | |
| 525 def followup_fn(step_result): | |
| 526 r = step_result.json.test_results | |
| 527 p = step_result.presentation | |
| 528 | |
| 529 p.step_text += api.test_utils.format_step_text([ | |
| 530 ['unexpected_failures:', r.unexpected_failures.keys()], | |
| 531 ]) | |
| 532 | |
| 533 return api.python( | |
| 534 self._step_name(suffix), | |
| 535 api.path['checkout'].join( | |
| 536 'mojo', | |
| 537 'tools', | |
| 538 'run_mojo_python_tests.py'), | |
| 539 args, | |
| 540 can_fail_build=(not suffix), | |
| 541 step_test_data=lambda: api.json.test_api.canned_test_output( | |
| 542 True), followup_fn=followup_fn) | |
| 543 | |
| 544 def has_valid_results(self, api, suffix): | |
| 545 # TODO(dpranke): we should just return zero/nonzero for success/fail. | |
| 546 # crbug.com/357866 | |
| 547 step = api.step_history[self._step_name(suffix)] | |
| 548 return (step.json.test_results.valid and | |
| 549 step.retcode <= step.json.test_results.MAX_FAILURES_EXIT_STATUS) | |
| 550 | |
| 551 def failures(self, api, suffix): | |
| 552 sn = self._step_name(suffix) | |
| 553 return api.step_history[sn].json.test_results.unexpected_failures | |
| 554 | |
| 555 | |
| 556 class BlinkTest(Test): | |
| 557 name = 'webkit_tests' | 550 name = 'webkit_tests' |
| 558 | 551 |
| 559 def __init__(self, api): | 552 def __init__(self, api): |
| 560 self.results_dir = api.path['slave_build'].join('layout-test-results') | 553 self.results_dir = api.path['slave_build'].join('layout-test-results') |
| 561 self.layout_test_wrapper = api.path['build'].join( | 554 self.layout_test_wrapper = api.path['build'].join( |
| 562 'scripts', 'slave', 'chromium', 'layout_test_wrapper.py') | 555 'scripts', 'slave', 'chromium', 'layout_test_wrapper.py') |
| 563 | 556 |
| 564 def run(self, api, suffix): | 557 def run(self, api, suffix): |
| 565 args = ['--target', api.chromium.c.BUILD_CONFIG, | 558 args = ['--target', api.chromium.c.BUILD_CONFIG, |
| 566 '-o', self.results_dir, | 559 '-o', self.results_dir, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 649 GTestTest('components_unittests'), | 642 GTestTest('components_unittests'), |
| 650 GTestTest('crypto_unittests'), | 643 GTestTest('crypto_unittests'), |
| 651 GTestTest('gfx_unittests'), | 644 GTestTest('gfx_unittests'), |
| 652 GTestTest('url_unittests'), | 645 GTestTest('url_unittests'), |
| 653 GTestTest('content_unittests'), | 646 GTestTest('content_unittests'), |
| 654 GTestTest('net_unittests'), | 647 GTestTest('net_unittests'), |
| 655 GTestTest('ui_unittests'), | 648 GTestTest('ui_unittests'), |
| 656 GTestTest('sync_unit_tests'), | 649 GTestTest('sync_unit_tests'), |
| 657 GTestTest('sql_unittests'), | 650 GTestTest('sql_unittests'), |
| 658 ] | 651 ] |
| OLD | NEW |