Пример #1
0
    def test_a_wildcard_symlink(self):
        '''Test a wildcard in jar.mn with symlinks'''
        if not symlinks_supported(self.srcdir):
            raise unittest.SkipTest('symlinks not supported')

        self._create_wildcard_setup()
        jm = JarMaker(outputFormat='symlink')
        jm.sourcedirs = [self.srcdir]
        jm.topsourcedir = self.srcdir
        jardir = os.path.join(self.builddir, 'chrome')
        jm.makeJar(os.path.join(self.srcdir,'jar.mn'), jardir)

        expected_symlinks = {
            ('bar', 'foo.js'): ('foo.js',),
            ('bar', 'bar.js'): ('bar.js',),
            ('hoge', 'foo', '1'): ('qux', 'foo', '1'),
            ('hoge', 'foo', '2'): ('qux', 'foo', '2'),
            ('hoge', 'baz'): ('qux', 'baz'),
        }
        for dest, src in expected_symlinks.iteritems():
            srcpath = os.path.join(self.srcdir, *src)
            destpath = os.path.join(self.builddir, 'chrome', 'test', 'dir',
                                    *dest)
            self.assertTrue(is_symlink_to(destpath, srcpath),
                            "{0} is not a symlink to {1}".format(destpath,
                                                                 srcpath))
Пример #2
0
    def test_l10n_not_merge_ftl(self):
        """Test that JarMaker doesn't merge source .ftl files"""
        self._create_fluent_setup()
        jm = JarMaker(outputFormat="symlink")
        jm.sourcedirs = [self.srcdir]
        jm.topsourcedir = self.srcdir
        jm.l10nbase = self.l10nbase
        jm.l10nmerge = self.l10nmerge
        jm.relativesrcdir = "app/locales"
        jm.makeJar(os.path.join(self.srcdir, "jar.mn"), self.builddir)

        # test.ftl should be taken from the l10ndir, since it is present there
        destpath = os.path.join(self.builddir, "localization", "test", "app",
                                "test.ftl")
        srcpath = os.path.join(self.l10nbase, "app", "app", "test.ftl")
        self.assertTrue(
            is_symlink_to(destpath, srcpath),
            "{0} should be a symlink to {1}".format(destpath, srcpath),
        )

        # test2.ftl on the other hand, is only present in en-US dir, and should
        # not be linked from the build dir
        destpath = os.path.join(self.builddir, "localization", "test", "app",
                                "test2.ftl")
        self.assertFalse(os.path.isfile(destpath),
                         "test2.ftl should not be taken from en-US")
Пример #3
0
    def test_l10n_not_merge_ftl(self):
        '''Test that JarMaker doesn't merge source .ftl files'''
        self._create_fluent_setup()
        jm = JarMaker(outputFormat='symlink')
        jm.sourcedirs = [self.srcdir]
        jm.topsourcedir = self.srcdir
        jm.l10nbase = self.l10nbase
        jm.l10nmerge = self.l10nmerge
        jm.relativesrcdir = 'app/locales'
        jm.makeJar(os.path.join(self.srcdir, 'jar.mn'), self.builddir)

        # test.ftl should be taken from the l10ndir, since it is present there
        destpath = os.path.join(
            self.builddir, 'localization', 'test', 'app', 'test.ftl')
        srcpath = os.path.join(self.l10nbase, 'app', 'app', 'test.ftl')
        self.assertTrue(is_symlink_to(destpath, srcpath),
                        '{0} should be a symlink to {1}'.format(destpath,
                                                                srcpath))

        # test2.ftl on the other hand, is only present in en-US dir, and should
        # not be linked from the build dir
        destpath = os.path.join(
            self.builddir, 'localization', 'test', 'app', 'test2.ftl')
        self.assertFalse(
            os.path.isfile(destpath),
            'test2.ftl should not be taken from en-US')
Пример #4
0
    def test_a_wildcard_symlink(self):
        """Test a wildcard in jar.mn with symlinks"""
        if not symlinks_supported(self.srcdir):
            raise unittest.SkipTest("symlinks not supported")

        self._create_wildcard_setup()
        jm = JarMaker(outputFormat="symlink")
        jm.sourcedirs = [self.srcdir]
        jm.topsourcedir = self.srcdir
        jm.makeJar(os.path.join(self.srcdir, "jar.mn"), self.builddir)

        expected_symlinks = {
            ("bar", "foo.js"): ("foo.js", ),
            ("bar", "bar.js"): ("bar.js", ),
            ("hoge", "foo", "1"): ("qux", "foo", "1"),
            ("hoge", "foo", "2"): ("qux", "foo", "2"),
            ("hoge", "baz"): ("qux", "baz"),
        }
        for dest, src in six.iteritems(expected_symlinks):
            srcpath = os.path.join(self.srcdir, *src)
            destpath = os.path.join(self.builddir, "chrome", "test", "dir",
                                    *dest)
            self.assertTrue(
                is_symlink_to(destpath, srcpath),
                "{0} is not a symlink to {1}".format(destpath, srcpath),
            )
Пример #5
0
    def test_l10n_not_merge_ftl(self):
        '''Test that JarMaker doesn't merge source .ftl files'''
        self._create_fluent_setup()
        jm = JarMaker(outputFormat='symlink')
        jm.sourcedirs = [self.srcdir]
        jm.topsourcedir = self.srcdir
        jm.l10nbase = self.l10nbase
        jm.l10nmerge = self.l10nmerge
        jm.relativesrcdir = 'app/locales'
        jm.makeJar(os.path.join(self.srcdir, 'jar.mn'), self.builddir)

        # test.ftl should be taken from the l10ndir, since it is present there
        destpath = os.path.join(self.builddir, 'localization', 'test', 'app',
                                'test.ftl')
        srcpath = os.path.join(self.l10nbase, 'app', 'app', 'test.ftl')
        self.assertTrue(
            is_symlink_to(destpath, srcpath),
            '{0} should be a symlink to {1}'.format(destpath, srcpath))

        # test2.ftl on the other hand, is only present in en-US dir, and should
        # not be linked from the build dir
        destpath = os.path.join(self.builddir, 'localization', 'test', 'app',
                                'test2.ftl')
        self.assertFalse(os.path.isfile(destpath),
                         'test2.ftl should not be taken from en-US')
Пример #6
0
    def test_a_simple_symlink(self):
        '''Test a simple jar.mn with a symlink'''
        if not symlinks_supported(self.srcdir):
            raise unittest.SkipTest('symlinks not supported')

        self._create_simple_setup()
        jm = JarMaker(outputFormat='symlink')
        jm.sourcedirs = [self.srcdir]
        jm.topsourcedir = self.srcdir
        jm.makeJar(os.path.join(self.srcdir,'jar.mn'), self.builddir)
        # All we do is check that srcdir/bar points to builddir/chrome/test/dir/foo
        srcbar = os.path.join(self.srcdir, 'bar')
        destfoo = os.path.join(self.builddir, 'chrome', 'test', 'dir', 'foo')
        self.assertTrue(is_symlink_to(destfoo, srcbar),
                        "{0} is not a symlink to {1}".format(destfoo, srcbar))
Пример #7
0
    def test_a_simple_symlink(self):
        '''Test a simple jar.mn with a symlink'''
        if not symlinks_supported(self.srcdir):
            raise unittest.SkipTest('symlinks not supported')

        self._create_simple_setup()
        jm = JarMaker(outputFormat='symlink')
        jm.sourcedirs = [self.srcdir]
        jm.topsourcedir = self.srcdir
        jm.makeJar(os.path.join(self.srcdir, 'jar.mn'), self.builddir)
        # All we do is check that srcdir/bar points to builddir/chrome/test/dir/foo
        srcbar = os.path.join(self.srcdir, 'bar')
        destfoo = os.path.join(self.builddir, 'chrome', 'test', 'dir', 'foo')
        self.assertTrue(is_symlink_to(destfoo, srcbar),
                        "{0} is not a symlink to {1}".format(destfoo, srcbar))
Пример #8
0
    def test_a_simple_symlink(self):
        """Test a simple jar.mn with a symlink"""
        if not symlinks_supported(self.srcdir):
            raise unittest.SkipTest("symlinks not supported")

        self._create_simple_setup()
        jm = JarMaker(outputFormat="symlink")
        jm.sourcedirs = [self.srcdir]
        jm.topsourcedir = self.srcdir
        jm.makeJar(os.path.join(self.srcdir, "jar.mn"), self.builddir)
        # All we do is check that srcdir/bar points to builddir/chrome/test/dir/foo
        srcbar = os.path.join(self.srcdir, "bar")
        destfoo = os.path.join(self.builddir, "chrome", "test", "dir", "foo")
        self.assertTrue(
            is_symlink_to(destfoo, srcbar),
            "{0} is not a symlink to {1}".format(destfoo, srcbar),
        )