Commit 5cfefc79 authored by Rakib M. Hasan's avatar Rakib M. Hasan Committed by Commit Bot

Relands "Adds the metadata optional field to the standard JSON results"

This CL had to be reverted because GPU bots were failing because the
results_merger.py script could not handle the test_name_prefix field
that was still getting populated in the JSON results. This CL will
add the metadata field along side the test_name_prefix field in the
Optional fields list in the results_merger.py script. It also removes
the checking of test_name_prefix in the gpu unit tests because the
test_name_prefix field will be removed from the top level of the
results in a future CL.

Bug: chromium:698902
Change-Id: I4867e60ca5a97d426d5fd1a4de08e26c14d326ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1559492
Commit-Queue: Rakib Hasan <rmhasan@google.com>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649665}
parent 673d4e19
......@@ -164,25 +164,16 @@ class GpuIntegrationTestUnittest(unittest.TestCase):
self.assertEqual(
self._test_result['tests']['unexpected_test_failure']['actual'],
'FAIL FAIL')
self.assertEqual(
self._test_result['test_name_prefix'],
'unittest_data.integration_tests.RunTestsWithExpectationsFiles.')
def testDefaultRetryArgumentsinRunGpuIntegrationTests(self):
self._RunGpuIntegrationTests('run_tests_with_expectations_files')
self.assertEqual(
self._test_result['tests']['expected_flaky']['actual'],
'FAIL FAIL FAIL')
self.assertEqual(
self._test_result['test_name_prefix'],
'unittest_data.integration_tests.RunTestsWithExpectationsFiles.')
def testTestNamePrefixGenerationInRunGpuIntegrationTests(self):
self._RunGpuIntegrationTests('simple_integration_unittest')
self.assertIn('expected_failure', self._test_result['tests'])
self.assertEqual(
self._test_result['test_name_prefix'],
'unittest_data.integration_tests.SimpleTest.')
def testWithoutExpectationsFilesGenerateTagsReturnsEmptyList(self):
# we need to make sure that GenerateTags() returns an empty list if
......
......@@ -86,9 +86,8 @@ object may appear in any order.
| `artifact_permanent_location` | string | **Optional.** The URI of the root location where the artifacts are stored. If present, any artifact locations are taken to be relative to this location. Currently only the `gs://` scheme is supported. |
| `build_number` | string | **Optional.** If this test run was produced on a bot, this should be the build number of the run, e.g., "1234". |
| `builder_name` | string | **Optional.** If this test run was produced on a bot, this should be the builder name of the bot, e.g., "Linux Tests". |
| `metadata` | dict | **Optional.** It maps to a dictionary that contains all the key value pairs used as metadata. This dictionary also includes the tags, test name prefix and test expectations file paths used during a test run. |
| `test_name_prefix` | string | **Optional.** If a prefix was specified to be removed from test names, then that prefix can be placed here. |
| `expectations_files` | array of strings | **Optional.** If a list of expectations file paths are passed to the test runner, then that list can be placed here. |
| `tags` | array of strings | **Optional.** If a list of test expectations file tags are passed to the test runner, then that list can be placed here. |
| `chromium_revision` | string | **Optional.** The revision of the current Chromium checkout, if relevant, e.g. "356123". |
| `has_pretty_patch` | bool | **Optional, layout test specific, deprecated.** Whether the web tests' output contains PrettyDiff-formatted diffs for test failures. |
| `has_wdiff` | bool | **Optional, layout test specific, deprecated.** Whether the web tests' output contains wdiff-formatted diffs for test failures. |
......
......@@ -26,8 +26,7 @@ OPTIONAL_MATCHING = (
'pixel_tests_enabled',
'random_order_seed',
'test_name_prefix',
'tags',
'expectations_files'
'metadata'
)
OPTIONAL_IGNORED = (
......
......@@ -172,6 +172,31 @@ class MergingTest(unittest.TestCase): # pragma: no cover
results_merger.merge_tries(
{'a': {'b': 'A'}}, {'a': {'b': 'C'}})
def test_merge_test_name_prefix(self):
results_merger.merge_test_results(
[extend(GOOD_JSON_TEST_RESULT_0, {'test_name_prefix': 'a.b.c'}),
extend(GOOD_JSON_TEST_RESULT_1, {'test_name_prefix': 'a.b.c'})])
def test_merge_test_name_prefix_raises_exception(self):
with self.assertRaises(results_merger.MergeException):
results_merger.merge_test_results(
[extend(GOOD_JSON_TEST_RESULT_0, {'test_name_prefix': 'a.d.c'}),
extend(GOOD_JSON_TEST_RESULT_1, {'test_name_prefix': 'a.b.c'})])
def test_merge_metadata(self):
metadata = {'metadata': {'tags': ['foo', 'bar']}}
results_merger.merge_test_results(
[extend(GOOD_JSON_TEST_RESULT_0, metadata),
extend(GOOD_JSON_TEST_RESULT_1, metadata)])
def test_merge_metadata_raises_exception(self):
metadata1 = {'metadata': {'tags': ['foo', 'bar']}}
metadata2 = {'metadata': {'tags': ['foo', 'bat']}}
with self.assertRaises(results_merger.MergeException):
results_merger.merge_test_results(
[extend(GOOD_JSON_TEST_RESULT_0, metadata1),
extend(GOOD_JSON_TEST_RESULT_1, metadata2)])
def test_merge_json_test_results_nop(self):
good_json_results = (
GOOD_JSON_TEST_RESULT_0,
......
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