Commit 21a947f9 authored by Rakib M. Hasan's avatar Rakib M. Hasan Committed by Commit Bot

[blinkpy] Add method to retrieve system condition tags in blinkpy

These tags will be used to find active expectations for a test run on
a certain system.

Bug: chromium:986447
Change-Id: Iaa2cea234b80ff010581cd3991dbb015cb8995e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1904270Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Rakib Hasan <rmhasan@google.com>
Cr-Commit-Position: refs/heads/master@{#713707}
parent 9ce537e5
......@@ -253,6 +253,12 @@ class Port(object):
return 'Port{name=%s, version=%s, architecture=%s, test_configuration=%s}' % (
self._name, self._version, self._architecture, self._test_configuration)
def get_platform_tags(self):
"""Returns system condition tags that are used to find active expectations
for a test run on a specific system"""
return frozenset([self._options.configuration.lower(), self._version,
self.port_name, self._architecture])
@memoized
def _flag_specific_config_name(self):
"""Returns the name of the flag-specific configuration which best matches
......
......@@ -72,6 +72,10 @@ class LinuxPortTest(port_testcase.PortTestCase, LoggingTestCase):
for i, path in enumerate(expected_paths):
self.assertTrue(port.baseline_search_path()[i].endswith(path))
def test_get_platform_tags(self):
port = self.make_port()
self.assertEqual(port.get_platform_tags(), {'linux', 'trusty', 'x86_64', 'release'})
def test_baseline_paths(self):
self.assert_baseline_paths('linux', 'trusty', 'linux', '/win')
self.assert_baseline_paths('linux-trusty', None, 'linux', '/win')
......
......@@ -46,6 +46,10 @@ class MacPortTest(port_testcase.PortTestCase):
def test_operating_system(self):
self.assertEqual('mac', self.make_port().operating_system())
def test_get_platform_tags(self):
port = self.make_port()
self.assertEqual(port.get_platform_tags(), {'mac', 'mac10.12', 'x86', 'release'})
def test_driver_name_option(self):
self.assertTrue(self.make_port()._path_to_driver().endswith('Content Shell'))
port = self.make_port(options=optparse.Values(dict(driver_name='OtherDriver')))
......
......@@ -53,6 +53,10 @@ class WinPortTest(port_testcase.PortTestCase):
port = self.make_port(port_name=port_name, os_version=os_version_string)
self.assertEqual(expected, port.name())
def test_get_platform_tags(self):
port = self.make_port()
self.assertEqual(port.get_platform_tags(), {'win', 'win7', 'x86', 'release'})
def test_versions(self):
port = self.make_port()
self.assertIn(port.name(), ('win-win7', 'win-win10'))
......
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