Exemple #1
0
    def test_do_build(self):
        ninja_build = Ninja(args=self.args,
                            toolchain=self.toolchain,
                            source_dir=self.workspace.source_dir('ninja'),
                            build_dir=self.workspace.build_dir(
                                'build', 'ninja'))

        ninja_build.do_build()

        expect_env = ""
        if platform.system() == "Darwin":
            expect_env = (
                "env "
                "'CFLAGS=-isysroot {sysroot} -mmacosx-version-min=10.9' "
                "CXX={cxx} "
                "LDFLAGS=-mmacosx-version-min=10.9 ").format(
                    cxx=self.toolchain.cxx, sysroot=xcrun.sdk_path('macosx'))

        self.assertEqual(
            self.stdout.getvalue(), """\
+ rm -rf {build_dir}
+ cp -r {source_dir} {build_dir}
+ pushd {build_dir}
+ {expect_env}{python} configure.py --bootstrap
+ popd
""".format(source_dir=os.path.join(self.workspace.source_root, 'ninja'),
           build_dir=os.path.join(self.workspace.build_root, 'ninja-build'),
           expect_env=expect_env,
           python=sys.executable))
Exemple #2
0
    def test_do_build(self):
        ninja_build = Ninja(
            args=self.args,
            toolchain=self.toolchain,
            source_dir=self.workspace.source_dir('ninja'),
            build_dir=self.workspace.build_dir('build', 'ninja'))

        ninja_build.do_build()

        expect_env = ""
        if platform.system() == "Darwin":
            expect_env = (
                "env "
                "'CFLAGS=-isysroot {sysroot} -mmacosx-version-min=10.9' "
                "CXX={cxx} "
                "LDFLAGS=-mmacosx-version-min=10.9 "
            ).format(
                cxx=self.toolchain.cxx,
                sysroot=xcrun.sdk_path('macosx')
            )

        self.assertEqual(self.stdout.getvalue(), """\
+ rm -rf {build_dir}
+ cp -r {source_dir} {build_dir}
+ pushd {build_dir}
+ {expect_env}{python} configure.py --bootstrap
+ popd
""".format(
            source_dir=os.path.join(self.workspace.source_root, 'ninja'),
            build_dir=os.path.join(self.workspace.build_root, 'ninja-build'),
            expect_env=expect_env,
            python=sys.executable))
Exemple #3
0
    def test_ninja_bin_path(self):
        ninja_build = Ninja(args=self.args,
                            toolchain=self.toolchain,
                            source_dir='/path/to/src',
                            build_dir='/path/to/build')

        self.assertEqual(ninja_build.ninja_bin_path, '/path/to/build/ninja')
    def test_build(self):
        ninja_build = Ninja.new_builder(args=self.args,
                                        toolchain=self.toolchain,
                                        workspace=self.workspace,
                                        host=self.host)

        ninja_build.build()

        expect_env = ""
        if platform.system() == "Darwin":
            expect_env = ("env "
                          "'CFLAGS=-isysroot {sysroot}' "
                          "CXX={cxx} "
                          "'LDFLAGS=-isysroot {sysroot}' ").format(
                              cxx=self.toolchain.cxx,
                              sysroot=xcrun.sdk_path('macosx'))
        elif self.toolchain.cxx:
            expect_env = ("env " "CXX={cxx} ").format(cxx=self.toolchain.cxx, )

        self.assertEqual(
            self.stdout.getvalue(), """\
+ rm -rf {build_dir}
+ cp -r {source_dir} {build_dir}
+ pushd {build_dir}
+ {expect_env}{python} configure.py --bootstrap
+ popd
""".format(source_dir=self._platform_quote(self.workspace.source_dir('ninja')),
           build_dir=self._platform_quote(
               self.workspace.build_dir('build', 'ninja')),
           expect_env=expect_env,
           python=self._platform_quote(sys.executable)))
Exemple #5
0
    def test_ninja_bin_path(self):
        ninja_build = Ninja.new_builder(args=self.args,
                                        toolchain=self.toolchain,
                                        workspace=self.workspace,
                                        host=self.host)

        self.assertEqual(
            ninja_build.ninja_bin_path,
            os.path.join(self.workspace.build_dir('build', 'ninja'), 'ninja'))