Example #1
0
 def testStripFileExtension(self):
     files = (("test.c", "test"), ("test.o", "test"), ("test.s", "test"),
              ("test.S", "test"), ("test.i", "test"), ("test.ii", "test"),
              ("test", "test"), ("test.c.o", "test.c"),
              (".test.c", ".test"), ("../../../../.test.c",
                                     "../../../../.test"),
              ("./.test.c.c", "./.test.c"), ("../../test.o.c.ii",
                                             "../../test.o.c"))
     for file in files:
         self.assertEqual(FileUtils.strip_file_extension(file[0]), file[1])
Example #2
0
 def testStripFileExtension(self):
     files =    (
         ("test.c", "test"),
         ("test.o", "test"),
         ("test.s", "test"),
         ("test.S", "test"),
         ("test.i", "test"),
         ("test.ii", "test"),
         ("test", "test"),
         ("test.c.o", "test.c"),
         (".test.c", ".test"),
         ("../../../../.test.c", "../../../../.test"),
         ("./.test.c.c", "./.test.c"),
         ("../../test.o.c.ii", "../../test.o.c")
         )
     for file in files:
         self.assertEqual(FileUtils.strip_file_extension(file[0]), file[1])
Example #3
0
    def get_output_file_name_for_step(self, input_file, stop_step):
        """Take a filename as input, and return the name of the file
        that will be output if we execute the command :
        gcc -stop_step filename."""

        # associate a stop level to the corresponding output
        # filename extension
        # 1 is stoping after preprocessing and before compilation
        # 2 is stoping after compilation and before assembly
        # 3 is stoping after assembly and before linking
        output_extensions = {1: ".i", 2: ".s", 3: ".o"}

        start_level = get_start_step_of_file(input_file)
        if start_level > stop_step:
            # here we want the compilation process to stop when it starts,
            # so nothing is output
            return ""
        else:
            new_ext = output_extensions[stop_step]
            return FileUtils.strip_file_extension(input_file) + new_ext
Example #4
0
    def get_output_file_name_for_step(self, input_file, stop_step):
        """Take a filename as input, and return the name of the file
        that will be output if we execute the command :
        gcc -stop_step filename."""

        # associate a stop level to the corresponding output
        # filename extension
        # 1 is stoping after preprocessing and before compilation
        # 2 is stoping after compilation and before assembly
        # 3 is stoping after assembly and before linking
        output_extensions = {1: ".i", 2: ".s", 3: ".o"}

        start_level = get_start_step_of_file(input_file)
        if start_level > stop_step:
            # here we want the compilation process to stop when it starts,
            # so nothing is output
            return ""
        else:
            new_ext = output_extensions[stop_step]
            return FileUtils.strip_file_extension(input_file) + new_ext