示例#1
0
 def formatCommandLine(self, target):
     command = formatMakeCommand(TEST_MAKEFILE, [target],
                                 STAT_NAMESPACE='ide_' +
                                 self.makefileProject.name)
     return escape("cd..&&" + " ".join(command), {
         '"': '"',
         "'": "'"
     })
示例#2
0
    def test_formatMakeCommand_onLinux64(self):
        self.patch(CUT, services.getPlatform.__name__, return_value="Linux64")
        makeTool = attributes.MAKE_TOOL["Linux64"]
        filename = "some_make_file.mak"
        expected = [makeTool, "-f", filename]

        command = services.formatMakeCommand(filename)

        self.assertEqual(expected, command)
示例#3
0
    def test_formatMakeCommand_uponUnknownPlatform(self):
        self.patch(CUT,
                   services.getPlatform.__name__,
                   return_value="unknown-fake")
        filename = "some_make_file.mak"
        expected = ["make", "-f", filename]

        command = services.formatMakeCommand(filename)

        self.assertEqual(expected, command)
示例#4
0
    def test_formatMakeCommand_onLinux32WithMakeInstalled(self):
        self.patch(CUT, services.getPlatform.__name__, return_value="Linux32")
        makeTool = "make"
        self.patch(CUT, services.locateFile.__name__, return_value=makeTool)
        filename = "some_make_file.mak"
        expected = [makeTool, "-f", filename]

        command = services.formatMakeCommand(filename)

        self.assertEqual(expected, command)
示例#5
0
    def test_formatMakeCommand_simpleOnWindows64Bit(self):
        self.patch(CUT,
                   services.getPlatform.__name__,
                   return_value="Windows64")
        filename = "some_make_file.mak"
        makeTool = attributes.MAKE_TOOL["Windows64"]
        expected = [makeTool, "-f", filename]

        command = services.formatMakeCommand(filename)

        self.assertEqual(expected, command)
示例#6
0
    def test_formatMakeCommand_withArguments(self):
        self.patch(CUT,
                   services.getPlatform.__name__,
                   return_value="Windows64")
        filename = "some_make_file.mak"
        makeTool = attributes.MAKE_TOOL["Windows64"]
        args = ["clean", "build"]
        expected = [makeTool, "-f", filename] + args

        command = services.formatMakeCommand(filename, args)

        self.assertEqual(expected, command)
示例#7
0
 def compile(self):
     environ = dict(os.environ, STAT_NAMESPACE=self.__makefile.name)
     makeCommand = formatMakeCommand(
         self.__fileName,
         self.__arguments,
     )
     status, log = execute(makeCommand,
                           beSilent=self.__beSilent,
                           env=environ)
     self.__log.extend(log)
     if status:
         raise TestsRunnerException(
             'Package "{0}" failed to compile.'.format(self.__fileName))
 def setUp(self):
     self._doBeforeSetup()
     self.patch(CUT, isWindows.__name__, return_value=self.isOnWindows)
     self.maxDiff = None
     if not os.path.isdir(attributes.IDE_DIRECTORY):
         os.mkdir(attributes.IDE_DIRECTORY)
     remove(TEST_IDE_DIRECTORY)
     self.makefileProject = StatMakefileProject(TEST_MAKEFILE)
     self.writer = VsCodeWriter(self.makefileProject)
     namespace = "ide_{0}".format(TEST_TARGET_NAME)
     command = formatMakeCommand(TEST_MAKEFILE, STAT_NAMESPACE=namespace)
     self.makeTool = command[0]
     self.makeArguments = command[1:]
     self.foldersInitConfig = [{
         "name": TEST_IDE_DIRECTORY,
         "path": os.path.abspath(TEST_IDE_DIRECTORY)
     }]
示例#9
0
    def test_formatMakeCommand_withArgumentsAndVars(self):
        self.patch(CUT,
                   services.getPlatform.__name__,
                   return_value="Windows64")
        filename = "some_make_file.mak"
        args = ["clean", "build"]
        expected = [
            "clean", "build", 'SOME_NAME="some-value"',
            'ANOTHER="anotherValue"'
        ]

        command = services.formatMakeCommand(filename,
                                             args,
                                             SOME_NAME="some-value",
                                             ANOTHER="anotherValue")

        self.assertSameItems(expected, command[-4:])
 def formatMakeCommand(self, target):
     return formatMakeCommand(self._contents.makefile, [target],
                              STAT_NAMESPACE=self.namespace)