Bug 1377398 - Remove the bespoke PLATFORM_TYPE utility variable r=jmaher

Really the only thing we use it for is generating a counter string
prefix elsewhere in Talos, so let's just create a private function
to do that close to where it's used.

MozReview-Commit-ID: BICrhDAIEHb

--HG--
extra : rebase_source : f3faa1720e69c179b597ca58ee17424182e0cda0
This commit is contained in:
William Lachance 2017-06-29 22:44:22 -07:00
parent fb8d768e7c
commit 7c0126fe56
2 changed files with 22 additions and 32 deletions

View File

@ -25,7 +25,7 @@ import mozfile
from mozlog import get_proxy_logger
from talos.utils import TalosCrash, TalosRegression
from talos.utils import TalosCrash, TalosError, TalosRegression
from talos.talos_process import run_browser
from talos.ffsetup import FFSetup
from talos.cmanager import CounterManagement
@ -34,8 +34,6 @@ LOG = get_proxy_logger()
class TTest(object):
platform_type = utils.PLATFORM_TYPE
def check_for_crashes(self, browser_config, minidump_dir, test_name):
# check for minidumps
found = mozcrash.check_for_crashes(minidump_dir,
@ -59,14 +57,32 @@ class TTest(object):
"""
LOG.debug("operating with platform_type : %s" % self.platform_type)
with FFSetup(browser_config, test_config) as setup:
return self._runTest(browser_config, test_config, setup)
@staticmethod
def _get_counter_prefix():
if platform.system() == "Linux":
return 'linux'
elif platform.system() in ("Windows", "Microsoft"):
if '6.1' in platform.version(): # w7
return 'w7'
elif '6.2' in platform.version(): # w8
return 'w8'
# Bug 1264325 - FIXME: with python 2.7.11: reports win8 instead of 8.1
elif '6.3' in platform.version():
return 'w8'
# Bug 1264325 - FIXME: with python 2.7.11: reports win8 instead of 10
elif '10.0' in platform.version():
return 'w8'
else:
raise TalosError('unsupported windows version')
elif platform.system() == "Darwin":
return 'mac'
def _runTest(self, browser_config, test_config, setup):
minidump_dir = os.path.join(setup.profile_dir, 'minidumps')
counters = test_config.get(self.platform_type + 'counters', [])
counters = test_config.get('%s_counters' % self._get_counter_prefix(), [])
resolution = test_config['resolution']
# add the mainthread_io to the environment variable, as defined

View File

@ -20,32 +20,6 @@ here = os.path.dirname(os.path.realpath(__file__))
LOG = get_proxy_logger()
def _get_platform():
# get the platform we're interested in. Note that the values
# are used in TTest historically, this is why they are not really friendly.
# TODO: give some user friendly values
if platform.system() == "Linux":
return 'linux_'
elif platform.system() in ("Windows", "Microsoft"):
if '6.1' in platform.version(): # w7
return 'w7_'
elif '6.2' in platform.version(): # w8
return 'w8_'
# Bug 1264325 - FIXME: with python 2.7.11: reports win8 instead of 8.1
elif '6.3' in platform.version():
return 'w8_'
# Bug 1264325 - FIXME: with python 2.7.11: reports win8 instead of 10
elif '10.0' in platform.version():
return 'w8_'
else:
raise TalosError('unsupported windows version')
elif platform.system() == "Darwin":
return 'mac_'
PLATFORM_TYPE = _get_platform()
class Timer(object):
def __init__(self):
self._start_time = 0