Exemplo n.º 1
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)
Exemplo n.º 2
0
    def test_examineWithAutoToolsWithPrefix(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            targetDir = os.path.join(tempDir, "targetDir")
            os.makedirs(targetDir)
            mdTestUtilities.createBlankFiles(targetDir,
                                             ["Makefile.am", "configure.ac"])
            option = options.Options()
            defines.setPrefixDefines(option.defines, "/test/prefix")
            option.prefixDefined = True
            option.buildDir = os.path.join(tempDir, option.buildDir)
            option.importMode = True

            targets = target.Target("AutoTools", targetDir)
            targets.examine(option)
            targets.expandDefines(option)
            self.assertEquals(
                targets.findBuildStep("preconfig").command,
                "test -x configure || autoreconf -i",
                "Target with autotool files returned wrong preconfig command")
            self.assertEquals(
                targets.findBuildStep("config").command,
                "./configure --prefix=/test/prefix",
                "Target with autotool files returned wrong config command")
            self.assertEquals(
                targets.findBuildStep("build").command, "make",
                "Target with autotool files returned wrong build command")
            self.assertEquals(
                targets.findBuildStep("install").command, "make install",
                "Target with autotool files returned wrong install command")
        finally:
            utilityFunctions.removeDir(tempDir)
Exemplo n.º 3
0
    def test_examineWithDependenciesWithPrefix(self):
        option = options.Options()
        option.buildDir = "."
        option.importMode = True
        defines.setPrefixDefines(option.defines, "/test/path")
        option.prefixDefined = True

        targets = target.Target("TestCaseA",
                                "cases/simpleGraphAutoTools/TestCaseA")
        targets.dependsOn = ["TestCaseB", "TestCaseC"]
        targets.examine(option)
        targets.expandDefines(option)
        self.assertEquals(
            targets.findBuildStep("preconfig").command,
            "test -x configure || autoreconf -i",
            "'cases/simpleGraphAutoTools/TestCaseA' returned wrong preconfig command"
        )
        self.assertEquals(
            targets.findBuildStep("config").command,
            "./configure --prefix=/test/path  --with-TestCaseB=/test/path --with-TestCaseC=/test/path",
            "'cases/simpleGraphAutoTools/TestCaseA' returned wrong config command"
        )
        self.assertEquals(
            targets.findBuildStep("build").command, "make",
            "'cases/simpleGraphAutoTools/TestCaseA' returned wrong build command"
        )
        self.assertEquals(
            targets.findBuildStep("install").command, "make install",
            "'cases/simpleGraphAutoTools/TestCaseA' returned wrong install command"
        )
Exemplo n.º 4
0
    def test_examineWithJobSlots(self):
        option = options.Options()
        option.buildDir = "."
        option.importMode = True
        defines.setJobSlotsDefines(option.defines, "4")

        targets = target.Target("TestCaseA",
                                "cases/simpleGraphAutoTools/TestCaseA")
        targets.examine(option)
        targets.expandDefines(option)
        self.assertEquals(
            targets.findBuildStep("preconfig").command,
            "test -x configure || autoreconf -i",
            "'cases/simpleGraphAutoTools/TestCaseA' returned wrong preconfig command"
        )
        self.assertEquals(
            targets.findBuildStep("config").command,
            "./configure --prefix=/usr/local",
            "'cases/simpleGraphAutoTools/TestCaseA' returned wrong config command"
        )
        self.assertEquals(
            targets.findBuildStep("build").command, "make -j4",
            "'cases/simpleGraphAutoTools/TestCaseA' returned wrong build command"
        )
        self.assertEquals(
            targets.findBuildStep("install").command, "make -j4 install",
            "'cases/simpleGraphAutoTools/TestCaseA' returned wrong install command"
        )
Exemplo n.º 5
0
 def test_steps(self):
     targets = target.Target("foo", "/some/path")
     targets.skipSteps = ["b"]
     self.assertEquals(targets.isStepToBeSkipped("b"), True,
                       "Specified skipped step was not skipped")
     self.assertEquals(targets.isStepToBeSkipped("a"), False,
                       "Specified step was skipped")
Exemplo n.º 6
0
 def test_determineOutputPath1(self):
     option = options.Options()
     option.buildDir = "."
     targets = target.Target("foo", "/bar/paz")
     targets.outputPathSpecified = True
     targets.outputPath = "/outputPath"
     targets.outputPath = targets.determineOutputPath(option)
     self.assertEquals(
         targets.outputPath, "/outputPath",
         "Specified output path was overwritten by determineOutputPath.")
Exemplo n.º 7
0
 def test_determineOutputPath3(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         targetDir = os.path.join(tempDir, "targetDir")
         os.makedirs(targetDir)
         option = options.Options()
         option.buildDir = "."
         option.cleanMode = True
         targets = target.Target("foo", targetDir)
         targets.outputPath = targets.determineOutputPath(option)
         self.assertEquals(
             targets.outputPath, targetDir,
             "During cleaning found target path should not be overwritten.")
     finally:
         utilityFunctions.removeDir(tempDir)
Exemplo n.º 8
0
 def test_validate4(self):
     option = options.Options()
     targets = target.Target("foo", "/some/path")
     self.assertEquals(targets.validate(option), True,
                       "Target should have validated.")
Exemplo n.º 9
0
 def test_validate3(self):
     option = options.Options()
     targets = target.Target("", "/some/path")
     self.assertEquals(
         targets.validate(option), False,
         "False positive returned when trying to validate target.")