def test_register_slave_match_regexp_invalid(self): BuildConfig(self.env, 'test', active=True).insert() platform = TargetPlatform(self.env, config='test', name="Unix") platform.rules.append(('version', '8(\.\d')) platform.insert() queue = BuildQueue(self.env) platforms = queue.match_slave('foo', {'version': '7.8.1'}) self.assertEqual([], platforms)
def test_register_slave_match_simple_fail(self): BuildConfig(self.env, 'test', active=True).insert() platform = TargetPlatform(self.env, config='test', name="Unix") platform.rules.append(('family', 'posix')) platform.insert() queue = BuildQueue(self.env) platforms = queue.match_slave('foo', {'family': 'nt'}) self.assertEqual([], platforms)
def test_register_slave_match_regexp(self): BuildConfig(self.env, 'test', active=True).insert() platform = TargetPlatform(self.env, config='test', name="Unix") platform.rules.append(('version', '8\.\d\.\d')) platform.insert() platform_id = platform.id queue = BuildQueue(self.env) platforms = queue.match_slave('foo', {'version': '8.2.0'}) self.assertEqual(1, len(platforms)) self.assertEqual(platform_id, platforms[0].id)
def test_register_slave_match_case_insensitive(self): BuildConfig(self.env, 'test', active=True).insert() platform = TargetPlatform(self.env, config='test', name="Unix") platform.rules.append(('os', 'LiNUX')) platform.insert() platform_id = platform.id queue = BuildQueue(self.env) platforms = queue.match_slave('foo', {'os': 'linux'}) self.assertEqual(1, len(platforms)) self.assertEqual(platform_id, platforms[0].id)
def test_match_slave_match(self): BuildConfig(self.env, 'test', active=True).insert() platform = TargetPlatform(self.env, config='test', name="Unix") platform.rules.append(('family', 'posix')) platform.insert() platform_id = platform.id queue = BuildQueue(self.env) platforms = queue.match_slave('foo', {'family': 'posix'}) self.assertEqual(1, len(platforms)) self.assertEqual(platform_id, platforms[0].id)
def test_register_slave_match_regexp_multi(self): BuildConfig(self.env, 'test', active=True).insert() platform = TargetPlatform(self.env, config='test', name="Unix") platform.rules.append(('os', '^Linux')) platform.rules.append(('processor', '^[xi]\d?86$')) platform.insert() platform_id = platform.id queue = BuildQueue(self.env) platforms = queue.match_slave('foo', {'os': 'Linux', 'processor': 'i686'}) self.assertEqual(1, len(platforms)) self.assertEqual(platform_id, platforms[0].id)