예제 #1
0
 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 =='))
예제 #2
0
    def testGenerateGnStanza(self):
        # ia32 should be x86.  Win should appear as an OS restriction.
        a = SourceSet(set(['a', 'b']),
                      set([SourceListCondition('ia32', 'Chromium', 'win')]))
        a_stanza = a.GenerateGnStanza()
        string.index(a_stanza, 'current_cpu == "x86"')
        string.index(a_stanza, 'is_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.GenerateGnStanza()
        string.index(b_stanza, 'current_cpu == "x64"')
        string.index(b_stanza, 'is_linux')

        # arm should just be arm.
        c = SourceSet(set(['a', 'b']),
                      set([SourceListCondition('arm', 'Chromium', 'linux')]))
        c_stanza = c.GenerateGnStanza()
        string.index(c_stanza, 'current_cpu == "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.GenerateGnStanza()
        string.index(d_stanza, 'current_cpu == "arm" && arm_use_neon')

        # Multiple conditions
        e = SourceSet(
            set(['a', 'b']),
            set([
                SourceListCondition('arm', 'Chrome', 'win'),
                SourceListCondition('x64', 'Chromium', 'linux')
            ]))
        e_stanza = e.GenerateGnStanza()
        string.index(e_stanza, ('is_win && current_cpu == "arm"'
                                ' && ffmpeg_branding == "Chrome"'))
        string.index(e_stanza, ('is_linux && current_cpu == "x64"'
                                ' && ffmpeg_branding == "Chromium"'))