Beispiel #1
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)
Beispiel #2
0
    def test_processCommandline22(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)

            testOptions = options.Options()
            commandline = "MixDown -v -i --import " + tarPath
            self.assertEquals(
                testOptions.processCommandline(commandline.split(" ")), True,
                "Command-line should have processed correctly")
            self.assertEquals(len(testOptions.targetsToImport), 1,
                              "Number of targets to import was wrong")
            self.assertEquals(testOptions.targetsToImport[0].name, "test",
                              "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[0].path, tarPath,
                              "Target had wrong name")
            self.assertEquals(testOptions.verbose, True,
                              "verbose should have been set")
            self.assertEquals(testOptions.interactive, True,
                              "interactive should have been set")
            self.assertEquals(testOptions.validate(), True,
                              "Command-line options should have validated")
        finally:
            utilityFunctions.removeDir(tempDir)
Beispiel #3
0
 def test_readGroups12(self):
     fileContents = textwrap.dedent("""
                                    foo,*,* {
                                        ccompiler = gcc
                                        cflags = -O0
                                        testVariable = foo
                                     }
                                    """)
     try:
         tempDir = mdTestUtilities.makeTempDir()
         filePath = mdTestUtilities.makeTempFile(tempDir, fileContents)
         groups = overrides.readGroups(filePath)
         self.assertNotEquals(groups, None,
                              "readGroups() failed to read groups")
         self.assertEquals(len(groups), 1,
                           "Wrong number of groups returned")
         self.assertEquals(groups[0].compiler, "foo",
                           "readGroups() has wrong information")
         self.assertEquals(groups[0].optimization, "*",
                           "readGroups() has wrong information")
         self.assertEquals(groups[0].parallel, "*",
                           "readGroups() has wrong information")
         self.assertEquals(fullCount(groups[0]), 3,
                           "readGroups() has wrong information")
         self.assertEquals(groups[0]["ccompiler"], "gcc",
                           "readGroups() has wrong information")
         self.assertEquals(groups[0]["cflags"], "-O0",
                           "readGroups() has wrong information")
         self.assertEquals(groups[0].defines["testvariable"], "foo",
                           "readGroups() has wrong information")
     finally:
         utilityFunctions.removeDir(tempDir)
 def test_pathExists2(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tempFile = mdTestUtilities.makeTempFile(tempDir)
         self.assertEquals(utilityFunctions.pathExists(tempFile, True), True, "pathExists should have returned True")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #5
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)
    def test_subversion(self):
        svnURL = "http://subversion.tigris.org/downloads/subversion-1.6.12.tar.bz2"
        aprURL = "http://mirror.candidhosting.com/pub/apache/apr/apr-1.4.6.tar.bz2"
        aprUtilURL = "http://mirror.candidhosting.com/pub/apache//apr/apr-util-1.3.12.tar.gz"
        neonURL = "http://www.webdav.org/neon/neon-0.29.5.tar.gz"
        sqliteURL = "http://www.sqlite.org/sqlite-autoconf-3070500.tar.gz"

        skipAPRPreconfig = ""
        if socket.gethostname() == "tux316.llnl.gov":
            skipAPRPreconfig = " -sapr:preconfig"
        try:
            mixDownPath = os.path.abspath("..")
            origPath = os.environ["PATH"]
            os.environ["PATH"] = mixDownPath + ":" + origPath

            tempDir = mdTestUtilities.makeTempDir()
            downloadDir = os.path.join(tempDir, "testDownloadFiles")

            svnPath = utilityFunctions.downloadFile(svnURL, downloadDir)
            self.assertNotEquals(svnPath, "", "Svn failed to download")

            aprPath = utilityFunctions.downloadFile(aprURL, downloadDir)
            self.assertNotEquals(aprPath, "", "Apr failed to download")

            aprUtilPath = utilityFunctions.downloadFile(
                aprUtilURL, downloadDir)
            self.assertNotEquals(aprUtilPath, "",
                                 "Apr Util failed to download")

            neonPath = utilityFunctions.downloadFile(neonURL, downloadDir)
            self.assertNotEquals(neonPath, "", "Neon failed to download")

            sqlitePath = utilityFunctions.downloadFile(sqliteURL, downloadDir)
            self.assertNotEquals(sqlitePath, "", "Sqlite failed to download")

            importRC = utilityFunctions.executeSubProcess(
                "mixdown --import " + svnPath + " " + aprPath + " " +
                aprUtilPath + " " + neonPath + " " + sqlitePath, tempDir)
            self.assertEquals(importRC, 0,
                              "Subversion test case failed import.")

            buildRC = utilityFunctions.executeSubProcess(
                "mixdown subversion-1.6.12.md -ptestPrefix" + skipAPRPreconfig,
                tempDir)
            self.assertEquals(buildRC, 0, "Subversion test case failed build.")

            cleanRC = utilityFunctions.executeSubProcess(
                "mixdown --clean subversion-1.6.12.md", tempDir)
            self.assertEquals(cleanRC, 0, "Subversion test case failed clean.")

            prefix = os.path.join(tempDir, "testPrefix")
            binDir = os.path.join(prefix, "bin")
            libDir = os.path.join(prefix, "lib")
            self.assertEquals(
                os.path.exists(os.path.join(binDir, "svn")), True,
                "Executable does not exist after building CMake Hello test case."
            )
        finally:
            utilityFunctions.removeDir(tempDir)
            os.environ["PATH"] = origPath
Beispiel #7
0
 def test_unpackSvn(self):
     if not svn.isSvnInstalled():
         self.fail(
             "Svn is not installed on your system.  All Svn tests will fail."
         )
     try:
         tempDir = mdTestUtilities.makeTempDir()
         repoPath = mdTestUtilities.createSvnRepository(tempDir)
         pci = createPythonCallInfo(repoPath,
                                    os.path.join(tempDir, "output"),
                                    os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         testFilePath = os.path.join(pci.outputPath,
                                     mdTestUtilities.testFileName)
         self.assertEqual(pci.success, True,
                          "Svn repository failed to fetch.")
         self.assertEqual(
             os.path.exists(testFilePath), True,
             "'" + mdTestUtilities.testFileName +
             "' did not exist after fetching a Svn repository.")
         pci = steps.unpack(pci)
         self.assertEqual(pci.success, True,
                          "Svn repository failed to unpack.")
         self.assertEqual(
             os.path.isdir(pci.currentPath), True,
             "Svn repository was not a directory after unpacking.")
         self.assertEqual(
             os.path.exists(
                 os.path.join(pci.currentPath,
                              mdTestUtilities.testFileName)), True,
             "testFile did not exist after unpacking.")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #8
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)
Beispiel #9
0
    def test_readGroups01(self):
        fileContents = textwrap.dedent("""
                                       gcc, *, * {
                                           ccompiler = gcc
                                           cflags = -O0
                                           testVariable = baseVar
                                       }

                                       gcc, release, * {
                                           cflags = -O2
                                           testVariable = releaseVar
                                       }

                                       """)
        try:
            tempDir = mdTestUtilities.makeTempDir()
            filePath = mdTestUtilities.makeTempFile(tempDir, fileContents)
            groups = overrides.readGroups(filePath)
            self.assertNotEquals(groups, None, "readGroups() failed to read groups")
            self.assertEquals(len(groups), 2, "Wrong number of groups returned")
            self.assertEquals(groups[0].compiler, "gcc", "readGroups() has wrong information")
            self.assertEquals(groups[0].optimization, "*", "readGroups() has wrong information")
            self.assertEquals(groups[0].parallel, "*", "readGroups() has wrong information")
            self.assertEquals(fullCount(groups[0]), 3, "readGroups() has wrong information")
            self.assertEquals(groups[0]["ccompiler"], "gcc", "readGroups() has wrong information")
            self.assertEquals(groups[0]["cflags"], "-O0", "readGroups() has wrong information")
            self.assertEquals(groups[0].defines["testvariable"], "baseVar", "readGroups() has wrong information")
            self.assertEquals(groups[1].compiler, "gcc", "readGroups() has wrong information")
            self.assertEquals(groups[1].optimization, "release", "readGroups() has wrong information")
            self.assertEquals(groups[1].parallel, "*", "readGroups() has wrong information")
            self.assertEquals(fullCount(groups[1]), 2, "readGroups() has wrong information")
            self.assertEquals(groups[1]["cflags"], "-O2", "readGroups() has wrong information")
            self.assertEquals(groups[1].defines["testvariable"], "releaseVar", "readGroups() has wrong information")
        finally:
            utilityFunctions.removeDir(tempDir)
Beispiel #10
0
 def test_unpackZip(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         zipDir, zipName = mdTestUtilities.createZipFile(tempDir)
         zipPath = os.path.join(tempDir, zipName)
         pci = createPythonCallInfo(zipPath,
                                    os.path.join(tempDir, "output"),
                                    os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         self.assertEqual(pci.success, True,
                          "Local Zip file failed to fetch.")
         self.assertEqual(os.path.exists(pci.currentPath), True,
                          "Zip file did not exist after fetching.")
         self.assertEqual(zipfile.is_zipfile(pci.currentPath), True,
                          "Zip file was not a tar file after fetching.")
         pci = steps.unpack(pci)
         self.assertEqual(pci.success, True, "Zip file failed to unpack.")
         self.assertEqual(os.path.isdir(pci.currentPath), True,
                          "Zip file was not a directory after unpacking.")
         self.assertEqual(
             os.path.exists(
                 os.path.join(pci.currentPath,
                              mdTestUtilities.testFileName)), True,
             "testFile did not exist after unpacking.")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #11
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)
Beispiel #12
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)
Beispiel #13
0
    def test_processCommandline05(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            url = "http://www.webdav.org/neon/neon-0.29.5.tar.gz"
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)
            directory = os.path.join(tempDir, "c")
            os.mkdir(directory)

            testOptions = options.Options()
            commandline = "MixDown --import " + url + " " + tarPath + " " + directory
            self.assertEquals(
                testOptions.processCommandline(commandline.split(" ")), True,
                "Command-line should have processed correctly")
            self.assertEquals(len(testOptions.targetsToImport), 3,
                              "Number of targets to import was wrong")
            self.assertEquals(testOptions.targetsToImport[0].name, "neon",
                              "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[0].path, url,
                              "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[1].name, "test",
                              "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[1].path, tarPath,
                              "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[2].name, "c",
                              "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[2].path, directory,
                              "Target had wrong name")
            self.assertEquals(testOptions.validate(), True,
                              "Command-line options should have validated")
        finally:
            utilityFunctions.removeDir(tempDir)
 def test_pathExists2(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tempFile = mdTestUtilities.makeTempFile(tempDir)
         self.assertEquals(utilityFunctions.pathExists(tempFile, True),
                           True, "pathExists should have returned True")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #15
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)
Beispiel #16
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)
 def test_pathExists4(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         self.assertEquals(
             utilityFunctions.pathExists(os.path.join(tempDir, "test"),
                                         True), False,
             "pathExists should have returned False")
     finally:
         utilityFunctions.removeDir(tempDir)
 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)
Beispiel #19
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)
Beispiel #20
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_pathExists4(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         self.assertEquals(
             utilityFunctions.pathExists(os.path.join(tempDir, "test"), True),
             False,
             "pathExists should have returned False",
         )
     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)
Beispiel #23
0
 def test_targetPathToName01(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createBzipFile(tempDir)
         tarPath = os.path.join(tempDir, tarName)
         path = os.path.join(tempDir, "apr-1.4.5.tar.bz2")
         shutil.move(tarPath, path)
         name = target.targetPathToName(path)
         self.assertEquals(name, "apr", "Wrong name returned")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #24
0
 def test_targetPathToName01(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createBzipFile(tempDir)
         tarPath = os.path.join(tempDir, tarName)
         path = os.path.join(tempDir, "apr-1.4.5.tar.bz2")
         shutil.move(tarPath, path)
         name = target.targetPathToName(path)
         self.assertEquals(name, "apr", "Wrong name returned")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #25
0
 def test_hgCheckout(self):
     if not hg.isHgInstalled():
         self.fail("Hg is not installed on your system.  All Hg tests will fail.")
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createHgRepository(tempDir)
     checkedOutRepo = os.path.join(tempDir, "checkedOut")
     try:
         hg.hgCheckout(tempRepo, checkedOutRepo)
         returnValue = os.path.exists(os.path.join(checkedOutRepo, "testFile"))
         self.assertEqual(returnValue, True, "'testFile' did not exist after hg.hgCheckout(" + tempRepo + ") was called.")
     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)
Beispiel #27
0
 def test_cvsCheckout(self):
     if not cvs.isCvsInstalled():
         self.fail("Cvs is not installed on your system.  All Cvs tests will fail.")
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createCvsRepository(tempDir)
     checkedOutRepo = os.path.join(tempDir, "checkedOut")
     try:
         cvs.cvsCheckout(tempRepo, checkedOutRepo)
         returnValue = os.path.exists(os.path.join(checkedOutRepo, mdTestUtilities.testFileName))
         self.assertEqual(returnValue, True, "'" + mdTestUtilities.testFileName + "' did not exist after cvs.cvsCheckout(" + tempRepo + ") was called.")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #28
0
 def test_fetchURL(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createGzipFile(tempDir)
         urlPath = "http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz"
         pci = createPythonCallInfo(urlPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         self.assertEqual(pci.success, True, "Gzip file failed to fetch from URL.")
         self.assertEqual(os.path.exists(pci.currentPath), True, "Gzip file did not exist after fetching.")
         self.assertEqual(tarfile.is_tarfile(pci.currentPath), True, "Gzip file was not a tar file after fetching.")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #29
0
 def test_fetchTar(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createTarFile(tempDir)
         tarPath = os.path.join(tempDir, tarName)
         pci = createPythonCallInfo(tarPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         self.assertEqual(pci.success, True, "Local tar file failed to fetch.")
         self.assertEqual(os.path.exists(pci.currentPath), True, "Tar file did not exist after fetching.")
         self.assertEqual(tarfile.is_tarfile(pci.currentPath), True, "Tar file was not a tar file after fetching.")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #30
0
 def test_gitCheckout(self):
     if not git.isGitInstalled():
         self.fail("Git is not installed on your system.  All Git tests will fail.")
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createGitRepository(tempDir)
     checkedOutRepo = os.path.join(tempDir, "checkedOut")
     try:
         git.gitCheckout(tempRepo, checkedOutRepo)
         returnValue = os.path.exists(os.path.join(checkedOutRepo, mdTestUtilities.testFileName))
         self.assertEqual(returnValue, True, "'" + mdTestUtilities.testFileName + "' did not exist after git.gitCheckout(" + tempRepo + ") was called.")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #31
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)
Beispiel #32
0
    def test_processCommandline09(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)

            testOptions = options.Options()
            commandline = "MixDown " + tarPath + " --import --clean"
            self.assertEquals(testOptions.processCommandline(commandline.split(" ")), False, "Command-line should not have processed correctly")
            self.assertEquals(testOptions.targetsToImport, [], "targetsToImport should have not been set")
        finally:
            utilityFunctions.removeDir(tempDir)
Beispiel #33
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)
Beispiel #34
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)
Beispiel #35
0
 def test_fetchSvn(self):
     if not svn.isSvnInstalled():
         self.fail("Svn is not installed on your system.  All Svn tests will fail.")
     try:
         tempDir = mdTestUtilities.makeTempDir()
         repoPath = mdTestUtilities.createSvnRepository(tempDir)
         pci = createPythonCallInfo(repoPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         testFilePath = os.path.join(pci.outputPath, mdTestUtilities.testFileName)
         self.assertEqual(pci.success, True, "Svn repository failed to fetch.")
         self.assertEqual(os.path.exists(testFilePath), True, "'" + mdTestUtilities.testFileName + "' did not exist after fetching a Svn repository.")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #36
0
 def test_isGitRepoCase1(self):
     #Case 1: Local directory that is a git repository
     if not git.isGitInstalled():
         self.fail("Git is not installed on your system.  All Git tests will fail.")
     #Create repository and test if is git repo
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createGitRepository(tempDir)
     try:
         self.assertTrue(git.isGitRepo(tempRepo), "git.isGitRepo(" + tempRepo + ") should have returned true.")
     finally:
         utilityFunctions.removeDir(tempDir)
     #Test if wrong path returns false
     falsePath = "/foo/wrong/path"
     self.assertFalse(git.isGitRepo(falsePath), "git.isGitRepo(" + falsePath + ") should have returned false.")
Beispiel #37
0
 def test_isHgRepoCase1(self):
     #Case 1: Local directory that is a Hg repository
     if not hg.isHgInstalled():
         self.fail("Hg is not installed on your system.  All Hg tests will fail.")
     #Create repository and test if is Hg repo
     tempDir = mdTestUtilities.makeTempDir()
     path = mdTestUtilities.createHgRepository(tempDir)
     try:
         self.assertTrue(hg.isHgRepo(path), "hg.isHgRepo(" + path + ") should have returned true.")
     finally:
         utilityFunctions.removeDir(tempDir)
     #Test if wrong path returns false
     falsePath = "/foo/wrong/path"
     self.assertFalse(hg.isHgRepo(falsePath), "hg.isHgRepo(" + falsePath + ") should have returned false.")
Beispiel #38
0
    def test_subversion(self):
        svnURL = "http://subversion.tigris.org/downloads/subversion-1.6.12.tar.bz2"
        aprURL = "http://mirror.candidhosting.com/pub/apache/apr/apr-1.4.6.tar.bz2"
        aprUtilURL = "http://mirror.candidhosting.com/pub/apache//apr/apr-util-1.3.12.tar.gz"
        neonURL = "http://www.webdav.org/neon/neon-0.29.5.tar.gz"
        sqliteURL = "http://www.sqlite.org/sqlite-autoconf-3070500.tar.gz"

        skipAPRPreconfig = ""
        if socket.gethostname() == "tux316.llnl.gov":
            skipAPRPreconfig = " -sapr:preconfig"
        try:
            mixDownPath = os.path.abspath("..")
            origPath = os.environ["PATH"]
            os.environ["PATH"] = mixDownPath + ":" + origPath

            tempDir = mdTestUtilities.makeTempDir()
            downloadDir = os.path.join(tempDir, "testDownloadFiles")

            svnPath = utilityFunctions.downloadFile(svnURL, downloadDir)
            self.assertNotEquals(svnPath, "", "Svn failed to download")

            aprPath = utilityFunctions.downloadFile(aprURL, downloadDir)
            self.assertNotEquals(aprPath, "", "Apr failed to download")

            aprUtilPath = utilityFunctions.downloadFile(aprUtilURL, downloadDir)
            self.assertNotEquals(aprUtilPath, "", "Apr Util failed to download")

            neonPath = utilityFunctions.downloadFile(neonURL, downloadDir)
            self.assertNotEquals(neonPath, "", "Neon failed to download")

            sqlitePath = utilityFunctions.downloadFile(sqliteURL, downloadDir)
            self.assertNotEquals(sqlitePath, "", "Sqlite failed to download")

            importRC = utilityFunctions.executeSubProcess("mixdown --import " + svnPath + " " + aprPath + " " + aprUtilPath + " " + neonPath + " " + sqlitePath, tempDir)
            self.assertEquals(importRC, 0, "Subversion test case failed import.")

            buildRC = utilityFunctions.executeSubProcess("mixdown subversion-1.6.12.md -ptestPrefix" + skipAPRPreconfig, tempDir)
            self.assertEquals(buildRC, 0, "Subversion test case failed build.")

            cleanRC = utilityFunctions.executeSubProcess("mixdown --clean subversion-1.6.12.md", tempDir)
            self.assertEquals(cleanRC, 0, "Subversion test case failed clean.")

            prefix = os.path.join(tempDir, "testPrefix")
            binDir = os.path.join(prefix, "bin")
            libDir = os.path.join(prefix, "lib")
            self.assertEquals(os.path.exists(os.path.join(binDir, "svn")), True, "Executable does not exist after building CMake Hello test case.")
        finally:
            utilityFunctions.removeDir(tempDir)
            os.environ["PATH"] = origPath
Beispiel #39
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)
Beispiel #40
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)
Beispiel #41
0
    def test_processCommandline06(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)

            testOptions = options.Options()
            commandline = "MixDown --import " + tarPath
            self.assertEquals(testOptions.processCommandline(commandline.split(" ")), True, "Command-line should have processed correctly")
            self.assertEquals(len(testOptions.targetsToImport), 1, "Number of targets to import was wrong")
            self.assertEquals(testOptions.targetsToImport[0].name, "test", "Target had wrong name")
            self.assertEquals(testOptions.targetsToImport[0].path, tarPath, "Target had wrong name")
            self.assertEquals(testOptions.validate(), True, "Command-line options should have validated")
        finally:
            utilityFunctions.removeDir(tempDir)
Beispiel #42
0
 def test_isCvsRepo(self):
     if not cvs.isCvsInstalled():
         self.fail("Cvs is not installed on your system.  All Cvs tests will fail.")
     #Create repository and test if is cvs repo
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createCvsRepository(tempDir)
     try:
         returnValue = cvs.isCvsRepo(tempRepo)
         self.assertEqual(returnValue, True, "cvs.isCvsRepo(" + tempRepo + ") should have returned true.")
     finally:
         utilityFunctions.removeDir(tempDir)
     #Test if wrong path returns false
     falsePath = "http://foo/wrong/path"
     returnValue = cvs.isCvsRepo(falsePath)
     self.assertEqual(returnValue, False, "cvs.isCvsRepo(" + falsePath + ") should have returned false.")
Beispiel #43
0
 def test_readGroups13(self):
     fileContents = textwrap.dedent("""
                                    wrongParens, *, * (
                                        ccompiler = gcc
                                        cflags = -O0
                                        testVariable = foo
                                     )
                                    """)
     try:
         tempDir = mdTestUtilities.makeTempDir()
         filePath = mdTestUtilities.makeTempFile(tempDir, fileContents)
         groups = overrides.readGroups(filePath)
         self.assertEquals(groups, None, "readGroups() should have failed to read groups")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #44
0
 def test_isHgRepo(self):
     if not hg.isHgInstalled():
         self.fail("Hg is not installed on your system.  All Hg tests will fail.")
     #Create repository and test if is hg repo
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createHgRepository(tempDir)
     try:
         returnValue = hg.isHgRepo(tempRepo)
         self.assertEqual(returnValue, True, "hg.isHgRepo(" + tempRepo + ") should have returned true.")
     finally:
         utilityFunctions.removeDir(tempDir)
     #Test if wrong path returns false
     falsePath = "http://foo/wrong/path"
     returnValue = hg.isHgRepo(falsePath)
     self.assertEqual(returnValue, False, "hg.isHgRepo(" + falsePath + ") should have returned false.")
Beispiel #45
0
    def test_processCommandline09(self):
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, tarFile = mdTestUtilities.createTarFile(tempDir)
            tarPath = os.path.join(tempDir, tarFile)

            testOptions = options.Options()
            commandline = "MixDown " + tarPath + " --import --clean"
            self.assertEquals(
                testOptions.processCommandline(commandline.split(" ")), False,
                "Command-line should not have processed correctly")
            self.assertEquals(testOptions.targetsToImport, [],
                              "targetsToImport should have not been set")
        finally:
            utilityFunctions.removeDir(tempDir)
Beispiel #46
0
 def test_unpackZip(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         zipDir, zipName = mdTestUtilities.createZipFile(tempDir)
         zipPath = os.path.join(tempDir, zipName)
         pci = createPythonCallInfo(zipPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         self.assertEqual(pci.success, True, "Local Zip file failed to fetch.")
         self.assertEqual(os.path.exists(pci.currentPath), True, "Zip file did not exist after fetching.")
         self.assertEqual(zipfile.is_zipfile(pci.currentPath), True, "Zip file was not a tar file after fetching.")
         pci = steps.unpack(pci)
         self.assertEqual(pci.success, True, "Zip file failed to unpack.")
         self.assertEqual(os.path.isdir(pci.currentPath), True, "Zip file was not a directory after unpacking.")
         self.assertEqual(os.path.exists(os.path.join(pci.currentPath, mdTestUtilities.testFileName)), True, "testFile did not exist after unpacking.")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #47
0
    def test_isHgRepoCase4(self):
        #Case 4: Check for false positive with .gz files
        if not hg.isHgInstalled():
            self.fail("Hg is not installed on your system.  All Hg tests will fail.")

        #Local file
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, path = mdTestUtilities.createGzipFile(tempDir)
            self.assertFalse(hg.isHgRepo(path), "hg.isHgRepo(" + path + ") should have returned false.")
        finally:
            utilityFunctions.removeDir(tempDir)

        #Remote file
        path = "http://www.eng.lsu.edu/mirrors/apache//apr/apr-util-1.3.10.tar.gz"
        self.assertFalse(hg.isHgRepo(path), "hg.isHgRepo(" + path + ") should have returned false.")
Beispiel #48
0
 def test_readGroups13(self):
     fileContents = textwrap.dedent("""
                                    wrongParens, *, * (
                                        ccompiler = gcc
                                        cflags = -O0
                                        testVariable = foo
                                     )
                                    """)
     try:
         tempDir = mdTestUtilities.makeTempDir()
         filePath = mdTestUtilities.makeTempFile(tempDir, fileContents)
         groups = overrides.readGroups(filePath)
         self.assertEquals(
             groups, None, "readGroups() should have failed to read groups")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #49
0
 def test_readGroups05(self):
     fileContents = textwrap.dedent("""
                                    empty, *, * {
                                    }
                                    """)
     try:
         tempDir = mdTestUtilities.makeTempDir()
         filePath = mdTestUtilities.makeTempFile(tempDir, fileContents)
         groups = overrides.readGroups(filePath)
         self.assertNotEquals(groups, None, "readGroups() failed to read groups")
         self.assertEquals(len(groups), 1, "Wrong number of groups returned")
         self.assertEquals(groups[0].compiler, "empty", "readGroups() has wrong information")
         self.assertEquals(groups[0].optimization, "*", "readGroups() has wrong information")
         self.assertEquals(groups[0].parallel, "*", "readGroups() has wrong information")
         self.assertEquals(fullCount(groups[0]), 0, "readGroups() has wrong information")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #50
0
 def test_unpackHg(self):
     if not hg.isHgInstalled():
         self.fail("Hg is not installed on your system.  All Hg tests will fail.")
     try:
         tempDir = mdTestUtilities.makeTempDir()
         repoPath = mdTestUtilities.createHgRepository(tempDir)
         pci = createPythonCallInfo(repoPath, os.path.join(tempDir, "output"), os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         testFilePath = os.path.join(pci.outputPath, mdTestUtilities.testFileName)
         self.assertEqual(pci.success, True, "Hg repository failed to fetch.")
         self.assertEqual(os.path.exists(testFilePath), True, "'" + mdTestUtilities.testFileName + "' did not exist after fetching a Hg repository.")
         pci = steps.unpack(pci)
         self.assertEqual(pci.success, True, "Hg repository failed to unpack.")
         self.assertEqual(os.path.isdir(pci.currentPath), True, "Hg repository was not a directory after unpacking.")
         self.assertEqual(os.path.exists(os.path.join(pci.currentPath, mdTestUtilities.testFileName)), True, "testFile did not exist after unpacking.")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #51
0
 def test_fetchGzip(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createGzipFile(tempDir)
         tarPath = os.path.join(tempDir, tarName)
         pci = createPythonCallInfo(tarPath,
                                    os.path.join(tempDir, "output"),
                                    os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         self.assertEqual(pci.success, True,
                          "Local Gzip file failed to fetch.")
         self.assertEqual(os.path.exists(pci.currentPath), True,
                          "Gzip file did not exist after fetching.")
         self.assertEqual(tarfile.is_tarfile(pci.currentPath), True,
                          "Gzip file was not a tar file after fetching.")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #52
0
 def test_fetchURL(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         tarDir, tarName = mdTestUtilities.createGzipFile(tempDir)
         urlPath = "http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz"
         pci = createPythonCallInfo(urlPath,
                                    os.path.join(tempDir, "output"),
                                    os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         self.assertEqual(pci.success, True,
                          "Gzip file failed to fetch from URL.")
         self.assertEqual(os.path.exists(pci.currentPath), True,
                          "Gzip file did not exist after fetching.")
         self.assertEqual(tarfile.is_tarfile(pci.currentPath), True,
                          "Gzip file was not a tar file after fetching.")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #53
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)
Beispiel #54
0
 def test_examineWithAutoTools(self):
     try:
         tempDir = mdTestUtilities.makeTempDir()
         targetDir = os.path.join(tempDir, "targetDir")
         os.makedirs(targetDir)
         mdTestUtilities.createBlankFiles(targetDir, ["Makefile.am", "configure.ac"])
         option = options.Options()
         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=/usr/local", "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)
Beispiel #55
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)
Beispiel #56
0
 def test_isGitRepoCase1(self):
     #Case 1: Local directory that is a git repository
     if not git.isGitInstalled():
         self.fail(
             "Git is not installed on your system.  All Git tests will fail."
         )
     #Create repository and test if is git repo
     tempDir = mdTestUtilities.makeTempDir()
     tempRepo = mdTestUtilities.createGitRepository(tempDir)
     try:
         self.assertTrue(
             git.isGitRepo(tempRepo),
             "git.isGitRepo(" + tempRepo + ") should have returned true.")
     finally:
         utilityFunctions.removeDir(tempDir)
     #Test if wrong path returns false
     falsePath = "/foo/wrong/path"
     self.assertFalse(
         git.isGitRepo(falsePath),
         "git.isGitRepo(" + falsePath + ") should have returned false.")
Beispiel #57
0
 def test_fetchHg(self):
     if not hg.isHgInstalled():
         self.fail(
             "Hg is not installed on your system.  All Hg tests will fail.")
     try:
         tempDir = mdTestUtilities.makeTempDir()
         repoPath = mdTestUtilities.createHgRepository(tempDir)
         pci = createPythonCallInfo(repoPath,
                                    os.path.join(tempDir, "output"),
                                    os.path.join(tempDir, "download"))
         pci = steps.fetch(pci)
         testFilePath = os.path.join(pci.outputPath,
                                     mdTestUtilities.testFileName)
         self.assertEqual(pci.success, True,
                          "Hg repository failed to fetch.")
         self.assertEqual(
             os.path.exists(testFilePath), True,
             "'" + mdTestUtilities.testFileName +
             "' did not exist after fetching a Hg repository.")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #58
0
    def test_isGitRepoCase4(self):
        #Case 4: Check for false positive with .gz files
        if not git.isGitInstalled():
            self.fail(
                "Git is not installed on your system.  All Git tests will fail."
            )

        #Local file
        try:
            tempDir = mdTestUtilities.makeTempDir()
            tarDir, path = mdTestUtilities.createGzipFile(tempDir)
            self.assertFalse(
                git.isGitRepo(path),
                "git.isGitRepo(" + path + ") should have returned false.")
        finally:
            utilityFunctions.removeDir(tempDir)

        #Remote file
        path = "http://www.eng.lsu.edu/mirrors/apache//apr/apr-util-1.3.10.tar.gz"
        self.assertFalse(
            git.isGitRepo(path),
            "git.isGitRepo(" + path + ") should have returned false.")
Beispiel #59
0
 def test_readGroups05(self):
     fileContents = textwrap.dedent("""
                                    empty, *, * {
                                    }
                                    """)
     try:
         tempDir = mdTestUtilities.makeTempDir()
         filePath = mdTestUtilities.makeTempFile(tempDir, fileContents)
         groups = overrides.readGroups(filePath)
         self.assertNotEquals(groups, None,
                              "readGroups() failed to read groups")
         self.assertEquals(len(groups), 1,
                           "Wrong number of groups returned")
         self.assertEquals(groups[0].compiler, "empty",
                           "readGroups() has wrong information")
         self.assertEquals(groups[0].optimization, "*",
                           "readGroups() has wrong information")
         self.assertEquals(groups[0].parallel, "*",
                           "readGroups() has wrong information")
         self.assertEquals(fullCount(groups[0]), 0,
                           "readGroups() has wrong information")
     finally:
         utilityFunctions.removeDir(tempDir)
Beispiel #60
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)