Esempio n. 1
0
def main():

    # Command line options
    cmdParser = optparse.OptionParser()
    cmdParser.add_option("-r",
                         action="store_true",
                         dest="bNoClean",
                         help="No clean build")
    cmdParser.add_option("-m",
                         action="store_true",
                         dest="bCheckMallocStats",
                         help="Check malloc statistics")
    cmdParser.add_option("-t",
                         action="append",
                         dest="testsIncluded",
                         help="Run specified tests",
                         metavar="test")
    cmdParser.add_option("-u",
                         action="store_true",
                         dest="bUpdateExpected",
                         help="Update expected output")
    cmdParser.add_option("--debug",
                         action="store_true",
                         dest="bDebug",
                         help="Build debug binaries")
    (cmdOptions, cmdArgs) = cmdParser.parse_args()

    # The unittest directory
    unittestDir = os.path.dirname(sys.argv[0])
    if not unittestDir:
        unittestDir = '.'

    # Create the test runner
    runner = unittest.TextTestRunner(verbosity=2)

    # Build test suite
    buildDirs = []
    buildSuite = BuildSuite(unittestDir, buildDirs, None,
                            not cmdOptions.bNoClean, cmdOptions.bDebug,
                            cmdOptions.bUpdateExpected)
    if not runner.run(buildSuite).wasSuccessful():
        return 1

    # C unit test suite
    unittestSuite = UnittestSuite()
    unittestSuite.addTest(unittestDir, os.path.join("build", "unittest"),
                          "unittest", cmdOptions.bCheckMallocStats,
                          cmdOptions.bUpdateExpected)

    if not runner.run(unittestSuite).wasSuccessful():
        return 1

    # Success
    return 0
Esempio n. 2
0
def main():

    # Command line options
    cmdParser = optparse.OptionParser()
    cmdParser.add_option("-r", action = "store_true", dest = "bNoClean",
                         help = "No clean build")
    cmdParser.add_option("-m", action = "store_true", dest = "bCheckMallocStats",
                         help = "Check malloc statistics")
    cmdParser.add_option("-t", action = "append", dest = "testsIncluded",
                         help = "Run specified tests", metavar = "test")
    cmdParser.add_option("-u", action = "store_true", dest = "bUpdateExpected",
                         help = "Update expected output")
    cmdParser.add_option("--debug", action = "store_true", dest = "bDebug",
                         help = "Build debug binaries")
    (cmdOptions, cmdArgs) = cmdParser.parse_args()

    # The unittest directory
    unittestDir = os.path.dirname(sys.argv[0])
    if not unittestDir:
        unittestDir = '.'

    # Create the test runner
    runner = unittest.TextTestRunner(verbosity = 2)

    # Build test suite
    buildDirs = []
    buildSuite = BuildSuite(unittestDir, buildDirs, None,
                            not cmdOptions.bNoClean, cmdOptions.bDebug, cmdOptions.bUpdateExpected)
    if not runner.run(buildSuite).wasSuccessful():
        return 1

    # C unit test suite
    unittestSuite = UnittestSuite()
    unittestSuite.addTest(unittestDir, os.path.join("build", "unittest"), "unittest",
                          cmdOptions.bCheckMallocStats, cmdOptions.bUpdateExpected)

    if not runner.run(unittestSuite).wasSuccessful():
        return 1

    # Success
    return 0
Esempio n. 3
0
def main():

    # Command line options
    cmdParser = optparse.OptionParser()
    cmdParser.add_option("-r", action = "store_true", dest = "bNoClean",
                         help = "No clean build")
    cmdParser.add_option("-m", action = "store_true", dest = "bCheckMallocStats",
                         help = "Check malloc statistics")
    cmdParser.add_option("-t", action = "append", dest = "testsIncluded",
                         help = "Run specified tests", metavar = "test")
    cmdParser.add_option("-u", action = "store_true", dest = "bUpdateExpected",
                         help = "Update expected output")
    cmdParser.add_option("--debug", action = "store_true", dest = "bDebug",
                         help = "Build debug binaries")
    (cmdOptions, cmdArgs) = cmdParser.parse_args()

    # The unittest directory
    unittestDir = os.path.dirname(sys.argv[0])
    if not unittestDir:
        unittestDir = '.'

    # Create the test runner
    runner = unittest.TextTestRunner(verbosity = 2)

    # Build test suite
    buildDirs = (os.path.join("build", "libhdksrv"),
                 os.path.join("build", "libhdksrv-c++"),
                 os.path.join("build", "libhdksrv-nologging"))

    bWindowsPlatform = (platform.system() == 'Windows')
    bDarwinPlatform = (platform.system() == 'Darwin')

    # Build target (platform dependant)
    if bWindowsPlatform:
        buildTarget = "libhdksrv.dll"
    elif bDarwinPlatform:
        buildTarget = "libhdksrv.dylib"
    else:
        buildTarget = "libhdksrv.so"

    buildSuite = BuildSuite(unittestDir, buildDirs, buildTarget,
                            not cmdOptions.bNoClean, cmdOptions.bDebug, cmdOptions.bUpdateExpected)
    if not runner.run(buildSuite).wasSuccessful():
        return 1

    # C unit test suite
    unittestSuite = UnittestSuite()
    for buildDir in ((os.path.join("build", "unittest")),
                     (os.path.join("build", "unittest-c++"))):

        unittestSuite.addTest(unittestDir, buildDir, "unittest",
                              cmdOptions.bCheckMallocStats, cmdOptions.bUpdateExpected)

        # Only update expected results with gold (first build dir)
        if cmdOptions.bUpdateExpected:
            break

    if not runner.run(unittestSuite).wasSuccessful():
        return 1

    # Success
    return 0
Esempio n. 4
0
def main():

    # Command line options
    cmdParser = optparse.OptionParser()
    cmdParser.add_option("-r",
                         action="store_true",
                         dest="bNoClean",
                         help="No clean build")
    cmdParser.add_option("-m",
                         action="store_true",
                         dest="bCheckMallocStats",
                         help="Check malloc statistics")
    cmdParser.add_option("-t",
                         action="append",
                         dest="testsIncluded",
                         help="Run specified tests",
                         metavar="test")
    cmdParser.add_option("-u",
                         action="store_true",
                         dest="bUpdateExpected",
                         help="Update expected output")
    cmdParser.add_option("--debug",
                         action="store_true",
                         dest="bDebug",
                         help="Build debug binaries")
    (cmdOptions, cmdArgs) = cmdParser.parse_args()

    # The unittest directory
    unittestDir = os.path.dirname(sys.argv[0])
    if not unittestDir:
        unittestDir = '.'

    # Create the test runner
    runner = unittest.TextTestRunner(verbosity=2)

    bWindowsPlatform = (platform.system() == 'Windows')
    bDarwinPlatform = (platform.system() == 'Darwin')

    # Build test suite
    buildDirs = []
    for buildDir, bSupported in ((os.path.join("build", "libhdkxml-expat"),
                                  True), (os.path.join("build",
                                                       "libhdkxml-libxml2"),
                                          not bWindowsPlatform),
                                 (os.path.join("build",
                                               "libhdkxml-expat-c++"), True),
                                 (os.path.join("build",
                                               "libhdkxml-libxml2-c++"),
                                  not bWindowsPlatform), (os.path.join(
                                      "build",
                                      "libhdkxml-expat-nologging"), True)):
        if bSupported:
            buildDirs.append(buildDir)

    # Build target (platform dependant)
    if bWindowsPlatform:
        buildTarget = "libhdkxml.dll"
    elif bDarwinPlatform:
        buildTarget = "libhdkxml.dylib"
    else:
        buildTarget = "libhdkxml.so"

    buildSuite = BuildSuite(unittestDir, buildDirs, buildTarget,
                            not cmdOptions.bNoClean, cmdOptions.bDebug,
                            cmdOptions.bUpdateExpected)
    if not runner.run(buildSuite).wasSuccessful():
        return 1

    # C unit test suite
    unittestSuite = UnittestSuite()
    for buildDir, bSupported in ((os.path.join("build", "unittest-expat"),
                                  True), (os.path.join("build",
                                                       "unittest-libxml2"),
                                          not bWindowsPlatform),
                                 (os.path.join("build", "unittest-expat-c++"),
                                  True), (os.path.join("build",
                                                       "unittest-libxml2-c++"),
                                          not bWindowsPlatform)):

        if bSupported:
            unittestSuite.addTest(unittestDir, buildDir, "unittest",
                                  cmdOptions.bCheckMallocStats,
                                  cmdOptions.bUpdateExpected)

        # Only update expected results with gold (first build dir)
        if cmdOptions.bUpdateExpected:
            break

    if not runner.run(unittestSuite).wasSuccessful():
        return 1

    # Success
    return 0