示例#1
0
    def test_match_ufid(self):
        # format:
        # { configure ufid: ((matched masks), (unmatched masks)) }
        ufid_masks = {
            'dbg_mt_exc': (('dbg', '_', 'mt', 'dbg_mt', 'dbg_mt_exc'),
                           ('opt', 'opt_mt', 'opt_mt_exc')),
            'opt_mt_safe':
            (('opt', '_', 'mt', 'opt_mt_safe'), ('opt_mt_exc', 'safe2')),
        }

        for ufid_str in ufid_masks:
            masks = ufid_masks[ufid_str]
            matched_masks = masks[0]
            unmatched_masks = masks[1]

            ufid = optiontypes.Ufid.from_str(ufid_str)
            for mask_str in matched_masks:
                mask = optiontypes.Ufid.from_str(mask_str)
                self.assertTrue(optionsutil.match_ufid(ufid, mask),
                                'ufid: %s mask: %s' % (ufid, mask))

            for mask_str in unmatched_masks:
                mask = optiontypes.Ufid.from_str(mask_str)
                self.assertFalse(optionsutil.match_ufid(ufid, mask),
                                 'ufid: %s mask: %s' % (ufid, mask))
示例#2
0
    def test_match_ufid(self):
        # format:
        # { configure ufid: ((matched masks), (unmatched masks)) }
        ufid_masks = {
            'dbg_mt_exc': (('dbg', '_', 'mt', 'dbg_mt', 'dbg_mt_exc'),
                           ('opt', 'opt_mt', 'opt_mt_exc')),
            'opt_mt_safe': (('opt', '_', 'mt', 'opt_mt_safe'),
                            ('opt_mt_exc', 'safe2')),
        }

        for ufid_str in ufid_masks:
            masks = ufid_masks[ufid_str]
            matched_masks = masks[0]
            unmatched_masks = masks[1]

            ufid = optiontypes.Ufid.from_str(ufid_str)
            for mask_str in matched_masks:
                mask = optiontypes.Ufid.from_str(mask_str)
                self.assertTrue(optionsutil.match_ufid(ufid, mask),
                                'ufid: %s mask: %s' % (ufid, mask))

            for mask_str in unmatched_masks:
                mask = optiontypes.Ufid.from_str(mask_str)
                self.assertFalse(optionsutil.match_ufid(ufid, mask),
                                 'ufid: %s mask: %s' % (ufid, mask))
示例#3
0
    def _match_rule(self, option_rule):
        """Determine if an option rule matches with the build configuration.
        """

        # These keys are used to preserve backwards compatibility with
        # bde_build.pl and should be ignored.
        ignore_keys = ('XLC_INTERNAL_PREFIX1',
                       'XLC_INTERNAL_PREFIX2',
                       'AIX_GCC_PREFIX',
                       'SUN_CC_INTERNAL_PREFIX',
                       'SUN_GCC_INTERNAL_PREFIX',
                       'LINUX_GCC_PREFIX',
                       'WINDOWS_CC_PREFIX',
                       'RETRY_ON_SIGNAL')

        if option_rule.key in ignore_keys:
            return False

        global DEFAULT_COMPILER
        if not optionsutil.match_uplid(self._uplid, option_rule.uplid,
                                       DEFAULT_COMPILER):
            return False
        if not optionsutil.match_ufid(self._ufid, option_rule.ufid):
            return False

        return True
示例#4
0
    def _match_rule(self, option_rule):
        """Determine if an option rule matches with the build configuration.
        """

        if not optionsutil.match_uplid(self._uplid, option_rule.uplid):
            return False
        if not optionsutil.match_ufid(self._ufid, option_rule.ufid):
            return False

        return True
示例#5
0
    def _match_rule(self, option_rule):
        """Determine if an option rule matches with the build configuration.
        """

        if not optionsutil.match_uplid(self._uplid, option_rule.uplid):
            return False
        if not optionsutil.match_ufid(self._ufid, option_rule.ufid):
            return False

        return True