Example #1
0
def runGCCTestCases(args=None):
    """runs the GCC test suite"""
    ensureLLVMBinariesExist()
    ensureGCCSuiteExists()
    ensureDragonEggExists()
    vmArgs, _ = truffle_extract_VM_args(args)
    unittest(getCommonUnitTestOptions() + vmArgs + ["com.oracle.truffle.llvm.test.TestGCCSuite"])
Example #2
0
def _tck(args):
    """runs TCK tests"""

    parser = ArgumentParser(prog="mx tck", description="run the TCK tests", formatter_class=RawDescriptionHelpFormatter, epilog=_debuggertestHelpSuffix)
    parser.add_argument("--tck-configuration", help="TCK configuration", choices=["compile", "debugger", "default"], default="default")
    parsed_args, args = parser.parse_known_args(args)
    tckConfiguration = parsed_args.tck_configuration
    index = len(args)
    for arg in reversed(args):
        if arg.startswith("-"):
            break
        index = index - 1
    args_no_tests = args[0:index]
    tests = args[index:len(args)]
    if len(tests) == 0:
        tests = ["com.oracle.truffle.tck.tests"]
    index = len(args_no_tests)
    for arg in reversed(args_no_tests):
        if arg.startswith("--"):
            break
        index = index - 1
    unitTestOptions = args_no_tests[0:max(index-1, 0)]
    jvmOptions = args_no_tests[index:len(args_no_tests)]
    if tckConfiguration == "default":
        unittest(unitTestOptions + ["--"] + jvmOptions + tests)
    elif tckConfiguration == "debugger":
        with mx.SafeFileCreation(os.path.join(tempfile.gettempdir(), "debugalot")) as sfc:
            _execute_debugger_test(tests, sfc.tmpPath, False, unitTestOptions, jvmOptions)
    elif tckConfiguration == "compile":
        if not _is_graalvm(mx.get_jdk()):
            mx.abort("The 'compile' TCK configuration requires graalvm execution, run with --java-home=<path_to_graalvm>.")
        unittest(unitTestOptions + ["--"] + jvmOptions + ["-Dgraal.TruffleCompileImmediately=true", "-Dgraal.TruffleCompilationExceptionsAreThrown=true"] + tests)
Example #3
0
def _truffle_gate_runner(args, tasks):
    with Task('Truffle Javadoc', tasks) as t:
        if t: mx.javadoc(['--unified'])
    with Task('Truffle UnitTests', tasks) as t:
        if t: unittest(['--suite', 'truffle', '--enable-timing', '--verbose', '--fail-fast'])
    with Task('Truffle Signature Tests', tasks) as t:
        if t: sigtest(['--check', 'binary'])
Example #4
0
def _sulong_gate_runner(args, tasks):
    with Task('ClangFormat', tasks, tags=['style', 'clangformat']) as t:
        if t: clangformatcheck()
    with Task('TestBenchmarks', tasks, tags=['benchmarks', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('shootout')
    with Task('TestTypes', tasks, tags=['type', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('type')
    with Task('TestPipe', tasks, tags=['pipe', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('pipe')
    with Task('TestLLVM', tasks, tags=['llvm']) as t:
        if t: mx_testsuites.runSuite('llvm')
    with Task('TestNWCC', tasks, tags=['nwcc']) as t:
        if t: mx_testsuites.runSuite('nwcc')
    with Task('TestGCCParserTorture', tasks, tags=['parser']) as t:
        if t: mx_testsuites.runSuite('parserTorture')
    with Task('TestGCC_C', tasks, tags=['gcc_c']) as t:
        if t: mx_testsuites.runSuite('gcc_c')
    with Task('TestGCC_CPP', tasks, tags=['gcc_cpp']) as t:
        if t: mx_testsuites.runSuite('gcc_cpp')
    with Task('TestGCC_Fortran', tasks, tags=['gcc_fortran']) as t:
        if t: mx_testsuites.runSuite('gcc_fortran')
    with Task("TestSulong", tasks, tags=['sulong', 'sulongBasic']) as t:
        if t: mx_unittest.unittest(['SulongSuite'])
    with Task("TestInterop", tasks, tags=['interop', 'sulongBasic']) as t:
        if t: mx_unittest.unittest(['LLVMInteropTest'])
    with Task('TestAssembly', tasks, tags=['assembly', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('assembly')
    with Task('TestArgs', tasks, tags=['args', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('args')
    with Task('TestCallback', tasks, tags=['callback', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('callback')
    with Task('TestVarargs', tasks, tags=['vaargs', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('vaargs')
Example #5
0
def runBenchmarkTestCases(args=None):
    """runs the test cases from the language benchmark game"""
    ensureLLVMBinariesExist()
    ensureGCCSuiteExists()
    ensureDragonEggExists()
    ensureBenchmarkSuiteExists()
    vmArgs, _ = truffle_extract_VM_args(args)
    unittest(getCommonUnitTestOptions() + vmArgs + ["com.oracle.truffle.llvm.test.BenchmarkGameSuite"])
Example #6
0
 def run(self, suites, tasks, extraVMarguments=None):
     for suite in suites:
         with Task(self.name + ': hosted-product ' + suite, tasks, tags=self.tags) as t:
             if mx_gate.Task.verbose:
                 extra_args = ['--verbose', '--enable-timing']
             else:
                 extra_args = []
             if t: unittest(['--suite', suite, '--fail-fast'] + extra_args + self.args + _noneAsEmptyList(extraVMarguments))
Example #7
0
def _truffle_gate_runner(args, tasks):
    jdk = mx.get_jdk(tag=mx.DEFAULT_JDK_TAG)
    if jdk.javaCompliance < '9':
        with Task('Truffle Javadoc', tasks) as t:
            if t: mx.javadoc(['--unified'])
    with Task('Truffle UnitTests', tasks) as t:
        if t: unittest(['--suite', 'truffle', '--enable-timing', '--verbose', '--fail-fast'])
    with Task('Truffle Signature Tests', tasks) as t:
        if t: sigtest(['--check', 'binary'])
Example #8
0
def _truffle_gate_runner(args, tasks):
    with Task("Truffle Javadoc", tasks) as t:
        if t:
            mx.javadoc(["--unified"])
    with Task("Truffle UnitTests", tasks) as t:
        if t:
            unittest(["--suite", "truffle", "--enable-timing", "--verbose", "--fail-fast"])
    with Task("Truffle Signature Tests", tasks) as t:
        if t:
            sigtest(["--check", "binary"])
Example #9
0
def run(vmArgs, unittest, extraOption=None, extraLibs=None):
    if extraOption is None:
        extraOption = []
    if mx.get_opts().verbose:
        command = mx_sulong.getCommonOptions(True, extraLibs) + extraOption + vmArgs + ['--very-verbose', unittest]
        print ('Running mx unittest ' + ' '.join(command))
        return mx_unittest.unittest(command)
    else:
        command = mx_sulong.getCommonOptions(True, extraLibs) + extraOption + vmArgs + [unittest]
        return mx_unittest.unittest(command)
Example #10
0
def _truffle_gate_runner(args, tasks):
    jdk = mx.get_jdk(tag=mx.DEFAULT_JDK_TAG)
    with Task('Jackpot check', tasks) as t:
        if t: jackpot(['--fail-on-warnings'], suite=None, nonZeroIsFatal=True)
    if jdk.javaCompliance < '9':
        with Task('Truffle Javadoc', tasks) as t:
            if t: javadoc([])
    with Task('Truffle UnitTests', tasks) as t:
        if t: unittest(['--suite', 'truffle', '--enable-timing', '--verbose', '--fail-fast'])
    with Task('Truffle Signature Tests', tasks) as t:
        if t: sigtest(['--check', 'binary'])
    with Task('File name length check', tasks) as t:
        if t: check_filename_length([])
Example #11
0
def testgen(args):
    '''generate the expected output for unit tests'''
    # check we are in the home directory
    if os.getcwd() != _fastr_suite.dir:
        mx.abort('must run rtestgen from FastR home directory')

    def _test_srcdir():
        tp = 'com.oracle.truffle.r.test'
        return join(mx.project(tp).dir, 'src', tp.replace('.', sep))

    def need_version_check():
        vardef = os.environ.has_key('FASTR_TESTGEN_GNUR')
        varval = os.environ['FASTR_TESTGEN_GNUR'] if vardef else None
        version_check = vardef and varval != 'internal'
        if version_check:
            rpath = join(varval, 'bin', 'R')
        else:
            rpath = None
        return version_check, rpath

    version_check, rpath = need_version_check()
    if version_check:
        # check the version of GnuR against FastR
        try:
            fastr_version = subprocess.check_output([
                mx.get_jdk().java,
                mx.get_runtime_jvm_args('com.oracle.truffle.r.runtime'),
                'com.oracle.truffle.r.runtime.RVersionNumber'
            ])
            gnur_version = subprocess.check_output([rpath, '--version'])
            if not gnur_version.startswith(fastr_version):
                mx.abort(
                    'R version is incompatible with FastR, please update to ' +
                    fastr_version)
        except subprocess.CalledProcessError:
            mx.abort('RVersionNumber.main failed')

    tests = _all_generated_unit_tests()
    # now just invoke unittst with the appropriate options
    mx.log("generating expected output for packages: ")
    for pkg in tests:
        mx.log("    " + str(pkg))
    os.environ["TZDIR"] = "/usr/share/zoneinfo/"
    _unset_conflicting_envs()
    mx_unittest.unittest([
        '-Dfastr.test.gen.expected=' + _test_srcdir(),
        '-Dfastr.test.gen.expected.quiet', '-Dfastr.test.project.output.dir=' +
        mx.project('com.oracle.truffle.r.test').output_dir()
    ] + tests)
Example #12
0
def _tck(args):
    """runs TCK tests"""

    parser = ArgumentParser(prog="mx tck",
                            description="run the TCK tests",
                            formatter_class=RawDescriptionHelpFormatter,
                            epilog=_debuggertestHelpSuffix)
    parser.add_argument("--tck-configuration",
                        help="TCK configuration",
                        choices=["compile", "debugger", "default"],
                        default="default")
    parsed_args, args = parser.parse_known_args(args)
    tckConfiguration = parsed_args.tck_configuration
    index = len(args)
    for arg in reversed(args):
        if arg.startswith("-"):
            break
        index = index - 1
    args_no_tests = args[0:index]
    tests = args[index:len(args)]
    if len(tests) == 0:
        tests = ["com.oracle.truffle.tck.tests"]
    index = len(args_no_tests)
    has_separator_arg = False
    for arg in reversed(args_no_tests):
        if arg.startswith("--"):
            if arg == "--":
                has_separator_arg = True
            break
        index = index - 1
    unitTestOptions = args_no_tests[
        0:max(index - (1 if has_separator_arg else 0), 0)]
    jvmOptions = args_no_tests[index:len(args_no_tests)]
    if tckConfiguration == "default":
        unittest(unitTestOptions + ["--"] + jvmOptions + tests)
    elif tckConfiguration == "debugger":
        with mx.SafeFileCreation(
                os.path.join(tempfile.gettempdir(), "debugalot")) as sfc:
            _execute_debugger_test(tests, sfc.tmpPath, False, unitTestOptions,
                                   jvmOptions)
    elif tckConfiguration == "compile":
        if not _is_graalvm(mx.get_jdk()):
            mx.abort(
                "The 'compile' TCK configuration requires graalvm execution, run with --java-home=<path_to_graalvm>."
            )
        unittest(unitTestOptions + ["--"] + jvmOptions + [
            "-Dgraal.TruffleCompileImmediately=true",
            "-Dgraal.TruffleCompilationExceptionsAreThrown=true"
        ] + tests)
Example #13
0
def run(vmArgs, unittests, extraOption=None, extraLibs=None):
    if not isinstance(unittests, list):
        unittests = [unittests]
    if extraOption is None:
        extraOption = []
    if mx.get_opts().verbose:
        command = mx_sulong.getCommonOptions(
            True, extraLibs) + extraOption + vmArgs + ['--very-verbose'
                                                       ] + unittests
        print('Running mx unittests ' + ' '.join(command))
        return mx_unittest.unittest(command)
    else:
        command = mx_sulong.getCommonOptions(
            True, extraLibs) + extraOption + vmArgs + unittests
        return mx_unittest.unittest(command)
Example #14
0
def _truffle_gate_runner(args, tasks):
    jdk = mx.get_jdk(tag=mx.DEFAULT_JDK_TAG)
    with Task('Jackpot check', tasks) as t:
        if t: jackpot(['--fail-on-warnings'], suite=None, nonZeroIsFatal=True)
    if jdk.javaCompliance < '9':
        with Task('Truffle Javadoc', tasks) as t:
            if t: javadoc([])
    with Task('Truffle UnitTests', tasks) as t:
        if t: unittest(['--suite', 'truffle', '--enable-timing', '--verbose', '--fail-fast'])
    with Task('Truffle Signature Tests', tasks) as t:
        if t: sigtest(['--check', 'binary'])
    with Task('File name length check', tasks) as t:
        if t: check_filename_length([])
    with Task('Check Copyrights', tasks) as t:
        if t: mx.checkcopyrights(['--primary'])
Example #15
0
def _add_tck_tests(tasks, supports_coverage):
    with mx_gate.Task('TruffleSqueak TCK tests', tasks, tags=['test']) as t:
        if t:
            unittest_args = BASE_VM_ARGS_TESTING[:]
            if supports_coverage:
                unittest_args.extend(_get_jacoco_agent_args())
            test_image = _get_path_to_test_image()
            unittest_args.extend([
                '--color', '--fail-fast',
                '-Dtck.language=%s' % LANGUAGE_ID,
                '-Dpolyglot.%s.headless=true' % LANGUAGE_ID,
                '-Dpolyglot.%s.image-path=%s' % (LANGUAGE_ID, test_image),
                'com.oracle.truffle.tck.tests'
            ])
            mx_unittest.unittest(unittest_args)
Example #16
0
def _add_unit_tests(tasks, supports_coverage):
    with mx_gate.Task('GraalSqueak JUnit and SUnit tests',
                      tasks, tags=['test']) as t:
        if t:
            unittest_args = BASE_VM_ARGS_TESTING[:]
            if supports_coverage:
                unittest_args.extend(_get_jacoco_agent_args())
            unittest_args.extend(['--suite', 'graalsqueak', '--very-verbose',
                                  '--color', '--enable-timing'])

            # Ensure Truffle TCK disabled (workaround needed since GraalVM 19.2.0)
            # import mx_truffle
            # mx_unittest._config_participants.remove(
            #     mx_truffle._unittest_config_participant_tck)
            mx_unittest.unittest(unittest_args)
Example #17
0
def _truffle_gate_state_bitwidth_tests():
    runs = [1, 2, 4, 8, 16, 32, 64]
    for run_bits in runs:
        build_args = ['-f', '-p', '--dependencies', 'TRUFFLE_TEST', '--force-javac',
                      '-A-Atruffle.dsl.StateBitWidth={0}'.format(run_bits)]

        unittest_args = ['--suite', 'truffle', '--enable-timing', '--fail-fast', '-Dtruffle.dsl.StateBitWidth={0}'.format(run_bits),
                         'com.oracle.truffle.api.dsl.test', 'com.oracle.truffle.api.library.test', 'com.oracle.truffle.sl.test']
        try:
            mx.build(build_args)
            unittest(unittest_args)
        finally:
            mx.log('Completed Truffle DSL state bitwidth test. Reproduce with:')
            mx.log('  mx build {0}'.format(" ".join(build_args)))
            mx.log('  mx unittest {0}'.format(" ".join(unittest_args)))
Example #18
0
def punittest(ars):
    if '--regex' not in ars:
        args = [
            '--regex', r'(graal\.python)|(com\.oracle\.truffle\.tck\.tests)'
        ]
    args += [
        "-Dgraal.TruffleCompilationExceptionsAreFatal=false",
        "-Dgraal.TruffleCompilationExceptionsArePrinted=true",
        "-Dgraal.TrufflePerformanceWarningsAreFatal=false"
    ]
    args += ars
    # ensure that C API was built (we may need on-demand compilation)
    do_run_python(["-m", "build_capi"], nonZeroIsFatal=True)
    os.environ["PYTHONUSERBASE"] = mx_subst.path_substitutions.substitute(
        "<path:PYTHON_USERBASE>")
    mx_unittest.unittest(args)
Example #19
0
def runTruffleTestCases(args=None):
    """runs the Sulong test suite"""
    ensureLLVMBinariesExist()
    ensureDragonEggExists()
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(getCommonUnitTestOptions() + vmArgs +
                    ["com.oracle.truffle.llvm.test.SulongTestSuite"])
Example #20
0
def runNWCCTestCases(args=None):
    """runs the NWCC (Nils Weller's C Compiler) test cases"""
    ensureLLVMBinariesExist()
    ensureNWCCSuiteExists()
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(
        getCommonUnitTestOptions() + vmArgs + [getRemoteClasspathOption(), "com.oracle.truffle.llvm.test.NWCCTestSuite"]
    )
Example #21
0
def _truffle_gate_runner(args, tasks):
    jdk = mx.get_jdk(tag=mx.DEFAULT_JDK_TAG)
    with Task('Jackpot check', tasks) as t:
        if t: jackpot(['--fail-on-warnings'], suite=None, nonZeroIsFatal=True)
    if jdk.javaCompliance < '9':
        with Task('Truffle Javadoc', tasks) as t:
            if t: javadoc([])
    with Task('File name length check', tasks) as t:
        if t: check_filename_length([])
    with Task('Truffle Signature Tests', tasks) as t:
        if t: sigtest(['--check', 'binary'])
    with Task('Truffle UnitTests', tasks) as t:
        if t: unittest(list(['--suite', 'truffle', '--enable-timing', '--verbose', '--fail-fast']))
    if os.getenv('DISABLE_DSL_STATE_BITS_TESTS', 'false').lower() != 'true':
        with Task('Truffle DSL max state bit tests', tasks) as t:
            if t:
                _truffle_gate_state_bitwidth_tests()
Example #22
0
def runBenchmarkTestCases(args=None):
    """runs the test cases from the language benchmark game"""
    ensureLLVMBinariesExist()
    ensureGCCSuiteExists()
    ensureDragonEggExists()
    ensureBenchmarkSuiteExists()
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(getCommonUnitTestOptions() + vmArgs + ["com.oracle.truffle.llvm.test.BenchmarkGameSuite"])
Example #23
0
def runGCCTestCases(args=None):
    """runs the GCC test suite"""
    ensureLLVMBinariesExist()
    ensureGCCSuiteExists()
    ensureDragonEggExists()
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(getCommonUnitTestOptions() + vmArgs +
                    ['com.oracle.truffle.llvm.test.TestGCCSuite'])
Example #24
0
def runAsmTestCases(args=None):
    """runs the asm test cases"""
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(
        getCommonUnitTestOptions()
        + vmArgs
        + [getRemoteClasspathOption(), "com.oracle.truffle.llvm.test.inlineassembly.LLVMInlineAssemblyTest"]
    )
Example #25
0
def _graal_js_gate_runner(args, tasks):
    with Task('TestJSCommand',
              tasks,
              tags=[GraalJsDefaultTags.default, GraalJsDefaultTags.all]) as t:
        if t:
            js(['-Dtruffle.js.ProfileTime=true', '-e', '""'])

    with Task('UnitTests',
              tasks,
              tags=[GraalJsDefaultTags.default, GraalJsDefaultTags.all]) as t:
        if t:
            unittest([
                '-Dtruffle.js.NashornJavaInterop=true', '--enable-timing',
                '--very-verbose', 'com.oracle.truffle.js.scriptengine.test'
            ])

    gateTestConfigs = {
        GraalJsDefaultTags.default: ['gate'],
        'noic': [
            'gate', '-Dtruffle.js.PropertyCacheLimit=0',
            '-Dtruffle.js.FunctionCacheLimit=0'
        ],
        'directbytebuffer': ['gate', '-Dtruffle.js.DirectByteBuffer=true'],
        'cloneuninitialized':
        ['gate', '-Dtruffle.js.TestCloneUninitialized=true'],
        'lazytranslation': ['gate', '-Dtruffle.js.LazyTranslation=true'],
    }

    gateTestCommands = {
        'Test262': test262,
        'TestNashorn': testnashorn,
        'TestV8': testv8,
        'TestInstrumentation': testinstrumentation,
        'TestThreading': testthreading,
    }

    for testCommandName in gateTestCommands:
        for testConfigName in gateTestConfigs:
            testName = '%s-%s' % (testCommandName, testConfigName)
            with Task(testName,
                      tasks,
                      tags=[testName, testConfigName,
                            GraalJsDefaultTags.all]) as t:
                if t:
                    gateTestCommands[testCommandName](
                        gateTestConfigs[testConfigName])
Example #26
0
def runLLVMTestCases(args=None):
    """runs the LLVM test suite"""
    ensureLLVMBinariesExist()
    ensureLLVMSuiteExists()
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(
        getCommonUnitTestOptions() + vmArgs + [getRemoteClasspathOption(), "com.oracle.truffle.llvm.test.LLVMTestSuite"]
    )
Example #27
0
def _graal_js_gate_runner(args, tasks):
    with Task('CheckCopyrights', tasks, tags=['style']) as t:
        if t:
            if mx.checkcopyrights(['--primary']) != 0:
                t.abort('Copyright errors found. Please run "mx checkcopyrights --primary -- --fix" to fix them.')

    with Task('TestJSCommand', tasks, tags=[GraalJsDefaultTags.default, GraalJsDefaultTags.all]) as t:
        if t:
            js(['-Dpolyglot.js.profile-time=true', '-e', '""'])

    with Task('UnitTests', tasks, tags=[GraalJsDefaultTags.default, GraalJsDefaultTags.all]) as t:
        if t:
            unittest(['--enable-timing', '--very-verbose', '--suite', _suite.name])

    gateTestConfigs = {
        GraalJsDefaultTags.default: ['gate'],
        'noic': ['-Dpolyglot.js.property-cache-limit=0', '-Dpolyglot.js.function-cache-limit=0', 'gate'],
        'directbytebuffer': ['-Dpolyglot.js.direct-byte-buffer=true', 'gate'],
        'cloneuninitialized': ['-Dpolyglot.js.test-clone-uninitialized=true', 'gate'],
        'lazytranslation': ['-Dpolyglot.js.lazy-translation=true', 'gate'],
        'shareengine': ['gate', 'shareengine'],
        'latestversion': ['gate', 'minesversion=2022'],
        'instrument': ['gate', 'instrument', 'timeoutoverall=1800']
    }

    gateTestCommands = {
        'Test262': test262,
        'TestNashorn': testnashorn,
        'TestV8': testv8,
    }

    for testCommandName in gateTestCommands:
        for testConfigName in gateTestConfigs:
            # TestNashorn is not sensitive to ES version
            if testCommandName == 'TestNashorn' and testConfigName == 'latestversion':
                continue
            testName = '%s-%s' % (testCommandName, testConfigName)
            with Task(testName, tasks, tags=[testName, testConfigName, GraalJsDefaultTags.all]) as t:
                if t:
                    gateTestCommands[testCommandName](gateTestConfigs[testConfigName])

    with Task('TCK tests', tasks, tags=[GraalJsDefaultTags.all, GraalJsDefaultTags.tck]) as t:
        if t:
            import mx_truffle
            mx_truffle._tck([])
Example #28
0
def _jvmci_gate_runner(args, tasks):
    # Build release server VM now so we can run the unit tests
    with Task('BuildHotSpotJVMCIHosted: release', tasks) as t:
        if t: _runmultimake(['--jdk-jvm-variants', 'server', '--jdk-debug-levels', 'release'])

    # Run unit tests in hosted mode
    with VM(jvmVariant='server', debugLevel='release', jvmciMode='hosted'):
        with Task('JVMCI UnitTests: hosted-release', tasks) as t:
            if t: unittest(['--suite', 'jvmci', '--enable-timing', '--verbose', '--fail-fast'])

    # Build the other VM flavors
    with Task('BuildHotSpotJVMCIOthers: fastdebug', tasks) as t:
        if t: _runmultimake(['--jdk-jvm-variants', 'server', '--jdk-debug-levels', 'fastdebug'])

    with Task('CleanAndBuildIdealGraphVisualizer', tasks, disableJacoco=True) as t:
        if t and platform.processor() != 'sparc':
            buildxml = mx._cygpathU2W(join(_suite.dir, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'))
            mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=_igvBuildEnv())
Example #29
0
def runNWCCTestCases(args=None):
    """runs the NWCC (Nils Weller's C Compiler) test cases"""
    ensureLLVMBinariesExist()
    ensureNWCCSuiteExists()
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(getCommonUnitTestOptions() + vmArgs + [
        getRemoteClasspathOption(),
        "com.oracle.truffle.llvm.test.NWCCTestSuite"
    ])
Example #30
0
def runLLVMTestCases(args=None):
    """runs the LLVM test suite"""
    ensureLLVMBinariesExist()
    ensureLLVMSuiteExists()
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(getCommonUnitTestOptions() + vmArgs + [
        getRemoteClasspathOption(),
        "com.oracle.truffle.llvm.test.LLVMTestSuite"
    ])
Example #31
0
def _jvmci_gate_runner(args, tasks):
    # Build release server VM now so we can run the unit tests
    with Task('BuildHotSpotJVMCIHosted: release', tasks) as t:
        if t: _runmultimake(['--jdk-jvm-variants', 'server', '--jdk-debug-levels', 'release'])

    # Run unit tests in hosted mode
    with VM(jvmVariant='server', debugLevel='release', jvmciMode='hosted'):
        with Task('JVMCI UnitTests: hosted-release', tasks) as t:
            if t: unittest(['--suite', 'jvmci', '--enable-timing', '--verbose', '--fail-fast'])

    # Build the other VM flavors
    with Task('BuildHotSpotJVMCIOthers: fastdebug', tasks) as t:
        if t: _runmultimake(['--jdk-jvm-variants', 'server', '--jdk-debug-levels', 'fastdebug'])

    with Task('CleanAndBuildIdealGraphVisualizer', tasks, disableJacoco=True) as t:
        if t and platform.processor() != 'sparc':
            buildxml = mx._cygpathU2W(join(_suite.dir, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'))
            mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=_igvBuildEnv())
Example #32
0
def testLLVMImage(image, imageArgs=None, testFilter=None, libPath=True, test=None, unittestArgs=None):
    """runs the SulongSuite tests on an AOT compiled lli image"""
    args = ['-Dsulongtest.testAOTImage=' + image]
    aotArgs = []
    if libPath:
        aotArgs += [mx_subst.path_substitutions.substitute('-Dllvm.home=<path:SULONG_LIBS>')]
    if imageArgs is not None:
        aotArgs += imageArgs
    if aotArgs:
        args += ['-Dsulongtest.testAOTArgs=' + ' '.join(aotArgs)]
    if testFilter is not None:
        args += ['-Dsulongtest.testFilter=' + testFilter]
    testName = 'SulongSuite'
    if test is not None:
        testName += '#test[' + test + ']'
    if unittestArgs is None:
        unittestArgs = []
    mx_unittest.unittest(args + [testName] + unittestArgs)
Example #33
0
def libgraal_gate_body(args, tasks):
    msg = check_libgraal_dependencies()
    if msg:
        mx.logv('Skipping libgraal because: {}'.format(msg))
        return

    with Task('Build libgraal', tasks, tags=[GraalTags.build, GraalTags.benchmarktest, GraalTags.test, GraalTags.libgraal]) as t:
        # Build libgraal with assertions in the image builder and assertions in the image
        if t: build_libgraal(['-J-esa', '-ea'])

    extra_vm_argument = ['-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary', '-XX:JVMCILibPath=' + os.getcwd()]
    if args.extra_vm_argument:
        extra_vm_argument += args.extra_vm_argument

    mx_compiler.compiler_gate_benchmark_runner(tasks, extra_vm_argument, libgraal=True)

    with Task('Test libgraal', tasks, tags=[GraalTags.libgraal]) as t:
        if t:
            mx_unittest.unittest(["--suite", "truffle", "--"] + extra_vm_argument + ["-Dgraal.TruffleCompileImmediately=true", "-Dgraal.TruffleBackgroundCompilation=false"])
Example #34
0
def runTruffleTestCases(args=None):
    """runs the Sulong test suite"""
    ensureLLVMBinariesExist()
    ensureDragonEggExists()
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(
        getCommonUnitTestOptions()
        + ["-Dsulong.ExecutionCount=1000"]
        + vmArgs
        + ["com.oracle.truffle.llvm.test.SulongTestSuite"]
    )
Example #35
0
def _sulong_gate_runner(args, tasks):
    with Task('ClangFormat', tasks, tags=['style', 'clangformat']) as t:
        if t: clangformatcheck()
    with Task('TestBenchmarks', tasks, tags=['benchmarks', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('shootout')
    with Task('TestTypes', tasks, tags=['type', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('type')
    with Task('TestPipe', tasks, tags=['pipe', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('pipe')
    with Task('TestLLVM', tasks, tags=['llvm']) as t:
        if t: mx_testsuites.runSuite('llvm')
    with Task('TestNWCC', tasks, tags=['nwcc']) as t:
        if t: mx_testsuites.runSuite('nwcc')
    with Task('TestGCCParserTorture', tasks, tags=['parser']) as t:
        if t: mx_testsuites.runSuite('parserTorture')
    with Task('TestGCC_C', tasks, tags=['gcc_c']) as t:
        if t: mx_testsuites.runSuite('gcc_c')
    with Task('TestGCC_CPP', tasks, tags=['gcc_cpp']) as t:
        if t: mx_testsuites.runSuite('gcc_cpp')
    with Task('TestGCC_Fortran', tasks, tags=['gcc_fortran']) as t:
        if t: mx_testsuites.runSuite('gcc_fortran')
    with Task("TestSulong", tasks, tags=['sulong', 'sulongBasic']) as t:
        if t: mx_unittest.unittest(['SulongSuite'])
    with Task("TestInterop", tasks, tags=['interop', 'sulongBasic']) as t:
        if t: mx_unittest.unittest(['com.oracle.truffle.llvm.test.interop'])
    with Task("TestDebug", tasks, tags=['debug', 'sulongBasic']) as t:
        if t: mx_unittest.unittest(['LLVMDebugTest'])
    with Task('TestAssembly', tasks, tags=['assembly', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('assembly')
    with Task('TestArgs', tasks, tags=['args', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('args')
    with Task('TestCallback', tasks, tags=['callback', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('callback')
    with Task('TestVarargs', tasks, tags=['vaargs', 'sulongMisc']) as t:
        if t: mx_testsuites.runSuite('vaargs')
Example #36
0
def graal_wasm_gate_runner(args, tasks):
    with Task("BuildAll", tasks, tags=[GraalWasmDefaultTags.buildall]) as t:
        if t:
            mx.build(["--all"])
    with Task("UnitTests", tasks, tags=[GraalWasmDefaultTags.wasmtest]) as t:
        if t:
            unittest([
                "-Dwasmtest.watToWasmExecutable=" +
                os.path.join(wabt_dir, "wat2wasm"), "WasmTestSuite"
            ])
    with Task("ExtraUnitTests",
              tasks,
              tags=[GraalWasmDefaultTags.wasmextratest]) as t:
        if t:
            unittest(["CSuite"])
            unittest(["WatSuite"])
    # This is a gate used to test that all the benchmarks return the correct results. It does not upload anything,
    # and does not run on a dedicated machine.
    with Task("BenchTest", tasks,
              tags=[GraalWasmDefaultTags.wasmbenchtest]) as t:
        if t:
            for b in microbenchmarks:
                exitcode = mx_benchmark.benchmark([
                    "wasm:WASM_BENCHMARKCASES", "--", "--jvm", "server",
                    "--jvm-config", "graal-core",
                    "-Dwasmbench.benchmarkName=" + b,
                    "-Dwasmtest.keepTempFiles=true", "--",
                    "CMicroBenchmarkSuite", "-wi", "1", "-i", "1"
                ])
                if exitcode != 0:
                    mx.abort("Errors during benchmark tests, aborting.")
Example #37
0
def _execute_debugger_test(testFilter, logFile, testEvaluation=False, unitTestOptions=None, jvmOptions=None):
    """
    Executes given unit tests with enabled debugalot instrument.
    The 'testFilter' argument is a filter unit test pattern.
    The 'logFile' argument is a file path to store the instrument output into.
    The 'testEvaluation' argument enables evaluation testing, default is False.
    The 'unitTestOptions' argument is a list of unit test options.
    The 'jvmOptions' argument is a list of VM options.
    """
    debugalot_options = ["-Dpolyglot.debugalot=true"]
    if testEvaluation:
        debugalot_options.append("-Dpolyglot.debugalot.Eval=true")
    debugalot_options.append("-Dpolyglot.debugalot.LogFile=" + logFile)
    args = []
    if unitTestOptions is not None:
        args = args + unitTestOptions
    args = args + ["--"]
    if jvmOptions is not None:
        args = args + jvmOptions
    args = args + debugalot_options
    args = args + testFilter
    unittest(args)
Example #38
0
def _execute_debugger_test(testFilter, logFile, testEvaluation=False, unitTestOptions=None, jvmOptions=None):
    """
    Executes given unit tests with enabled debugalot instrument.
    The 'testFilter' argument is a filter unit test pattern.
    The 'logFile' argument is a file path to store the instrument output into.
    The 'testEvaluation' argument enables evaluation testing, default is False.
    The 'unitTestOptions' argument is a list of unit test options.
    The 'jvmOptions' argument is a list of VM options.
    """
    debugalot_options = ["-Dpolyglot.debugalot=true"]
    if testEvaluation:
        debugalot_options.append("-Dpolyglot.debugalot.Eval=true")
    debugalot_options.append("-Dpolyglot.debugalot.LogFile=" + logFile)
    args = []
    if unitTestOptions is not None:
        args = args + unitTestOptions
    args = args + ["--"]
    if jvmOptions is not None:
        args = args + jvmOptions
    args = args + debugalot_options
    args = args + testFilter
    unittest(args)
Example #39
0
def java_base_unittest(args):
    """tests whether graal compiler runs on JDK9 with limited set of modules"""
    jlink = mx.exe_suffix(join(jdk.home, 'bin', 'jlink'))
    if not exists(jlink):
        raise mx.JDKConfigException('jlink tool does not exist: ' + jlink)
    basejdk_dir = join(_suite.get_output_root(), 'jdkbase')
    basemodules = 'java.base,jdk.internal.vm.ci,jdk.unsupported'
    if exists(basejdk_dir):
        shutil.rmtree(basejdk_dir)
    mx.run([
        jlink, '--output', basejdk_dir, '--add-modules', basemodules,
        '--module-path',
        join(jdk.home, 'jmods')
    ])
    jdwp = mx.add_lib_suffix(mx.add_lib_prefix('jdwp'))
    shutil.copy(join(jdk.home, 'lib', jdwp), join(basejdk_dir, 'lib', jdwp))
    dt_socket = mx.add_lib_suffix(mx.add_lib_prefix('dt_socket'))
    shutil.copy(join(jdk.home, 'lib', dt_socket),
                join(basejdk_dir, 'lib', dt_socket))

    if not args:
        args = []

    fakeJavac = join(basejdk_dir, 'bin', 'javac')
    open(fakeJavac, 'a').close()

    basejdk = mx.JDKConfig(basejdk_dir)
    savedJava = jdk.java
    try:
        jdk.java = basejdk.java
        if mx_gate.Task.verbose:
            extra_args = ['--verbose', '--enable-timing']
        else:
            extra_args = []
        mx_unittest.unittest(['--suite', 'compiler', '--fail-fast'] +
                             extra_args + args)
    finally:
        jdk.java = savedJava
Example #40
0
def _sulong_gate_runner(args, tasks):
    with TemporaryEnv():
        with Task('CheckCopyright', tasks, tags=['style']) as t:
            if t:
                if mx.checkcopyrights(['--primary']) != 0:
                    t.abort(
                        'Copyright errors found. Please run "mx checkcopyrights --primary -- --fix" to fix them.'
                    )
        with Task('ClangFormat', tasks, tags=['style', 'clangformat']) as t:
            if t: clangformatcheck()
        with Task('TestBenchmarks', tasks, tags=['benchmarks',
                                                 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('shootout')
        with Task('TestTypes', tasks, tags=['type', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('type')
        with Task('TestPipe', tasks, tags=['pipe', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('pipe')
        with Task('TestLLVM', tasks, tags=['llvm']) as t:
            if t: mx_testsuites.runSuite('llvm')
        with Task('TestNWCC', tasks, tags=['nwcc']) as t:
            if t: mx_testsuites.runSuite('nwcc')
        with Task('TestGCCParserTorture', tasks, tags=['parser']) as t:
            if t: mx_testsuites.runSuite('parserTorture')
        with Task('TestGCC_C', tasks, tags=['gcc_c']) as t:
            if t: mx_testsuites.runSuite('gcc_c')
        with Task('TestGCC_CPP', tasks, tags=['gcc_cpp']) as t:
            if t: mx_testsuites.runSuite('gcc_cpp')
        with Task('TestGCC_Fortran', tasks, tags=['gcc_fortran']) as t:
            if t: mx_testsuites.runSuite('gcc_fortran')
        with Task("TestSulong", tasks, tags=['sulong', 'sulongBasic']) as t:
            if t: mx_unittest.unittest(['SulongSuite'])
        with Task("TestInterop", tasks, tags=['interop', 'sulongBasic']) as t:
            if t:
                mx_unittest.unittest(['com.oracle.truffle.llvm.test.interop'])
        with Task("TestDebug", tasks, tags=['debug', 'sulongBasic']) as t:
            if t: mx_unittest.unittest(['LLVMDebugTest'])
        with Task("TestIRDebug", tasks, tags=['irdebug', 'sulongBasic']) as t:
            if t: mx_unittest.unittest(['LLVMIRDebugTest'])
        with Task('TestAssembly', tasks, tags=['assembly', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('assembly')
        with Task('TestArgs', tasks, tags=['args', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('args')
        with Task('TestCallback', tasks, tags=['callback', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('callback')
        with Task('TestVarargs', tasks, tags=['vaargs', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('vaargs')
Example #41
0
def _tck(args):
    """runs TCK tests"""

    parser = ArgumentParser(prog="mx tck",
                            description="run the TCK tests",
                            formatter_class=RawDescriptionHelpFormatter,
                            epilog=_debuggertestHelpSuffix)
    parser.add_argument("--tck-configuration",
                        help="TCK configuration",
                        choices=["default", "debugger"],
                        default="default")
    parsed_args, args = parser.parse_known_args(args)
    tckConfiguration = parsed_args.tck_configuration
    index = len(args)
    for arg in reversed(args):
        if arg.startswith("-"):
            break
        index = index - 1
    args_no_tests = args[0:index]
    tests = args[index:len(args)]
    if len(tests) == 0:
        tests = ["com.oracle.truffle.tck.tests"]
    index = len(args_no_tests)
    for arg in reversed(args_no_tests):
        if arg.startswith("--"):
            break
        index = index - 1
    unitTestOptions = args_no_tests[0:max(index - 1, 0)]
    jvmOptions = args_no_tests[index:len(args_no_tests)]
    if tckConfiguration == "default":
        unittest(unitTestOptions + ["--"] + jvmOptions + tests)
    elif tckConfiguration == "debugger":
        with mx.SafeFileCreation(
                os.path.join(tempfile.gettempdir(), "debugalot")) as sfc:
            _execute_debugger_test(tests, sfc.tmpPath, False, unitTestOptions,
                                   jvmOptions)
Example #42
0
def _graal_js_gate_runner(args, tasks):
    with Task('CheckCopyrights', tasks, tags=['style']) as t:
        if t:
            if mx.checkcopyrights(['--primary']) != 0:
                t.abort('Copyright errors found. Please run "mx checkcopyrights --primary -- --fix" to fix them.')

    with Task('TestJSCommand', tasks, tags=[GraalJsDefaultTags.default, GraalJsDefaultTags.all]) as t:
        if t:
            js(['-Dpolyglot.js.profile-time=true', '-e', '""'])

    webassemblyTestSuite = 'com.oracle.truffle.js.test.suite.WebAssemblySimpleTestSuite'
    with Task('UnitTests', tasks, tags=[GraalJsDefaultTags.default, GraalJsDefaultTags.all]) as t:
        if t:
            noWebAssemblyTestSuite = '^(?!' + webassemblyTestSuite  + ')'
            commonOptions = ['--enable-timing', '--very-verbose', '--suite', _suite.name]
            unittest(['--regex', noWebAssemblyTestSuite] + commonOptions)
            unittest(['--regex', 'ZoneRulesProviderTest', '-Djava.time.zone.DefaultZoneRulesProvider=com.oracle.truffle.js.test.runtime.SimpleZoneRulesProvider'] + commonOptions)

    with Task('WebAssemblyTests', tasks, tags=['webassembly', GraalJsDefaultTags.all]) as t:
        if t:
            unittest(['--regex', webassemblyTestSuite, '--enable-timing', '--very-verbose', '--suite', _suite.name])

    gateTestConfigs = {
        GraalJsDefaultTags.default: ['gate'],
        'noic': ['-Dpolyglot.js.property-cache-limit=0', '-Dpolyglot.js.function-cache-limit=0', 'gate'],
        'directbytebuffer': ['-Dpolyglot.js.direct-byte-buffer=true', 'gate'],
        'cloneuninitialized': ['-Dpolyglot.js.test-clone-uninitialized=true', 'gate'],
        'lazytranslation': ['-Dpolyglot.js.lazy-translation=true', 'gate'],
        'zonerulesbasedtimezones': ['-Dpolyglot.js.zone-rules-based-time-zones=true', 'gate'],
        'shareengine': ['gate', 'shareengine'],
        'latestversion': ['gate', 'minesversion=2022'],
        'instrument': ['gate', 'instrument', 'timeoutoverall=1800']
    }

    gateTestCommands = {
        'Test262': test262,
        'TestNashorn': testnashorn,
        'TestV8': testv8,
    }

    for testCommandName in gateTestCommands:
        for testConfigName in gateTestConfigs:
            # TestNashorn is not sensitive to ES version
            if testCommandName == 'TestNashorn' and testConfigName == 'latestversion':
                continue
            testName = '%s-%s' % (testCommandName, testConfigName)
            with Task(testName, tasks, tags=[testName, testConfigName, GraalJsDefaultTags.all]) as t:
                if t:
                    gateTestCommands[testCommandName](gateTestConfigs[testConfigName])

    with Task('TCK tests', tasks, tags=[GraalJsDefaultTags.all, GraalJsDefaultTags.tck]) as t:
        if t:
            import mx_truffle
            mx_truffle._tck([])
Example #43
0
def graal_wasm_gate_runner(args, tasks):
    with Task("BuildAll", tasks, tags=[GraalWasmDefaultTags.buildall]) as t:
        if t:
            mx.build(["--all"])
    with Task("UnitTests", tasks, tags=[GraalWasmDefaultTags.wasmtest]) as t:
        if t:
            unittest(["-Dwasmtest.watToWasmExecutable=" + os.path.join(wabt_dir, "wat2wasm"), "WasmTestSuite"])
    with Task("ExtraUnitTests", tasks, tags=[GraalWasmDefaultTags.wasmextratest]) as t:
        if t:
            unittest(["CSuite"])
            unittest(["WatSuite"])
Example #44
0
def _sulong_gate_runner(args, tasks):
    with TemporaryEnv():
        with Task('CheckCopyright', tasks, tags=['style']) as t:
            if t:
                if mx.checkcopyrights(['--primary']) != 0:
                    t.abort('Copyright errors found. Please run "mx checkcopyrights --primary -- --fix" to fix them.')
        with Task('ClangFormat', tasks, tags=['style', 'clangformat']) as t:
            if t: clangformatcheck()
        with Task('TestBenchmarks', tasks, tags=['benchmarks', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('shootout')
        with Task('TestTypes', tasks, tags=['type', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('type')
        with Task('TestPipe', tasks, tags=['pipe', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('pipe')
        with Task('TestLLVM', tasks, tags=['llvm']) as t:
            if t: mx_testsuites.runSuite('llvm')
        with Task('TestNWCC', tasks, tags=['nwcc']) as t:
            if t: mx_testsuites.runSuite('nwcc')
        with Task('TestGCCParserTorture', tasks, tags=['parser']) as t:
            if t: mx_testsuites.runSuite('parserTorture')
        with Task('TestGCC_C', tasks, tags=['gcc_c']) as t:
            if t: mx_testsuites.runSuite('gcc_c')
        with Task('TestGCC_CPP', tasks, tags=['gcc_cpp']) as t:
            if t: mx_testsuites.runSuite('gcc_cpp')
        with Task('TestGCC_Fortran', tasks, tags=['gcc_fortran']) as t:
            if t: mx_testsuites.runSuite('gcc_fortran')
        with Task("TestSulong", tasks, tags=['sulong', 'sulongBasic']) as t:
            if t: mx_unittest.unittest(['SulongSuite'])
        with Task("TestInterop", tasks, tags=['interop', 'sulongBasic']) as t:
            if t: mx_unittest.unittest(['com.oracle.truffle.llvm.test.interop'])
        with Task("TestDebug", tasks, tags=['debug', 'sulongBasic']) as t:
            if t: mx_unittest.unittest(['LLVMDebugTest'])
        with Task("TestIRDebug", tasks, tags=['irdebug', 'sulongBasic']) as t:
            if t: mx_unittest.unittest(['LLVMIRDebugTest'])
        with Task('TestAssembly', tasks, tags=['assembly', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('assembly')
        with Task('TestArgs', tasks, tags=['args', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('args')
        with Task('TestCallback', tasks, tags=['callback', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('callback')
        with Task('TestVarargs', tasks, tags=['vaargs', 'sulongMisc']) as t:
            if t: mx_testsuites.runSuite('vaargs')
Example #45
0
def _fastr_gate_runner(args, tasks):
    '''
    The specific additional gates tasks provided by FastR:
    1. Copyright check
    2. Check that ExpectedTestOutput file is in sync with unit tests
    3. Unit tests
    '''
    # FastR has custom copyright check
    with mx_gate.Task('Copyright check', tasks) as t:
        if t:
            if mx.checkcopyrights(['--primary']) != 0:
                t.abort('copyright errors')

    # check that the expected test output file is up to date
    with mx_gate.Task('UnitTests: ExpectedTestOutput file check', tasks) as t:
        if t:
            mx_unittest.unittest([
                '-Dfastr.test.gen.expected=' +
                _test_srcdir(), '-Dfastr.test.check.expected'
            ] + _gate_unit_tests())

    with mx_gate.Task('UnitTests: no specials', tasks) as t:
        if t:
            mx_unittest.unittest(['-DR:-UseSpecials'] +
                                 _gate_noapps_unit_tests())

    with mx_gate.Task('UnitTests: with specials', tasks) as t:
        if t:
            mx_unittest.unittest(_gate_noapps_unit_tests())

    with mx_gate.Task('UnitTests: apps', tasks) as t:
        if t:
            mx_unittest.unittest(_apps_unit_tests())

    with mx_gate.Task('Rembedded', tasks) as t:
        if t:
            if rembedtest([]) != 0:
                t.abort("Rembedded tests failed")
Example #46
0
def _tools_gate_runner(args, tasks):
    with Task('Jackpot check', tasks) as t:
        if t: jackpot(['--fail-on-warnings'], suite=None, nonZeroIsFatal=True)
    with Task('Tools UnitTests', tasks) as t:
        if t: unittest(['--suite', 'tools', '--enable-timing', '--verbose', '--fail-fast'])
Example #47
0
def ruby_tck(args):
    env = setup_jruby_home()
    os.environ["JRUBY_HOME"] = env["JRUBY_HOME"]
    mx_unittest.unittest(['--verbose', '--suite', 'jruby'])
Example #48
0
def runTypeTestCases(args=None):
    """runs the type test cases"""
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(getCommonUnitTestOptions() + vmArgs + ['com.oracle.truffle.llvm.types.floating.test'])
Example #49
0
def _sdk_gate_runner(args, tasks):
    with Task('SDK UnitTests', tasks, tags=['test']) as t:
        if t: unittest(['--suite', 'sdk', '--enable-timing', '--verbose', '--fail-fast'])
    with Task('Check Copyrights', tasks) as t:
        if t: mx.checkcopyrights(['--primary'])
Example #50
0
 def run(self, suites, tasks, extraVMarguments=None):
     for suite in suites:
         with Task(self.name + ': hosted-product ' + suite, tasks) as t:
             if t: unittest(['--suite', suite, '--fail-fast'] + self.args + _noneAsEmptyList(extraVMarguments))
Example #51
0
def runLifetimeTestCases(args=None):
    """runs the lifetime analysis test cases"""
    ensureLifetimeReferenceExists()
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(getCommonUnitTestOptions() + vmArgs + ['com.oracle.truffle.llvm.test.TestLifetimeAnalysisGCC'])
Example #52
0
def runPolyglotTestCases(args=None):
    """runs the type test cases"""
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(getCommonUnitTestOptions() + vmArgs + ['com.oracle.truffle.llvm.test.TestPolyglotEngine'])
Example #53
0
def runTckTestCases(args=None):
    """runs the TCK test cases"""
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(getCommonUnitTestOptions() + vmArgs + ['com.oracle.truffle.llvm.test.interop.LLVMTckTest'])
Example #54
0
def runMainArgTestCases(args=None):
    """runs the test cases that exercise the passing of arguments to the main function"""
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(getCommonUnitTestOptions() + vmArgs + ['com.oracle.truffle.llvm.test.LLVMMainArgTestSuite'])
Example #55
0
def gate_body(args, tasks):
    with Task('Vm: Basic GraalVM Tests', tasks,
              tags=[VmGateTasks.compiler]) as t:
        if t and mx_vm.has_component('GraalVM compiler'):
            # 1. the build must be a GraalVM
            # 2. the build must be JVMCI-enabled since the 'GraalVM compiler' component is registered
            mx_vm.check_versions(
                mx_vm.graalvm_output(),
                graalvm_version_regex=mx_vm.graalvm_version_regex,
                expect_graalvm=True,
                check_jvmci=True)

    with Task('Vm: GraalVM dist names', tasks,
              tags=[VmGateTasks.integration]) as t:
        if t:
            for suite, env_file_name, graalvm_dist_name in env_tests:
                out = mx.LinesOutputCapture()
                mx.run_mx([
                    '--no-warning', '--env', env_file_name, 'graalvm-dist-name'
                ],
                          suite,
                          out=out,
                          err=out,
                          env={})
                mx.log(
                    "Checking that the env file '{}' in suite '{}' produces a GraalVM distribution named '{}'"
                    .format(env_file_name, suite.name, graalvm_dist_name))
                if len(out.lines) != 1 or out.lines[0] != graalvm_dist_name:
                    mx.abort(
                        "Unexpected GraalVM dist name for env file '{}' in suite '{}'.\nExpected: '{}', actual: '{}'.\nDid you forget to update the registration of the GraalVM config?"
                        .format(env_file_name, suite.name, graalvm_dist_name,
                                '\n'.join(out.lines)))

    if mx_vm.has_component('LibGraal'):
        libgraal_location = mx_vm.get_native_image_locations(
            'LibGraal', 'jvmcicompiler')
        if libgraal_location is None:
            mx.warn(
                "Skipping libgraal tests: no library enabled in the LibGraal component"
            )
        else:
            extra_vm_arguments = [
                '-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary',
                '-XX:JVMCILibPath=' + dirname(libgraal_location)
            ]
            if args.extra_vm_argument:
                extra_vm_arguments += args.extra_vm_argument
            import mx_compiler

            # run avrora on the GraalVM binary itself
            with Task('LibGraal Compiler:GraalVM DaCapo-avrora',
                      tasks,
                      tags=[VmGateTasks.libgraal]) as t:
                if t:
                    mx.run([
                        join(mx_vm.graalvm_home(), 'bin',
                             'java'), '-XX:+UseJVMCICompiler',
                        '-XX:+UseJVMCINativeLibrary', '-jar',
                        mx.library('DACAPO').get_path(True), 'avrora'
                    ])

            with Task('LibGraal Compiler:CTW',
                      tasks,
                      tags=[VmGateTasks.libgraal]) as t:
                if t:
                    mx_compiler.ctw([
                        '-DCompileTheWorld.Config=Inline=false CompilationFailureAction=ExitVM',
                        '-esa',
                        '-XX:+EnableJVMCI',
                        '-DCompileTheWorld.MultiThreaded=true',
                        '-Dgraal.InlineDuringParsing=false',
                        '-Dgraal.TrackNodeSourcePosition=true',
                        '-DCompileTheWorld.Verbose=false',
                        '-XX:ReservedCodeCacheSize=300m',
                    ], extra_vm_arguments)

            mx_compiler.compiler_gate_benchmark_runner(
                tasks, extra_vm_arguments, prefix='LibGraal Compiler:')

            with Task('LibGraal Truffle:unittest',
                      tasks,
                      tags=[VmGateTasks.libgraal]) as t:
                if t:

                    def _unittest_config_participant(config):
                        vmArgs, mainClass, mainClassArgs = config

                        def is_truffle_fallback(arg):
                            fallback_args = [
                                "-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime",
                                "-Dgraalvm.ForcePolyglotInvalid=true"
                            ]
                            return arg in fallback_args

                        newVmArgs = [
                            arg for arg in vmArgs
                            if not is_truffle_fallback(arg)
                        ]
                        return (newVmArgs, mainClass, mainClassArgs)

                    mx_unittest.add_config_participant(
                        _unittest_config_participant)
                    excluded_tests = environ.get("TEST_LIBGRAAL_EXCLUDE")
                    if excluded_tests:
                        with NamedTemporaryFile(prefix='blacklist.',
                                                mode='w',
                                                delete=False) as fp:
                            fp.file.writelines(
                                [l + '\n' for l in excluded_tests.split()])
                            unittest_args = ["--blacklist", fp.name]
                    else:
                        unittest_args = []
                    unittest_args = unittest_args + [
                        "--enable-timing", "--verbose"
                    ]
                    mx_unittest.unittest(unittest_args + extra_vm_arguments + [
                        "-Dgraal.TruffleCompileImmediately=true",
                        "-Dgraal.TruffleBackgroundCompilation=false", "truffle"
                    ])
    else:
        mx.warn("Skipping libgraal tests: component not enabled")

    gate_substratevm(tasks)
    gate_sulong(tasks)
    gate_ruby(tasks)
    gate_python(tasks)
    gate_svm_truffle_tck_js(tasks)
Example #56
0
def runPipeTestCases(args=None):
    """runs the stdout pipe testcases """
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(vmArgs + ['com.oracle.truffle.llvm.test.alpha.CaptureOutputTest'])
Example #57
0
 def run(self, suites, tasks, extraVMarguments=None):
     for suite in suites:
         with Task(self.name + ': hosted-release ' + suite, tasks) as t:
             if t: unittest(['--suite', suite, '--enable-timing', '--verbose', '--fail-fast'] + self.args + _noneAsEmptyList(extraVMarguments))
Example #58
0
def gate_body(args, tasks):
    with Task('Vm: GraalVM dist names', tasks, tags=['names']) as t:
        if t:
            mx_sdk_vm.verify_graalvm_configs(suites=['vm', 'vm-enterprise'])

    with Task('Vm: Basic GraalVM Tests', tasks,
              tags=[VmGateTasks.compiler]) as t:
        if t and mx_sdk_vm_impl.has_component('GraalVM compiler'):
            # 1. the build must be a GraalVM
            # 2. the build must be JVMCI-enabled since the 'GraalVM compiler' component is registered
            mx_sdk_vm_impl.check_versions(
                mx_sdk_vm_impl.graalvm_output(),
                graalvm_version_regex=mx_sdk_vm_impl.graalvm_version_regex,
                expect_graalvm=True,
                check_jvmci=True)

    if mx_sdk_vm_impl.has_component('LibGraal'):
        libgraal_location = mx_sdk_vm_impl.get_native_image_locations(
            'LibGraal', 'jvmcicompiler')
        if libgraal_location is None:
            mx.warn(
                "Skipping libgraal tests: no library enabled in the LibGraal component"
            )
        else:
            extra_vm_arguments = [
                '-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary',
                '-XX:JVMCILibPath=' + dirname(libgraal_location)
            ]
            if args.extra_vm_argument:
                extra_vm_arguments += args.extra_vm_argument
            import mx_compiler

            # run avrora on the GraalVM binary itself
            with Task('LibGraal Compiler:GraalVM DaCapo-avrora',
                      tasks,
                      tags=[VmGateTasks.libgraal]) as t:
                if t:
                    java_exe = join(mx_sdk_vm_impl.graalvm_home(), 'bin',
                                    'java')
                    mx.run([
                        java_exe, '-XX:+UseJVMCICompiler',
                        '-XX:+UseJVMCINativeLibrary', '-jar',
                        mx.library('DACAPO').get_path(True), 'avrora', '-n',
                        '1'
                    ])

                    # Ensure that fatal errors in libgraal route back to HotSpot
                    vmargs = [
                        '-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary',
                        '-XX:+PrintFlagsFinal',
                        '-Dlibgraal.CrashAt=length,hashCode',
                        '-Dlibgraal.CrashAtIsFatal=true'
                    ]
                    cmd = ["dacapo:avrora", "--tracker=none", "--"
                           ] + vmargs + ["--", "--preserve"]
                    out = mx.OutputCapture()
                    exitcode, bench_suite, _ = mx_benchmark.gate_mx_benchmark(
                        cmd, nonZeroIsFatal=False, out=out, err=out)
                    if exitcode == 0:
                        if 'CrashAtIsFatal: no fatalError function pointer installed' in out.data:
                            # Executing a VM that does not configure fatal errors handling
                            # in libgraal to route back through the VM.
                            pass
                        else:
                            mx.abort(
                                'Expected following benchmark to result in non-zero exit code: '
                                + ' '.join(cmd))
                    else:
                        if len(bench_suite.scratchDirs()) == 0:
                            mx.abort(
                                "No scratch dir found despite error being expected!"
                            )
                        latest_scratch_dir = bench_suite.scratchDirs()[-1]
                        seen_libjvmci_log = False
                        hs_errs = glob.glob(
                            join(latest_scratch_dir, 'hs_err_pid*.log'))
                        if not hs_errs:
                            mx.abort(
                                'Expected a file starting with "hs_err_pid" in test directory. Entries found='
                                + str(listdir(latest_scratch_dir)))

                        for hs_err in hs_errs:
                            mx.log("Verifying content of {}".format(
                                join(latest_scratch_dir, hs_err)))
                            with open(join(latest_scratch_dir, hs_err)) as fp:
                                contents = fp.read()
                            if 'libjvmci' in hs_err:
                                seen_libjvmci_log = True
                                if 'Fatal error: Forced crash' not in contents:
                                    mx.abort(
                                        'Expected "Fatal error: Forced crash" to be in contents of '
                                        + hs_err + ':' + linesep + contents)
                            else:
                                if 'Fatal error in JVMCI' not in contents:
                                    mx.abort(
                                        'Expected "Fatal error in JVMCI" to be in contents of '
                                        + hs_err + ':' + linesep + contents)

                        if 'JVMCINativeLibraryErrorFile' in out.data and not seen_libjvmci_log:
                            mx.abort(
                                'Expected a file matching "hs_err_pid*_libjvmci.log" in test directory. Entries found='
                                + str(listdir(latest_scratch_dir)))

                    # Only clean up scratch dir on success
                    for scratch_dir in bench_suite.scratchDirs():
                        mx.log(
                            "Cleaning up scratch dir after gate task completion: {}"
                            .format(scratch_dir))
                        mx.rmtree(scratch_dir)

            with Task('LibGraal Compiler:CTW',
                      tasks,
                      tags=[VmGateTasks.libgraal]) as t:
                if t:
                    mx_compiler.ctw([
                        '-DCompileTheWorld.Config=Inline=false CompilationFailureAction=ExitVM',
                        '-esa',
                        '-XX:+EnableJVMCI',
                        '-DCompileTheWorld.MultiThreaded=true',
                        '-Dgraal.InlineDuringParsing=false',
                        '-Dgraal.TrackNodeSourcePosition=true',
                        '-DCompileTheWorld.Verbose=false',
                        '-DCompileTheWorld.HugeMethodLimit=4000',
                        '-DCompileTheWorld.MaxCompiles=150000',
                        '-XX:ReservedCodeCacheSize=300m',
                    ], extra_vm_arguments)

            mx_compiler.compiler_gate_benchmark_runner(
                tasks, extra_vm_arguments, prefix='LibGraal Compiler:')

            with Task('LibGraal Truffle:unittest',
                      tasks,
                      tags=[VmGateTasks.libgraal]) as t:
                if t:

                    def _unittest_config_participant(config):
                        vmArgs, mainClass, mainClassArgs = config

                        def is_truffle_fallback(arg):
                            fallback_args = [
                                "-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime",
                                "-Dgraalvm.ForcePolyglotInvalid=true"
                            ]
                            return arg in fallback_args

                        newVmArgs = [
                            arg for arg in vmArgs
                            if not is_truffle_fallback(arg)
                        ]
                        return (newVmArgs, mainClass, mainClassArgs)

                    mx_unittest.add_config_participant(
                        _unittest_config_participant)
                    excluded_tests = environ.get("TEST_LIBGRAAL_EXCLUDE")
                    if excluded_tests:
                        with NamedTemporaryFile(prefix='blacklist.',
                                                mode='w',
                                                delete=False) as fp:
                            fp.file.writelines(
                                [l + '\n' for l in excluded_tests.split()])
                            unittest_args = ["--blacklist", fp.name]
                    else:
                        unittest_args = []
                    unittest_args = unittest_args + [
                        "--enable-timing", "--verbose"
                    ]
                    compiler_log_file = "graal-compiler.log"
                    mx_unittest.unittest(unittest_args + extra_vm_arguments + [
                        "-Dpolyglot.engine.AllowExperimentalOptions=true",
                        "-Dpolyglot.engine.CompileImmediately=true",
                        "-Dpolyglot.engine.BackgroundCompilation=false",
                        "-Dpolyglot.engine.TraceCompilation=true",
                        "-Dpolyglot.log.file={0}".format(compiler_log_file),
                        "-Dgraalvm.locatorDisabled=true", "truffle"
                    ])
                    if exists(compiler_log_file):
                        remove(compiler_log_file)
    else:
        mx.warn("Skipping libgraal tests: component not enabled")

    gate_substratevm(tasks)
    gate_sulong(tasks)
    gate_python(tasks)
    gate_svm_sl_tck(tasks)
    gate_svm_truffle_tck_js(tasks)
Example #59
0
def runCompileTestCases(args=None):
    """runs the compile (no execution) test cases of the GCC suite"""
    ensureGCCSuiteExists()
    vmArgs, _ = truffle_extract_VM_args(args)
    return unittest(getCommonUnitTestOptions() + vmArgs + ['com.oracle.truffle.llvm.test.TestGCCCompileSuite'])