Esempio n. 1
0
    def test_processCommandline13(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            overrideFilePath = os.path.join(tempDir, "testOverrides")
            mdTestUtilities.createBlankFile(overrideFilePath)

            testOptions = options.Options()
            commandline = "MixDown --import -otestOverrides"
            self.assertEquals(
                testOptions.processCommandline(commandline.split(" ")), False,
                "Command-line should not have processed correctly")
            self.assertEquals(testOptions.targetsToImport, [],
                              "targetsToImport should have not been set")
            self.assertEquals(testOptions.overrideFile, "",
                              "overrideFile should not have been set")
            self.assertEquals(testOptions.overrideGroup, None,
                              "overrideGroup should not have been set")
            self.assertEquals(testOptions.compilerGroupName, "",
                              "compilerGroupName should not have been set")
            self.assertEquals(
                testOptions.optimizationGroupName, "",
                "optimizationGroupName should not have been set")
            self.assertEquals(testOptions.parallelGroupName, "",
                              "parallelGroupName should not have been set")
        finally:
            utilityFunctions.removeDir(tempDir)
Esempio n. 2
0
 def test_examineWithOnlyMakefile(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         targetDir = os.path.join(tempDir, "targetDir")
         os.makedirs(targetDir)
         mdTestUtilities.createBlankFile(os.path.join(
             targetDir, "Makefile"))
         option = options.Options()
         option.buildDir = os.path.join(tempDir, option.buildDir)
         option.importMode = True
         targets = target.Target("OnlyMakefile", targetDir)
         targets.examine(option)
         targets.expandDefines(option)
         self.assertEquals(
             targets.findBuildStep("preconfig").command, "",
             "Target with only Makefile returned a preconfig command when it should not have"
         )
         self.assertEquals(
             targets.findBuildStep("config").command, "",
             "Target with only Makefile returned a config command when it should not have"
         )
         self.assertEquals(
             targets.findBuildStep("build").command, "make",
             "Target with only Makefile returned wrong build command")
         self.assertEquals(
             targets.findBuildStep("install").command, "make install",
             "Target with only Makefile returned wrong install command")
     finally:
         utilityFunctions.removeDir(tempDir)
Esempio n. 3
0
    def test_processCommandline29(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            overrideFilePath = os.path.join(tempDir, "testOverrides")
            mdTestUtilities.createBlankFile(overrideFilePath)
            projectFilePath = os.path.join(tempDir, "test.md")
            mdTestUtilities.createBlankFile(projectFilePath)

            testOptions = options.Options()
            commandline = "MixDown -o" + overrideFilePath + " -g,, " + projectFilePath
            self.assertEquals(
                testOptions.processCommandline(commandline.split(" ")), False,
                "Command-line should not have processed correctly")
            self.assertEquals(testOptions.overrideFile, overrideFilePath,
                              "overrideFile should have been set")
            self.assertEquals(testOptions.overrideGroup, None,
                              "overrideGroup should not have been set")
            self.assertEquals(testOptions.compilerGroupName, "",
                              "compilerGroupName should have been set")
            self.assertEquals(testOptions.optimizationGroupName, "",
                              "optimizationGroupName should have been set")
            self.assertEquals(testOptions.parallelGroupName, "",
                              "parallelGroupName should have been set")
        finally:
            utilityFunctions.removeDir(tempDir)
Esempio n. 4
0
 def test_isCMakeProject2(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tempFile = os.path.join(tempDir, "CMakeLists.txt")
         mdTestUtilities.createBlankFile(tempFile)
         self.assertTrue(cmake.isCMakeProject(tempDir), "Failed to detect CMake project.")
     finally:
         utilityFunctions.removeDir(tempDir)
Esempio n. 5
0
 def test_isAutoToolsProject4(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tempFile = os.path.join(tempDir, "configure.ac")
         mdTestUtilities.createBlankFile(tempFile)
         self.assertTrue(autoTools.isAutoToolsProject(tempDir), "Failed to detect AutoTools project.")
     finally:
         utilityFunctions.removeDir(tempDir)
Esempio n. 6
0
 def test_isAutoToolsProject4(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tempFile = os.path.join(tempDir, "configure.ac")
         mdTestUtilities.createBlankFile(tempFile)
         self.assertTrue(autoTools.isAutoToolsProject(tempDir),
                         "Failed to detect AutoTools project.")
     finally:
         utilityFunctions.removeDir(tempDir)
Esempio n. 7
0
 def test_isCMakeProject2(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tempFile = os.path.join(tempDir, "CMakeLists.txt")
         mdTestUtilities.createBlankFile(tempFile)
         self.assertTrue(cmake.isCMakeProject(tempDir),
                         "Failed to detect CMake project.")
     finally:
         utilityFunctions.removeDir(tempDir)
Esempio n. 8
0
 def test_findExecutables06(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         testExe = os.path.join(tempDir, "gcc")
         mdTestUtilities.createBlankFile(testExe)
         mdTestUtilities.createBlankFile(os.path.join(tempDir, "test"))
         exes = profiler.findExecutables([(tempDir, True)], ["gcc"])
         self.assertEquals(len(exes), 0, "profiler.findExecutables did not find the right amount of executables")
     finally:
         utilityFunctions.removeDir(tempDir)
 def test_pathExists5(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         directory = os.path.join(tempDir, "testDir")
         os.makedirs(directory)
         mdTestUtilities.createBlankFile(os.path.join(directory, "test"))
         wrongPath = os.path.join(os.path.join(tempDir, "TeStDiR"), "test")
         self.assertEquals(utilityFunctions.pathExists(wrongPath, True),
                           False, "pathExists should have returned False")
     finally:
         utilityFunctions.removeDir(tempDir)
Esempio n. 10
0
 def test_pathExists5(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         directory = os.path.join(tempDir, "testDir")
         os.makedirs(directory)
         mdTestUtilities.createBlankFile(os.path.join(directory, "test"))
         wrongPath = os.path.join(os.path.join(tempDir, "TeStDiR"), "test")
         self.assertEquals(
             utilityFunctions.pathExists(wrongPath, True), False, "pathExists should have returned False"
         )
     finally:
         utilityFunctions.removeDir(tempDir)
Esempio n. 11
0
    def test_validate02(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            projectFilePath = os.path.join(tempDir, "test.md")
            mdTestUtilities.createBlankFile(projectFilePath)

            testOptions = options.Options()
            commandline = "MixDown " + projectFilePath + " -ptestPrefix -v -ggcc,debug,parallel"
            self.assertEquals(testOptions.processCommandline(commandline.split(" ")), True, "Command-line should have processed correctly")
            self.assertEquals(testOptions.validate(), False, "Command-line options should not have validated")
        finally:
            utilityFunctions.removeDir(tempDir)
Esempio n. 12
0
 def test_findExecutables06(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         testExe = os.path.join(tempDir, "gcc")
         mdTestUtilities.createBlankFile(testExe)
         mdTestUtilities.createBlankFile(os.path.join(tempDir, "test"))
         exes = profiler.findExecutables([(tempDir, True)], ["gcc"])
         self.assertEquals(
             len(exes), 0,
             "profiler.findExecutables did not find the right amount of executables"
         )
     finally:
         utilityFunctions.removeDir(tempDir)
Esempio n. 13
0
    def test_findExecutables07(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()

            mdTestUtilities.createBlankFile(os.path.join(tempDir, "test"))

            aDir = os.path.join(tempDir, 'a')
            aGccExe = os.path.join(aDir, "gcc")
            mdTestUtilities.createBlankFile(aGccExe)
            mdTestUtilities.makeFileExecutable(aGccExe)

            bDir = os.path.join(tempDir, 'b')
            bIccExe = os.path.join(bDir, "icc")
            mdTestUtilities.createBlankFile(bIccExe)
            mdTestUtilities.makeFileExecutable(bIccExe)

            acDir = os.path.join(os.path.join(tempDir, 'a'), 'c')
            acIccExe = os.path.join(acDir, "icc")
            mdTestUtilities.createBlankFile(acIccExe)
            mdTestUtilities.makeFileExecutable(acIccExe)

            exes = profiler.findExecutables([(tempDir, True)], ["icc", "gcc"])
            self.assertEquals(len(exes), 3, "profiler.findExecutables did not find the right amount of executables")
            self.assertTrue(aGccExe in exes, "profiler.findExecutables did not find the right executable")
            self.assertTrue(bIccExe in exes, "profiler.findExecutables did not find the right executable")
            self.assertTrue(acIccExe in exes, "profiler.findExecutables did not find the right executable")
        finally:
            utilityFunctions.removeDir(tempDir)
Esempio n. 14
0
    def test_validate01(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            projectFilePath = os.path.join(tempDir, "test.md")
            mdTestUtilities.createBlankFile(projectFilePath)

            testOptions = options.Options()
            commandline = "MixDown " + projectFilePath + " -ptestPrefix -v -otestOverrides -ggcc,debug,parallel"
            self.assertEquals(
                testOptions.processCommandline(commandline.split(" ")), True,
                "Command-line should have processed correctly")
            self.assertEquals(testOptions.validate(), True,
                              "Command-line options should have validated")
        finally:
            utilityFunctions.removeDir(tempDir)
Esempio n. 15
0
    def test_processCommandline11(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)
            projectFilePath = os.path.join(tempDir, "test.md")
            mdTestUtilities.createBlankFile(projectFilePath)

            testOptions = options.Options()
            commandline = "MixDown " + tarPath + " " + projectFilePath
            self.assertEquals(testOptions.processCommandline(commandline.split(" ")), False, "Command-line should not have processed correctly")
            self.assertEquals(testOptions.targetsToImport, [], "targetsToImport should have not been set")
            self.assertEquals(testOptions.projectFile, "", "projectFile should not have been set")
        finally:
            utilityFunctions.removeDir(tempDir)
Esempio n. 16
0
    def test_processCommandline13(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            overrideFilePath = os.path.join(tempDir, "testOverrides")
            mdTestUtilities.createBlankFile(overrideFilePath)

            testOptions = options.Options()
            commandline = "MixDown --import -otestOverrides"
            self.assertEquals(testOptions.processCommandline(commandline.split(" ")), False, "Command-line should not have processed correctly")
            self.assertEquals(testOptions.targetsToImport, [], "targetsToImport should have not been set")
            self.assertEquals(testOptions.overrideFile, "", "overrideFile should not have been set")
            self.assertEquals(testOptions.overrideGroup, None, "overrideGroup should not have been set")
            self.assertEquals(testOptions.compilerGroupName, "", "compilerGroupName should not have been set")
            self.assertEquals(testOptions.optimizationGroupName, "", "optimizationGroupName should not have been set")
            self.assertEquals(testOptions.parallelGroupName, "", "parallelGroupName should not have been set")
        finally:
            utilityFunctions.removeDir(tempDir)
Esempio n. 17
0
 def test_examineWithOnlyMakefile(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         targetDir = os.path.join(tempDir, "targetDir")
         os.makedirs(targetDir)
         mdTestUtilities.createBlankFile(os.path.join(targetDir, "Makefile"))
         option = options.Options()
         option.buildDir = os.path.join(tempDir, option.buildDir)
         option.importMode = True
         targets = target.Target("OnlyMakefile", targetDir)
         targets.examine(option)
         targets.expandDefines(option)
         self.assertEquals(targets.findBuildStep("preconfig").command, "", "Target with only Makefile returned a preconfig command when it should not have")
         self.assertEquals(targets.findBuildStep("config").command, "", "Target with only Makefile returned a config command when it should not have")
         self.assertEquals(targets.findBuildStep("build").command, "make", "Target with only Makefile returned wrong build command")
         self.assertEquals(targets.findBuildStep("install").command, "make install", "Target with only Makefile returned wrong install command")
     finally:
         utilityFunctions.removeDir(tempDir)
Esempio n. 18
0
    def test_processCommandline29(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            overrideFilePath = os.path.join(tempDir, "testOverrides")
            mdTestUtilities.createBlankFile(overrideFilePath)
            projectFilePath = os.path.join(tempDir, "test.md")
            mdTestUtilities.createBlankFile(projectFilePath)

            testOptions = options.Options()
            commandline = "MixDown -o" + overrideFilePath + " -g,, " + projectFilePath
            self.assertEquals(testOptions.processCommandline(commandline.split(" ")), False, "Command-line should not have processed correctly")
            self.assertEquals(testOptions.overrideFile, overrideFilePath, "overrideFile should have been set")
            self.assertEquals(testOptions.overrideGroup, None, "overrideGroup should not have been set")
            self.assertEquals(testOptions.compilerGroupName, "", "compilerGroupName should have been set")
            self.assertEquals(testOptions.optimizationGroupName, "", "optimizationGroupName should have been set")
            self.assertEquals(testOptions.parallelGroupName, "", "parallelGroupName should have been set")
        finally:
            utilityFunctions.removeDir(tempDir)
Esempio n. 19
0
    def test_processCommandline11(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)
            projectFilePath = os.path.join(tempDir, "test.md")
            mdTestUtilities.createBlankFile(projectFilePath)

            testOptions = options.Options()
            commandline = "MixDown " + tarPath + " " + projectFilePath
            self.assertEquals(
                testOptions.processCommandline(commandline.split(" ")), False,
                "Command-line should not have processed correctly")
            self.assertEquals(testOptions.targetsToImport, [],
                              "targetsToImport should have not been set")
            self.assertEquals(testOptions.projectFile, "",
                              "projectFile should not have been set")
        finally:
            utilityFunctions.removeDir(tempDir)
 def test_pathExists3(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tempFile = mdTestUtilities.createBlankFile(
             os.path.join(tempDir, "test"))
         self.assertEquals(
             utilityFunctions.pathExists(os.path.join(tempDir, "TeSt"),
                                         True), False,
             "pathExists should have returned False")
     finally:
         utilityFunctions.removeDir(tempDir)
Esempio n. 21
0
 def test_pathExists3(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tempFile = mdTestUtilities.createBlankFile(os.path.join(tempDir, "test"))
         self.assertEquals(
             utilityFunctions.pathExists(os.path.join(tempDir, "TeSt"), True),
             False,
             "pathExists should have returned False",
         )
     finally:
         utilityFunctions.removeDir(tempDir)
Esempio n. 22
0
    def test_findExecutables07(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()

            mdTestUtilities.createBlankFile(os.path.join(tempDir, "test"))

            aDir = os.path.join(tempDir, 'a')
            aGccExe = os.path.join(aDir, "gcc")
            mdTestUtilities.createBlankFile(aGccExe)
            mdTestUtilities.makeFileExecutable(aGccExe)

            bDir = os.path.join(tempDir, 'b')
            bIccExe = os.path.join(bDir, "icc")
            mdTestUtilities.createBlankFile(bIccExe)
            mdTestUtilities.makeFileExecutable(bIccExe)

            acDir = os.path.join(os.path.join(tempDir, 'a'), 'c')
            acIccExe = os.path.join(acDir, "icc")
            mdTestUtilities.createBlankFile(acIccExe)
            mdTestUtilities.makeFileExecutable(acIccExe)

            exes = profiler.findExecutables([(tempDir, True)], ["icc", "gcc"])
            self.assertEquals(
                len(exes), 3,
                "profiler.findExecutables did not find the right amount of executables"
            )
            self.assertTrue(
                aGccExe in exes,
                "profiler.findExecutables did not find the right executable")
            self.assertTrue(
                bIccExe in exes,
                "profiler.findExecutables did not find the right executable")
            self.assertTrue(
                acIccExe in exes,
                "profiler.findExecutables did not find the right executable")
        finally:
            utilityFunctions.removeDir(tempDir)