Bug 1088060 - [mozversion] Get all application and platform data. r=dhunt
authorHenrik Skupin <mail@hskupin.info>
Thu, 23 Oct 2014 17:46:23 +0200
changeset 212075 370a0a1ea55d3af862c896ea171a22348d18cf25
parent 212074 ab54779111b1987d09a530125f1f15b1c434dc21
child 212076 ac33dde6856caa7bffb3ebe6c5d9d0b7b1845c9e
push id27697
push usercbook@mozilla.com
push dateFri, 24 Oct 2014 13:48:53 +0000
treeherdermozilla-central@de805196bbc4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdhunt
bugs1088060
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1088060 - [mozversion] Get all application and platform data. r=dhunt --- testing/mozbase/mozversion/mozversion/mozversion.py | 10 +++++----- testing/mozbase/mozversion/tests/test_binary.py | 11 +++++++++-- 2 files changed, 14 insertions(+), 7 deletions(-)
testing/mozbase/mozversion/mozversion/mozversion.py
testing/mozbase/mozversion/tests/test_binary.py
--- a/testing/mozbase/mozversion/mozversion/mozversion.py
+++ b/testing/mozbase/mozversion/mozversion/mozversion.py
@@ -37,21 +37,21 @@ class Version(object):
             if os.path.exists(config_file):
                 self._parse_ini_file(open(config_file), type, section)
             else:
                 self._logger.warning('Unable to find %s' % config_file)
 
     def _parse_ini_file(self, fp, type, section):
         config = ConfigParser.RawConfigParser()
         config.readfp(fp)
-        name_map = {'CodeName': 'display_name',
-                    'SourceRepository': 'repository',
-                    'SourceStamp': 'changeset'}
-        for key in ('BuildID', 'Name', 'CodeName', 'Version',
-                    'SourceRepository', 'SourceStamp'):
+        name_map = {'codename': 'display_name',
+                    'milestone': 'version',
+                    'sourcerepository': 'repository',
+                    'sourcestamp': 'changeset'}
+        for key, value in config.items(section):
             name = name_map.get(key, key).lower()
             self._info['%s_%s' % (type, name)] = config.has_option(
                 section, key) and config.get(section, key) or None
 
         if not self._info.get('application_display_name'):
             self._info['application_display_name'] = \
                 self._info.get('application_name')
 
--- a/testing/mozbase/mozversion/tests/test_binary.py
+++ b/testing/mozbase/mozversion/tests/test_binary.py
@@ -12,25 +12,28 @@ import mozfile
 
 from mozversion import errors, get_version
 
 
 class BinaryTest(unittest.TestCase):
     """test getting application version information from a binary path"""
 
     application_ini = """[App]
+ID = AppID
 Name = AppName
 CodeName = AppCodeName
 Version = AppVersion
 BuildID = AppBuildID
 SourceRepository = AppSourceRepo
 SourceStamp = AppSourceStamp
+Vendor = AppVendor
 """
     platform_ini = """[Build]
 BuildID = PlatformBuildID
+Milestone = PlatformMilestone
 SourceStamp = PlatformSourceStamp
 SourceRepository = PlatformSourceRepo
 """
 
     def setUp(self):
         self.cwd = os.getcwd()
         self.tempdir = tempfile.mkdtemp()
 
@@ -109,28 +112,32 @@ SourceRepository = PlatformSourceRepo
         if application:
             with open(os.path.join(self.tempdir, 'application.ini'), 'w') as f:
                 f.writelines(self.application_ini)
         if platform:
             with open(os.path.join(self.tempdir, 'platform.ini'), 'w') as f:
                 f.writelines(self.platform_ini)
 
     def _check_version(self, version):
+        self.assertEqual(version.get('application_id'), 'AppID')
         self.assertEqual(version.get('application_name'), 'AppName')
-        self.assertEqual(version.get('application_display_name'), 'AppCodeName')
+        self.assertEqual(
+            version.get('application_display_name'), 'AppCodeName')
         self.assertEqual(version.get('application_version'), 'AppVersion')
         self.assertEqual(version.get('application_buildid'), 'AppBuildID')
         self.assertEqual(
             version.get('application_repository'), 'AppSourceRepo')
         self.assertEqual(
             version.get('application_changeset'), 'AppSourceStamp')
+        self.assertEqual(version.get('application_vendor'), 'AppVendor')
         self.assertIsNone(version.get('platform_name'))
-        self.assertIsNone(version.get('platform_version'))
         self.assertEqual(version.get('platform_buildid'), 'PlatformBuildID')
         self.assertEqual(
             version.get('platform_repository'), 'PlatformSourceRepo')
         self.assertEqual(
             version.get('platform_changeset'), 'PlatformSourceStamp')
         self.assertIsNone(version.get('invalid_key'))
+        self.assertEqual(
+            version.get('platform_version'), 'PlatformMilestone')
 
 
 if __name__ == '__main__':
     unittest.main()