示例#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))
示例#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))
示例#3
0
    def test_sdk_path(self):
        # Unknown SDK
        self.assertIsNone(xcrun.sdk_path('not-a-sdk'))

        # Available SDK
        self.assertIsNotNone(xcrun.sdk_path('macosx'))
示例#4
0
    def test_sdk_path(self):
        # Unknown SDK
        self.assertIsNone(xcrun.sdk_path('not-a-sdk'))

        # Available SDK
        self.assertIsNotNone(xcrun.sdk_path('macosx'))