Exemple #1
0
def runIRBuilderOut(args=None, out=None):
    """uses java-llvm-ir-builder to parse a LLVM Bitcode file and outputs it's LLVM IR"""
    vmArgs, irbuilderArgs = mx_sulong.truffle_extract_VM_args(args)
    return mx.run_java(
        mx_sulong.getCommonOptions(False) + vmArgs +
        getIRWriterClasspathOptions() +
        ["at.pointhi.irbuilder.irwriter.SourceParser"] + irbuilderArgs)
Exemple #2
0
def travisRunSuite(args=None):
    """executes all the test suites or selected ones (see -h or --help)"""
    vmArgs, otherArgs = mx_sulong.truffle_extract_VM_args(args)
    parser = argparse.ArgumentParser(description="Compiles all or selected test suites.")
    parser.add_argument('suite', nargs='*', help=' '.join(testSuites.keys()), default=testSuites.keys())
    parsedArgs = parser.parse_args(otherArgs)

    tasks = []
    with mx_gate.Task('BuildJavaWithJavac', tasks) as t:
        if t: mx.command_function('build')(['-p', '--warning-as-error', '--force-javac'])

    for testSuiteName in parsedArgs.suite:
        with mx_gate.Task('Test%s' % testSuiteName.capitalize(), tasks) as t:
            if t:
                _, runCommand = testSuites[testSuiteName]
                runCommand(vmArgs)
Exemple #3
0
def runSuite(args=None):
    """executes all the test suites or selected ones (see -h or --help)"""
    vmArgs, otherArgs = mx_sulong.truffle_extract_VM_args(args)
    parser = argparse.ArgumentParser(description="Compiles all or selected test suites.")
    parser.add_argument('suite', nargs='*', help=' '.join(testSuites.keys()), default=testSuites.keys())
    parsedArgs = parser.parse_args(otherArgs)

    tasks = []
    with mx_gate.Task('BuildJavaWithJavac', tasks) as t:
        if t: mx.command_function('build')(['-p', '--warning-as-error', '--force-javac'])

    for testSuiteName in parsedArgs.suite:
        with mx_gate.Task('Test%s' % testSuiteName.capitalize(), tasks) as t:
            if t:
                _, runCommand = testSuites[testSuiteName]
                runCommand(vmArgs)
Exemple #4
0
def runIRBuilderTest38(vmArgs):
    """test ir-writer with llvm 3.8 bitcode files (see -h or --help)"""
    vmArgs, otherArgs = mx_sulong.truffle_extract_VM_args(vmArgs)
    parser = argparse.ArgumentParser(
        description="Compiles all or selected test suites.")
    parser.add_argument('suite',
                        nargs='*',
                        help=' '.join(irBuilderTests38.keys()),
                        default=irBuilderTests38.keys())
    parser.add_argument('--skip-compilation',
                        help='skip suite compilation',
                        action='store_true')  # TODO: makefile
    parsedArgs = parser.parse_args(otherArgs)

    # test if we have the required tools installed
    LlvmAS_38.find_tool()
    LlvmLLI_38.find_tool()

    returnCode = 0
    for testSuiteName in parsedArgs.suite:
        suite = irBuilderTests38[testSuiteName]
        """runs the test suite"""
        if parsedArgs.skip_compilation is False:
            mx_sulong.mx_testsuites.compileSuite([suite[0]])
        try:
            mx_sulong.mx_testsuites.run(
                vmArgs + suite[3] + ['-Dpolyglot.irwriter.LLVMVersion=3.8'],
                suite[1], [])
        except KeyboardInterrupt:
            sys.exit(-1)
        except:
            mx.log_error("unexpected exception thrown, continue...")

        testSuite = IRGeneratorSuite(LlvmAS_38, LlvmLLI_38)
        testSuite.run(suite[2])
        if not testSuite.wasSuccessfull():
            returnCode = 1

    return returnCode
Exemple #5
0
def runIRBuilderTestGen38(vmArgs):
    """create llvm-ir testcases which are then run against llvm as well as Sulong (see -h or --help)"""
    vmArgs, otherArgs = mx_sulong.truffle_extract_VM_args(vmArgs)
    parser = argparse.ArgumentParser(
        description="Compiles all or selected test suites.")
    parser.add_argument('suite',
                        nargs='*',
                        help=' '.join(irBuilderTestsGen38.keys()),
                        default=irBuilderTestsGen38.keys())
    parsedArgs = parser.parse_args(otherArgs)

    returnCode = 0
    for testSuiteName in parsedArgs.suite:
        suite = irBuilderTestsGen38[testSuiteName]
        """runs the test suite"""

        # remove old files inside build directory
        if os.path.isdir(suite[1]):
            for _file in os.listdir(suite[1]):
                if _file.endswith(".ll") or _file.endswith(".bc"):
                    os.remove(os.path.join(suite[1], _file))

        try:
            mx_sulong.mx_testsuites.run(
                vmArgs + ['-Dirwriter.LLVMVersion=3.8'], suite[0], [])
        except KeyboardInterrupt:
            sys.exit(-1)
        except:
            mx.log_error("unexpected exception thrown, continue...")

        testSuite = IRGeneratorBuilderSuite(LlvmAS_38, LlvmLLI_38)
        testSuite.run(suite[1])
        if not testSuite.wasSuccessfull():
            returnCode = 1

    return returnCode