author Boris Chiou <>
Wed, 25 May 2016 17:58:04 +0800
changeset 371286 81061db3273afdd71560fe10d33325becdce6afe
parent 340497 a03f77804981532999e4d3d41795d8bc65797059
child 445691 e8db6a0011bd3b75ea8c16e9b974d25b44324cde
child 446058 512c49a96b97a6a7c8c67dfe55cef02eed98c666
permissions -rw-r--r--
Bug 1244590 - Part 7: Calculate paced spacing. Calculate the paced spacing for each Keyframes by the context element. Use the algorithm in the spec. MozReview-Commit-ID: HFWQwoKhKWt

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at

from __future__ import unicode_literals

import logging
import mozunit
import subprocess
import sys
import unittest

from os import path
from buildconfig import substs

log = logging.getLogger(__name__)

def determine_platform():
    platform_mapping = {'WINNT': {'x86_64': 'win64',
                                  'i686': 'win32'},
                        'Darwin': {'x86_64': 'macosx-universal',
                        'Linux': {'x86_64': 'linux64',
                                  'i686': 'linux32'}}

    os_type = substs['OS_TARGET']
    cpu_type = substs['TARGET_CPU']
    return platform_mapping.get(os_type, {}).get(cpu_type, None)

class TestCompareMozconfigs(unittest.TestCase):
    def test_compare_mozconfigs(self):
        """ A wrapper script that calls
        based on the platform that the machine is building for"""
        platform = determine_platform()

        if platform is not None:
            python_exe = substs['PYTHON']
            topsrcdir = substs['top_srcdir']

            # construct paths and args for compare-mozconfig
            browser_dir = path.join(topsrcdir, 'browser')
            script_path = path.join(topsrcdir, 'build/compare-mozconfig/')
            whitelist_path = path.join(browser_dir, 'config/mozconfigs/whitelist')
            beta_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'beta')
            release_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'release')
            nightly_mozconfig_path = path.join(browser_dir, 'config/mozconfigs', platform, 'nightly')

  "Comparing beta against nightly mozconfigs")
            ret_code =[python_exe, script_path, '--whitelist',
                                        whitelist_path, '--no-download',
                                        platform + ',' + beta_mozconfig_path +
                                        ',' + nightly_mozconfig_path])

            if ret_code > 0:
                return ret_code

  "Comparing release against nightly mozconfigs")
            ret_code =[python_exe, script_path, '--whitelist',
                                        whitelist_path, '--no-download',
                                        platform + ',' + release_mozconfig_path +
                                        ',' + nightly_mozconfig_path])

            self.assertEqual(0, ret_code)

if __name__ == '__main__':