def testGenerateGypStanzaWildCard(self): a = SourceSet(set(['foo.c']), set([SourceListCondition('x64', 'Chromium', '*')])) gyp_stanza = a.GenerateGypStanza() gn_stanza = a.GenerateGnStanza() for stanza in [gyp_stanza, gn_stanza]: string.index(stanza, '== "x64"') string.index(stanza, 'ffmpeg_branding == "Chromium"') # OS is wild-card, so it should not be mentioned in the stanza. self.assertEqual(-1, string.find(stanza, 'OS =='))
def testGenerateGypStanza(self): # ia32 should just be ia32. Win should appear as an OS restriction. a = SourceSet(set(['a', 'b']), set([SourceListCondition('ia32', 'Chromium', 'win')])) a_stanza = a.GenerateGypStanza() string.index(a_stanza, 'target_arch == "ia32"') string.index(a_stanza, 'OS == "win"') # x64 should just be x64. Linux should appear as an OS restriction. b = SourceSet(set(['a', 'b']), set([SourceListCondition('x64', 'Chromium', 'linux')])) b_stanza = b.GenerateGypStanza() string.index(b_stanza, 'target_arch == "x64"') string.index(b_stanza, 'OS == "linux"') # arm should just be arm. c = SourceSet(set(['a', 'b']), set([SourceListCondition('arm', 'Chromium', 'linux')])) c_stanza = c.GenerateGypStanza() string.index(c_stanza, 'target_arch == "arm"') # arm-neon should be arm and flip the arm_neon switch. d = SourceSet( set(['a', 'b']), set([SourceListCondition('arm-neon', 'Chromium', 'linux')])) d_stanza = d.GenerateGypStanza() string.index(d_stanza, 'target_arch == "arm" and arm_neon == 1') # Multiple conditions e = SourceSet( set(['a', 'b']), set([ SourceListCondition('arm', 'Chrome', 'win'), SourceListCondition('x64', 'Chromium', 'linux') ])) e_stanza = e.GenerateGypStanza() string.index(e_stanza, ('OS == "win" and target_arch == "arm"' ' and ffmpeg_branding == "Chrome"')) string.index(e_stanza, ('OS == "linux" and target_arch == "x64"' ' and ffmpeg_branding == "Chromium"'))