Esempio n. 1
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'])
Esempio n. 2
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

            # run avrora on the GraalVM binary itself
            with Task('LibGraal Compiler:Basic', tasks, tags=[VmGateTasks.libgraal]) as t:
                if t: _test_libgraal_basic(extra_vm_arguments)
            with Task('LibGraal Compiler:FatalErrorHandling', tasks, tags=[VmGateTasks.libgraal]) as t:
                if t: _test_libgraal_fatal_error_handling()

            with Task('LibGraal Compiler:CTW', tasks, tags=[VmGateTasks.libgraal]) as t:
                if t: _test_libgraal_ctw(extra_vm_arguments)

            import mx_compiler
            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: _test_libgraal_truffle(extra_vm_arguments)
    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)
Esempio n. 3
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('Graal compiler'):
            # 1. a full open-source build should be built with an open-source JDK but we allow Oracle JDK in non-strict mode as it is common on developer machines
            # 2. the build must be a GraalVM
            # 3. the build must be JVMCI-enabled since the 'Graal compiler' component is registered
            version_regex = mx_vm.openjdk_version_regex if args.strict_mode else mx_vm.anyjdk_version_regex
            mx_vm.check_versions(mx_vm.graalvm_output(), version_regex, graalvm_version_regex=mx_vm.graalvm_version_regex, expect_graalvm=True, check_jvmci=True)

    with Task('Vm: Sulong tests', tasks, tags=[VmGateTasks.sulong]) as t:
        if t and mx_vm.has_component('Sulong', fatalIfMissing=True):
            pass

    with Task('Vm: Graal.js tests', tasks, tags=[VmGateTasks.graal_js]) as t:
        if t and mx_vm.has_component('Graal.js', fatalIfMissing=True):
            pass

    with Task('Vm: Graal.nodejs tests', tasks, tags=[VmGateTasks.graal_nodejs]) as t:
        if t and mx_vm.has_component('Graal.nodejs', fatalIfMissing=True):
            pass

    with Task('Vm: TruffleRuby tests', tasks, tags=[VmGateTasks.truffleruby]) as t:
        if t and mx_vm.has_component('TruffleRuby', fatalIfMissing=True):
            pass

    with Task('Vm: FastR tests', tasks, tags=[VmGateTasks.fastr]) as t:
        if t and mx_vm.has_component('FastR', fatalIfMissing=True):
            pass

    with Task('Vm: Graal.Python tests', tasks, tags=[VmGateTasks.graalpython]) as t:
        if t and mx_vm.has_component('Graal.Python', fatalIfMissing=True):
            pass

    gate_substratevm(tasks)
    gate_sulong(tasks)
    gate_ruby(tasks)
    gate_python(tasks)
Esempio n. 4
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()
    with Task('Validate parsers', tasks) as t:
        if t: validate_parsers()
Esempio n. 5
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)
Esempio n. 6
0
def _graal_nodejs_post_gate_runner(args, tasks):
    _setEnvVar('NODE_INTERNAL_ERROR_CHECK', 'true')
    with Task('UnitTests',
              tasks,
              tags=[GraalNodeJsTags.allTests, GraalNodeJsTags.unitTests]) as t:
        if t:
            _setEnvVar('NODE_JVM_CLASSPATH',
                       mx.distribution('graal-js:TRUFFLE_JS_TESTS').path)
            commonArgs = ['-ea', '-esa']
            unitTestDir = join('test', 'graal')
            for dir_name in 'node_modules', 'build':
                p = join(unitTestDir, dir_name)
                if exists(p):
                    mx.rmtree(p)
            npm([
                '--scripts-prepend-node-path=auto', 'install',
                '--nodedir=' + _suite.dir
            ] + commonArgs,
                cwd=unitTestDir)
            npm(['--scripts-prepend-node-path=auto', 'test'] + commonArgs,
                cwd=unitTestDir)

    with Task('TestNpm',
              tasks,
              tags=[GraalNodeJsTags.allTests, GraalNodeJsTags.windows]) as t:
        if t:
            tmpdir = tempfile.mkdtemp()
            try:
                npm(['init', '-y'], cwd=tmpdir)
                npm([
                    'install', '--scripts-prepend-node-path=true', 'microtime'
                ],
                    cwd=tmpdir)
                node(['-e', 'console.log(require("microtime").now());'],
                     cwd=tmpdir)
            finally:
                mx.rmtree(tmpdir, ignore_errors=True)

    with Task('TestNpx',
              tasks,
              tags=[GraalNodeJsTags.allTests, GraalNodeJsTags.windows]) as t:
        if t:
            npx(['cowsay', 'GraalVM rules!'])

    with Task(
            'JniProfilerTests',
            tasks,
            tags=[GraalNodeJsTags.allTests,
                  GraalNodeJsTags.jniProfilerTests]) as t:
        if t:
            commonArgs = ['-ea', '-esa']
            unitTestDir = join(
                mx.project(
                    'com.oracle.truffle.trufflenode.jniboundaryprofiler').dir,
                'tests')
            for dir_name in 'node_modules', 'build':
                p = join(unitTestDir, dir_name)
                if exists(p):
                    mx.rmtree(p)
            npm([
                '--scripts-prepend-node-path=auto', 'install',
                '--nodedir=' + _suite.dir
            ] + commonArgs,
                cwd=unitTestDir)
            node(['-profile-native-boundary', 'test.js'] + commonArgs,
                 cwd=unitTestDir)

    with Task('TestNodeInstrument',
              tasks,
              tags=[GraalNodeJsTags.allTests, GraalNodeJsTags.windows]) as t:
        if t:
            testnodeInstrument([])
Esempio n. 7
0
def _sulong_gate_runner(args, tasks):
    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')
Esempio n. 8
0
def graalpython_gate_runner(args, tasks):
    with Task('GraalPython JUnit', tasks,
              tags=[GraalPythonTags.junit]) as task:
        if task:
            punittest(['--verbose'])

    with Task('GraalPython Python tests',
              tasks,
              tags=[GraalPythonTags.unittest]) as task:
        if task:
            gate_unittests()

    with Task('GraalPython C extension tests',
              tasks,
              tags=[GraalPythonTags.cpyext]) as task:
        if task:
            gate_unittests(subdir="cpyext/")

    with Task('GraalPython C extension managed tests',
              tasks,
              tags=[GraalPythonTags.cpyext_managed]) as task:
        if task:
            mx.run_mx([
                "--dynamicimports", "sulong-managed", "python-gate-unittests",
                "--llvm.configuration=managed", "--subdir=cpyext", "--"
            ])

    with Task('GraalPython C extension sandboxed tests',
              tasks,
              tags=[GraalPythonTags.cpyext_sandboxed]) as task:
        if task:
            mx.run_mx([
                "--dynamicimports", "sulong-managed", "python-gate-unittests",
                "--llvm.configuration=sandboxed", "--subdir=cpyext", "--"
            ])

    with Task('GraalPython Python tests on SVM',
              tasks,
              tags=[GraalPythonTags.svmunit]) as task:
        if task:
            svm_image_name = "./graalpython-svm"
            if not os.path.exists(svm_image_name):
                python_svm(["-h"])
            else:
                llvm_home = mx_subst.path_substitutions.substitute(
                    '--native.Dllvm.home=<path:SULONG_LIBS>')
                args = [
                    "--python.CoreHome=%s" %
                    os.path.join(_suite.dir, "graalpython", "lib-graalpython"),
                    "--python.StdLibHome=%s" %
                    os.path.join(_suite.dir, "graalpython", "lib-python/3"),
                    llvm_home
                ]
                run_python_unittests(svm_image_name, args)

    with Task('GraalPython apptests', tasks,
              tags=[GraalPythonTags.apptests]) as task:
        if task:
            apprepo = os.environ["GRAALPYTHON_APPTESTS_REPO_URL"]
            _apptest_suite = _suite.import_suite(
                "graalpython-apptests",
                version="f40fcf3af008d30a67e0dbc325a0d90f1e68f0c0",
                urlinfos=[
                    mx.SuiteImportURLInfo(mx_urlrewrites.rewriteurl(apprepo),
                                          "git", mx.vc_system("git"))
                ])
            mx.run_mx(["-p", _apptest_suite.dir, "graalpython-apptests"])

    with Task('GraalPython license header update',
              tasks,
              tags=[GraalPythonTags.license]) as task:
        if task:
            python_checkcopyrights([])

    with Task('GraalPython GraalVM shared-library build',
              tasks,
              tags=[GraalPythonTags.downstream,
                    GraalPythonTags.graalvm]) as task:
        if task:
            run_shared_lib_test()

    with Task('GraalPython GraalVM build',
              tasks,
              tags=[GraalPythonTags.downstream,
                    GraalPythonTags.graalvm]) as task:
        if task:
            svm_image = python_svm(["--version"])
            benchmark = os.path.join(PATH_MESO, "image-magix.py")
            out = mx.OutputCapture()
            mx.run([svm_image, benchmark],
                   nonZeroIsFatal=True,
                   out=mx.TeeOutputCapture(out))
            success = "\n".join([
                "[0, 0, 0, 0, 0, 0, 10, 10, 10, 0, 0, 10, 3, 10, 0, 0, 10, 10, 10, 0, 0, 0, 0, 0, 0]",
            ])
            if success not in out.data:
                mx.abort('Output from generated SVM image "' + svm_image +
                         '" did not match success pattern:\n' + success)
Esempio n. 9
0
def _tregex_tests_gate_runner(args, tasks):
    with Task('UnitTests', tasks, tags=['default', 'all']) as t:
        if t:
            unittest(['--enable-timing', '--very-verbose', 'com.oracle.truffle.regex'])
Esempio n. 10
0
def travis1(args=None):
    """executes the first Travis job (ECJ and Javac build, findbugs, benchmarks, polyglot, interop, tck, asm, types, Sulong, and LLVM test cases)"""
    tasks = []
    with Task('BuildJavaWithEcj', tasks) as t:
        if t:
            if mx.get_env('JDT'):
                mx.command_function('build')(
                    ['-p', '--no-native', '--warning-as-error'])
                gate_clean([], tasks, name='CleanAfterEcjBuild')
            else:
                mx._warn_or_abort(
                    'JDT environment variable not set. Cannot execute BuildJavaWithEcj task.',
                    args.strict_mode)
    with Task('BuildJavaWithJavac', tasks) as t:
        if t:
            mx.command_function('build')(
                ['-p', '--warning-as-error', '--no-native', '--force-javac'])
    with Task('Findbugs', tasks) as t:
        if t and mx_findbugs.findbugs([]) != 0:
            t.abort('FindBugs warnings were found')
    with Task('TestBenchmarks', tasks) as t:
        if t: runBenchmarkTestCases()
    with Task('TestPolglot', tasks) as t:
        if t: runPolyglotTestCases()
    with Task('TestInterop', tasks) as t:
        if t: runInteropTestCases()
    with Task('TestTck', tasks) as t:
        if t: runTckTestCases()
    with Task('TestAsm', tasks) as t:
        if t: runAsmTestCases()
    with Task('TestTypes', tasks) as t:
        if t: runTypeTestCases()
    with Task('TestSulong', tasks) as t:
        if t: runTruffleTestCases()
    with Task('TestLLVM', tasks) as t:
        if t: runLLVMTestCases()
Esempio n. 11
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'
            ])
Esempio n. 12
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('Graal compiler'):
            # 1. a full open-source build should be built with an open-source JDK but we allow Oracle JDK in non-strict mode as it is common on developer machines
            # 2. the build must be a GraalVM
            # 3. the build must be JVMCI-enabled since the 'Graal compiler' component is registered
            version_regex = mx_vm.openjdk_version_regex if args.strict_mode else mx_vm.anyjdk_version_regex
            mx_vm.check_versions(
                mx_vm.graalvm_output(),
                version_regex,
                graalvm_version_regex=mx_vm.graalvm_version_regex,
                expect_graalvm=True,
                check_jvmci=True)

    with Task('Vm: Sulong tests', tasks, tags=[VmGateTasks.sulong]) as t:
        if t and mx_vm.has_component('Sulong', fatalIfMissing=True):
            pass

    with Task('Vm: Graal.js tests', tasks, tags=[VmGateTasks.graal_js]) as t:
        if t and mx_vm.has_component('Graal.js', fatalIfMissing=True):
            pass

    with Task('Vm: Graal.nodejs tests', tasks,
              tags=[VmGateTasks.graal_nodejs]) as t:
        if t and mx_vm.has_component('Graal.nodejs', fatalIfMissing=True):
            pass

    with Task('Vm: TruffleRuby tests', tasks,
              tags=[VmGateTasks.truffleruby]) as t:
        if t and mx_vm.has_component('TruffleRuby', fatalIfMissing=True):
            pass

    with Task('Vm: FastR tests', tasks, tags=[VmGateTasks.fastr]) as t:
        if t and mx_vm.has_component('FastR', fatalIfMissing=True):
            pass

    with Task('Vm: Graal.Python tests', tasks,
              tags=[VmGateTasks.graalpython]) as t:
        if t and mx_vm.has_component('Graal.Python', fatalIfMissing=True):
            pass

    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_argument = [
                '-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary',
                '-XX:JVMCILibPath=' + dirname(libgraal_location)
            ]
            if args.extra_vm_argument:
                extra_vm_argument += args.extra_vm_argument
            import mx_compiler
            mx_compiler.compiler_gate_benchmark_runner(tasks,
                                                       extra_vm_argument,
                                                       prefix='LibGraal: ')

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

                    def _unittest_config_participant(config):
                        vmArgs, mainClass, mainClassArgs = config
                        newVmArgs = [
                            arg for arg in vmArgs if arg !=
                            "-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime"
                        ]
                        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_argument + [
                        "-Dgraal.TruffleCompileImmediately=true",
                        "-Dgraal.TruffleBackgroundCompilation=false", "truffle"
                    ])

            with Task('LibGraal GraalVM smoke test',
                      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'
                    ])
    else:
        mx.warn("Skipping libgraal tests: component not enabled")

    gate_substratevm(tasks)
    gate_sulong(tasks)
    gate_ruby(tasks)
    gate_python(tasks)
Esempio n. 13
0
def graalpython_gate_runner(args, tasks):
    with Task('GraalPython JUnit', tasks,
              tags=[GraalPythonTags.junit]) as task:
        if task:
            punittest(['--verbose'])

    with Task('GraalPython Python tests',
              tasks,
              tags=[GraalPythonTags.unittest]) as task:
        if task:
            test_args = [
                "graalpython/com.oracle.graal.python.test/src/graalpytest.py",
                "-v", "graalpython/com.oracle.graal.python.test/src/tests/"
            ]
            mx.command_function("python")(test_args)
            if platform.system() != 'Darwin':
                # TODO: re-enable when python3 is available on darwin
                mx.run(["python3"] + test_args, nonZeroIsFatal=True)

    with Task('GraalPython downstream R tests',
              tasks,
              tags=[GraalPythonTags.downstream, GraalPythonTags.R]) as task:
        script_r2p = os.path.join(_suite.dir, "graalpython", "benchmarks",
                                  "src", "benchmarks", "interop",
                                  "r_python_image_demo.r")
        script_p2r = os.path.join(_suite.dir, "graalpython", "benchmarks",
                                  "src", "benchmarks", "interop",
                                  "python_r_image_demo.py")
        pythonjars = os.pathsep.join([
            os.path.join(_suite.dir, "mxbuild", "dists", "graalpython.jar"),
            os.path.join(_suite.dir, "mxbuild", "dists", "graalpython-env.jar")
        ])
        if task:
            rrepo = os.environ["FASTR_REPO_URL"]
            testdownstream(_suite, [
                rrepo,
                mx.suite("truffle").vc._remote_url(
                    mx.suite("truffle").dir, "origin")
            ], ".", [[
                "--dynamicimports", "graalpython",
                "--version-conflict-resolution", "latest_all", "build",
                "--force-deprecation-as-warning"
            ],
                     [
                         "--cp-sfx", pythonjars, "r", "--polyglot",
                         "--file=%s" % script_r2p
                     ]])
            testdownstream(_suite, [
                rrepo,
                mx.suite("truffle").vc._remote_url(
                    mx.suite("truffle").dir, "origin")
            ], ".", [[
                "--dynamicimports", "graalpython",
                "--version-conflict-resolution", "latest_all", "build",
                "--force-deprecation-as-warning"
            ],
                     [
                         "-v", "--cp-sfx", pythonjars, "r", "--jvm",
                         "--polyglot", "-e",
                         "eval.polyglot('python', path='%s')" % str(script_p2r)
                     ]])

    with Task('GraalPython license header update',
              tasks,
              tags=[GraalPythonTags.license]) as task:
        if task:
            python_license_headers_update([])

    with Task('GraalPython downstream svm binary tests',
              tasks,
              tags=[GraalPythonTags.downstream,
                    GraalPythonTags.svmbinary]) as task:
        if task:
            _run_downstream_svm(
                [[
                    "--dynamicimports", "graalpython",
                    "delete-graalpython-if-testdownstream"
                ],
                 [
                     "gate", '-B--force-deprecation-as-warning', "--tags",
                     "build,python"
                 ]],
                binary=True)

    with Task('GraalPython downstream svm source tests',
              tasks,
              tags=[GraalPythonTags.downstream,
                    GraalPythonTags.svmsource]) as task:
        if task:
            _run_downstream_svm([[
                "--dynamicimports", "graalpython", "--strict-compliance",
                "gate", '-B--force-deprecation-as-warning', "--strict-mode",
                "--tags", "build,python"
            ]])

    for name, iterations in sorted(python_test_benchmarks.iteritems()):
        with Task('PythonBenchmarksTest:' + name,
                  tasks,
                  tags=[GraalPythonTags.benchmarks]) as task:
            if task:
                _gate_python_benchmarks_tests(
                    "graalpython/benchmarks/src/benchmarks/" + name + ".py",
                    iterations)
Esempio n. 14
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('Graal compiler'):
            _java = join(mx_vm.graalvm_output(), 'bin', 'java')

            _out = mx.OutputCapture()
            if mx.run([_java, '-XX:+JVMCIPrintProperties'],
                      nonZeroIsFatal=False,
                      out=_out,
                      err=_out):
                mx.log_error(_out.data)
                mx.abort(
                    'The GraalVM image is not built with a JVMCI-enabled JDK, it misses `-XX:+JVMCIPrintProperties`.'
                )

            _out = subprocess.check_output([_java, '-version'],
                                           stderr=subprocess.STDOUT)
            if args.strict_mode:
                # A full open-source build should be built with an open-source JDK
                _version_regex = _openjdk_version_regex
            else:
                # Allow Oracle JDK in non-strict mode as it is common on developer machines
                _version_regex = _anyjdk_version_regex
            match = _version_regex.match(_out)
            if match is None:
                if args.strict_mode and _anyjdk_version_regex.match(_out):
                    mx.abort(
                        "In --strict-mode, GraalVM must be built with OpenJDK")
                else:
                    mx.abort(
                        'Unexpected version string:\n{}Does not match:\n{}'.
                        format(_out, _version_regex.pattern))
            elif match.group('graalvm_version') != _suite.release_version():
                mx.abort(
                    "Wrong GraalVM version in -version string: got '{}', expected '{}'"
                    .format(match.group('graalvm_version'),
                            _suite.release_version()))

    with Task('Vm: Sulong tests', tasks, tags=[VmGateTasks.sulong]) as t:
        if t and mx_vm.has_component('Sulong', fatalIfMissing=True):
            pass

    with Task('Vm: Graal.js tests', tasks, tags=[VmGateTasks.graal_js]) as t:
        if t and mx_vm.has_component('Graal.js', fatalIfMissing=True):
            pass

    with Task('Vm: Graal.nodejs tests', tasks,
              tags=[VmGateTasks.graal_nodejs]) as t:
        if t and mx_vm.has_component('Graal.nodejs', fatalIfMissing=True):
            pass

    with Task('Vm: TruffleRuby tests', tasks,
              tags=[VmGateTasks.truffleruby]) as t:
        if t and mx_vm.has_component('TruffleRuby', fatalIfMissing=True):
            pass

    with Task('Vm: FastR tests', tasks, tags=[VmGateTasks.fastr]) as t:
        if t and mx_vm.has_component('FastR', fatalIfMissing=True):
            pass

    with Task('Vm: Graal.Python tests', tasks,
              tags=[VmGateTasks.graalpython]) as t:
        if t and mx_vm.has_component('Graal.Python', fatalIfMissing=True):
            pass

    gate_sulong(tasks)
    gate_ruby(tasks)
Esempio n. 15
0
def gate_python(tasks):
    with Task('Python', tasks, tags=[VmGateTasks.python]) as t:
        if t:
            python_svm_image_path = join(mx_vm.graalvm_output(), 'bin', 'graalpython')
            python_suite = mx.suite("graalpython")
            python_suite.extensions.run_python_unittests(python_svm_image_path)
Esempio n. 16
0
def gate_body(args, tasks):
    # all mx_sdk_vm_impl gate tasks can also be run as vm gate tasks
    mx_sdk_vm_impl.gate_body(args, tasks)

    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:
                    mx.run([
                        join(mx_sdk_vm_impl.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"
                    ]
                    compiler_log_file = "graal-compiler.log"
                    mx_unittest.unittest(unittest_args + extra_vm_arguments + [
                        "-Dgraal.TruffleCompileImmediately=true",
                        "-Dgraal.TruffleBackgroundCompilation=false",
                        "-Dgraal.TraceTruffleCompilation=true",
                        "-Dgraalvm.locatorDisabled=true",
                        "-Dgraal.PrintCompilation=true", "-Dgraal.LogFile={0}".
                        format(compiler_log_file), "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)
Esempio n. 17
0
def executeGate():
    """executes the TruffleLLVM gate tasks"""
    tasks = []
    with Task('Findbugs', tasks) as t:
        if t and mx_findbugs.findbugs([]) != 0:
            t.abort('FindBugs warnings were found')
    with Task('TestBenchmarks', tasks) as t:
        if t: runBenchmarkTestCases()
    with Task('TestTypes', tasks) as t:
        if t: runTypeTestCases()
    with Task('TestPolglot', tasks) as t:
        if t: runPolyglotTestCases()
    with Task('TestInterop', tasks) as t:
        if t: runInteropTestCases()
    with Task('TestTck', tasks) as t:
        if t: runTckTestCases()
    with Task('TestAsm', tasks) as t:
        if t: runAsmTestCases()
    with Task('TestSulong', tasks) as t:
        if t: runTruffleTestCases()
    with Task('TestGCC', tasks) as t:
        if t: runGCCTestCases()
    with Task('TestLLVM', tasks) as t:
        if t: runLLVMTestCases()
    with Task('TestNWCC', tasks) as t:
        if t: runNWCCTestCases()
    with Task('TestGCCSuiteCompile', tasks) as t:
        if t: runCompileTestCases()
    with Task('TestJRuby', tasks) as t:
        if t: runTestJRuby()
    with Task('TestArgon2', tasks) as t:
        if t: runTestArgon2(optimize=False)
Esempio n. 18
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')
Esempio n. 19
0
def jaotc_gate_runner(tasks):
    with Task('jaotc', tasks, tags=['jaotc', 'fulltest']) as t:
        if t: jaotc_test([])
Esempio n. 20
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'])
Esempio n. 21
0
def gate_body(args, tasks):
    # all mx_sdk_vm_impl gate tasks can also be run as vm gate tasks
    if not args.all_suites:
        mx_sdk_vm_impl.gate_body(args, tasks)

    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'
                    ])

                    # Ensure that fatal errors in libgraal route back to HotSpot
                    testdir = mkdtemp()
                    try:
                        cmd = [
                            java_exe, '-XX:+UseJVMCICompiler',
                            '-XX:+UseJVMCINativeLibrary',
                            '-Dlibgraal.CrashAt=length,hashCode',
                            '-Dlibgraal.CrashAtIsFatal=true', '-jar',
                            mx.library('DACAPO').get_path(True), 'avrora'
                        ]
                        out = mx.OutputCapture()
                        exitcode = mx.run(cmd,
                                          cwd=testdir,
                                          nonZeroIsFatal=False,
                                          out=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 command to result in non-zero exit code: '
                                    + ' '.join(cmd))
                        else:
                            hs_err = None
                            testdir_entries = listdir(testdir)
                            for name in testdir_entries:
                                if name.startswith('hs_err_pid'
                                                   ) and name.endswith('.log'):
                                    hs_err = join(testdir, name)
                            if hs_err is None:
                                mx.abort(
                                    'Expected a file starting with "hs_err_pid" in test directory. Entries found='
                                    + str(testdir_entries))
                            with open(join(testdir, hs_err)) as fp:
                                contents = fp.read()
                            if 'Fatal error in JVMCI' not in contents:
                                mx.abort(
                                    'Expected "Fatal error in JVMCI" to be in contents of '
                                    + hs_err + ':' + linesep + contents)
                    finally:
                        mx.rmtree(testdir)

            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)
Esempio n. 22
0
def _sulong_gate_runner(args, tasks):
    _unittest_task_factory = UnittestTaskFactory()

    def _unittest(title,
                  test_suite,
                  tags=None,
                  testClasses=None,
                  unittestArgs=None,
                  description=None):
        _unittest_task_factory.add(title,
                                   test_suite,
                                   args,
                                   tags=tags,
                                   testClasses=testClasses,
                                   unittestArgs=unittestArgs,
                                   description=description)

    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('BuildLLVMorg', tasks, tags=['style', 'clangformat']) as t:
        # needed for clang-format
        if t: build_llvm_org(args)
    with Task('ClangFormat', tasks, tags=['style', 'clangformat']) as t:
        if t: clangformat([])
    # Folders not containing tests: options, services, util
    _unittest('Benchmarks',
              'SULONG_SHOOTOUT_TEST_SUITE',
              description="Language Benchmark game tests",
              testClasses=['ShootoutsSuite'],
              tags=['benchmarks', 'sulongMisc'])
    _unittest('Types',
              'SULONG_TEST',
              description="Test floating point arithmetic",
              testClasses=['com.oracle.truffle.llvm.tests.types.floating.'],
              tags=['type', 'sulongMisc', 'sulongCoverage'])
    _unittest('Pipe',
              'SULONG_TEST',
              description="Test output capturing",
              testClasses=['CaptureOutputTest'],
              tags=['pipe', 'sulongMisc', 'sulongCoverage'])
    _unittest('LLVM',
              'SULONG_LLVM_TEST_SUITE',
              description="LLVM 3.2 test suite",
              testClasses=['LLVMSuite'],
              tags=['llvm', 'sulongCoverage'])
    _unittest('NWCC',
              'SULONG_NWCC_TEST_SUITE',
              description="Test suite of the NWCC compiler v0.8.3",
              testClasses=['NWCCSuite'],
              tags=['nwcc', 'sulongCoverage'])
    _unittest('GCCParserTorture',
              'SULONG_PARSER_TORTURE',
              description="Parser test using GCC suite",
              testClasses=['ParserTortureSuite'],
              tags=['parser', 'sulongCoverage'])
    _unittest('GCC_C',
              'SULONG_GCC_C_TEST_SUITE',
              description="GCC 5.2 test suite (C tests)",
              testClasses=['GccCSuite'],
              tags=['gcc_c', 'sulongCoverage'])
    _unittest('GCC_CPP',
              'SULONG_GCC_CPP_TEST_SUITE',
              description="GCC 5.2 test suite (C++ tests)",
              testClasses=['GccCppSuite'],
              tags=['gcc_cpp', 'sulongCoverage'])
    _unittest('GCC_Fortran',
              'SULONG_GCC_FORTRAN_TEST_SUITE',
              description="GCC 5.2 test suite (Fortran tests)",
              testClasses=['GccFortranSuite'],
              tags=['gcc_fortran', 'sulongCoverage'])
    _unittest('Sulong',
              'SULONG_STANDALONE_TEST_SUITES',
              description="Sulong's internal tests",
              testClasses='SulongSuite',
              tags=['sulong', 'sulongBasic', 'sulongCoverage'])
    _unittest('Interop',
              'SULONG_EMBEDDED_TEST_SUITES',
              description="Truffle Language interoperability tests",
              testClasses=['com.oracle.truffle.llvm.tests.interop.'],
              tags=['interop', 'sulongBasic', 'sulongCoverage'])
    _unittest('Linker',
              'SULONG_EMBEDDED_TEST_SUITES',
              description=None,
              testClasses=['com.oracle.truffle.llvm.tests.linker.'],
              tags=['linker', 'sulongBasic', 'sulongCoverage'])
    _unittest(
        'Debug',
        'SULONG_EMBEDDED_TEST_SUITES',
        description="Debug support test suite",
        testClasses=['com.oracle.truffle.llvm.tests.debug.LLVMDebugTest'],
        tags=['debug', 'sulongBasic', 'sulongCoverage'])
    _unittest(
        'IRDebug',
        'SULONG_EMBEDDED_TEST_SUITES',
        description=None,
        testClasses=['com.oracle.truffle.llvm.tests.debug.LLVMIRDebugTest'],
        tags=['irdebug', 'sulongBasic', 'sulongCoverage'])
    _unittest('BitcodeFormat',
              'SULONG_EMBEDDED_TEST_SUITES',
              description=None,
              testClasses=['com.oracle.truffle.llvm.tests.bitcodeformat.'],
              tags=['bitcodeFormat', 'sulongBasic', 'sulongCoverage'])
    _unittest('DebugExpr',
              'SULONG_EMBEDDED_TEST_SUITES',
              description=None,
              testClasses=[
                  'com.oracle.truffle.llvm.tests.debug.LLVMDebugExprParserTest'
              ],
              tags=['debugexpr', 'sulongBasic', 'sulongCoverage'])
    _unittest('OtherTests',
              'SULONG_EMBEDDED_TEST_SUITES',
              description=None,
              testClasses=[
                  'com.oracle.truffle.llvm.tests.bitcode.',
                  'com.oracle.truffle.llvm.tests.other.',
                  'com.oracle.truffle.llvm.tests.runtime.'
              ],
              tags=['otherTests', 'sulongBasic', 'sulongCoverage'])
    _unittest('Args',
              'SULONG_EMBEDDED_TEST_SUITES',
              description="Tests main args passing",
              testClasses=['com.oracle.truffle.llvm.tests.MainArgsTest'],
              tags=['args', 'sulongMisc', 'sulongCoverage'])
    _unittest('Callback',
              'SULONG_EMBEDDED_TEST_SUITES',
              description="Test calling native functions",
              testClasses=['com.oracle.truffle.llvm.tests.CallbackTest'],
              tags=['callback', 'sulongMisc', 'sulongCoverage'])
    _unittest('Varargs',
              'SULONG_EMBEDDED_TEST_SUITES',
              description="Varargs tests",
              testClasses=['com.oracle.truffle.llvm.tests.VAArgsTest'],
              tags=['vaargs', 'sulongMisc', 'sulongCoverage'])
    _unittest_task_factory.execute(tasks)
    with Task('TestToolchain',
              description="build toolchain-launchers-tests project",
              tags=['toolchain', 'sulongMisc', 'sulongCoverage'],
              tasks=tasks) as t:
        if t:
            with SulongGateEnv():
                mx.command_function(
                    'clean')(['--project', 'toolchain-launchers-tests'] +
                             args.extra_build_args)
                mx.command_function(
                    'build')(['--project', 'toolchain-launchers-tests'] +
                             args.extra_build_args)
Esempio n. 23
0
 def run(self, tasks, extraVMarguments=None):
     with Task(self.name + ': hosted-product ', tasks, tags=self.tags) as t:
         if t: mx_microbench.get_microbenchmark_executor().microbench(_noneAsEmptyList(extraVMarguments) + ['--', '-foe', 'true'] + self.args)
Esempio n. 24
0
def compiler_gate_runner(suites,
                         unit_test_runs,
                         bootstrap_tests,
                         tasks,
                         extraVMarguments=None):

    # Build server-hosted-jvmci now so we can run the unit tests
    with Task('BuildHotSpotGraalHosted: product',
              tasks,
              tags=[GraalTags.test, GraalTags.fulltest]) as t:
        if t: buildvms(['--vms', 'server', '--builds', 'product'])

    with VM('server', 'product'):
        # Run unit tests on server-hosted-jvmci
        for r in unit_test_runs:
            r.run(suites, tasks, extraVMarguments)

    # Run microbench on server-hosted-jvmci (only for testing the JMH setup)
    with VM('server', 'product'):
        for r in [
                MicrobenchRun('Microbench', ['TestJMH'],
                              tags=[GraalTags.fulltest])
        ]:
            r.run(tasks, extraVMarguments)

    # Run ctw against rt.jar on server-hosted-jvmci
    with VM('server', 'product'):
        with Task('CTW:hosted-product', tasks, tags=[GraalTags.fulltest]) as t:
            if t:
                ctw([
                    '--ctwopts', '-Inline +ExitVMOnException', '-esa',
                    '-G:+CompileTheWorldMultiThreaded',
                    '-G:-InlineDuringParsing', '-G:-CompileTheWorldVerbose',
                    '-XX:ReservedCodeCacheSize=400m'
                ], _noneAsEmptyList(extraVMarguments))

    # Build the jvmci VMs so we can run the other tests
    with Task('BuildHotSpotGraalJVMCI: fastdebug',
              tasks,
              tags=[GraalTags.bootstrap, GraalTags.fulltest]) as t:
        if t: buildvms(['--vms', 'jvmci', '--builds', 'fastdebug'])
    with Task('BuildHotSpotGraalJVMCI: product',
              tasks,
              tags=[GraalTags.fulltest]) as t:
        if t: buildvms(['--vms', 'jvmci', '--builds', 'product'])

    # bootstrap tests
    for b in bootstrap_tests:
        b.run(tasks, extraVMarguments)

    # run dacapo sanitychecks
    for vmbuild in ['fastdebug', 'product']:
        for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild, extraVmArguments=extraVMarguments) \
                + sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild, extraVmArguments=extraVMarguments):
            with Task(str(test) + ':' + vmbuild,
                      tasks,
                      tags=[GraalTags.fulltest]) as t:
                if t and not test.test('jvmci'):
                    t.abort(test.name + ' Failed')

    # ensure -Xbatch still works
    with VM('jvmci', 'product'):
        with Task('DaCapo_pmd:BatchMode:product',
                  tasks,
                  tags=[GraalTags.fulltest]) as t:
            if t:
                dacapo(_noneAsEmptyList(extraVMarguments) + ['-Xbatch', 'pmd'])

    # ensure benchmark counters still work
    with VM('jvmci', 'product'):
        with Task('DaCapo_pmd:BenchmarkCounters:product',
                  tasks,
                  tags=[GraalTags.fulltest]) as t:
            if t:
                dacapo(
                    _noneAsEmptyList(extraVMarguments) + [
                        '-G:+LIRProfileMoves', '-G:+GenericDynamicCounters',
                        '-XX:JVMCICounterSize=10', 'pmd'
                    ])

    # ensure -Xcomp still works
    with VM('jvmci', 'product'):
        with Task('XCompMode:product', tasks, tags=[GraalTags.fulltest]) as t:
            if t:
                run_vm(
                    _noneAsEmptyList(extraVMarguments) +
                    ['-Xcomp', '-version'])
Esempio n. 25
0
def executeGate():
    """executes the TruffleLLVM gate tasks"""
    tasks = []
    with Task('BasicChecks', tasks) as t:
        if t: runChecks()
    mx_testsuites.runSuite()
Esempio n. 26
0
 def run(self, tasks, extraVMarguments=None):
     with Task(self.name + ': hosted-product ', tasks) as t:
         if t:
             microbench(
                 _noneAsEmptyList(extraVMarguments) + ['--'] + self.args)
Esempio n. 27
0
def _sulong_gate_runner(args, tasks):
    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('BuildLLVMorg', tasks, tags=['style', 'clangformat']) as t:
        # needed for clang-format
        if t: build_llvm_org(args)
    with Task('ClangFormat', tasks, tags=['style', 'clangformat']) as t:
        if t: clangformatcheck()
    _sulong_gate_testsuite('Benchmarks',
                           'shootout',
                           tasks,
                           args,
                           tags=['benchmarks', 'sulongMisc'])
    _sulong_gate_unittest(
        'Types',
        'SULONG_TEST',
        tasks,
        args,
        tags=['type', 'sulongMisc', 'sulongCoverage'],
        testClasses=['com.oracle.truffle.llvm.tests.types.floating'])
    _sulong_gate_unittest('Pipe',
                          'SULONG_TEST',
                          tasks,
                          args,
                          tags=['pipe', 'sulongMisc', 'sulongCoverage'],
                          testClasses=['CaptureOutputTest'])
    _sulong_gate_testsuite('LLVM',
                           'llvm',
                           tasks,
                           args,
                           tags=['llvm', 'sulongCoverage'])
    _sulong_gate_testsuite('NWCC',
                           'nwcc',
                           tasks,
                           args,
                           tags=['nwcc', 'sulongCoverage'])
    _sulong_gate_testsuite('GCCParserTorture',
                           'parserTorture',
                           tasks,
                           args,
                           tags=['parser', 'sulongCoverage'],
                           vmArgs=['-Dpolyglot.llvm.parseOnly=true'])
    _sulong_gate_testsuite('GCC_C',
                           'gcc_c',
                           tasks,
                           args,
                           tags=['gcc_c', 'sulongCoverage'])
    _sulong_gate_testsuite('GCC_CPP',
                           'gcc_cpp',
                           tasks,
                           args,
                           tags=['gcc_cpp', 'sulongCoverage'])
    _sulong_gate_testsuite('GCC_Fortran',
                           'gcc_fortran',
                           tasks,
                           args,
                           tags=['gcc_fortran', 'sulongCoverage'])
    _sulong_gate_sulongsuite_unittest(
        'Sulong',
        tasks,
        args,
        testClasses='SulongSuite',
        tags=['sulong', 'sulongBasic', 'sulongCoverage'])
    _sulong_gate_sulongsuite_unittest(
        'Interop',
        tasks,
        args,
        testClasses='com.oracle.truffle.llvm.tests.interop',
        tags=['interop', 'sulongBasic', 'sulongCoverage'])
    _sulong_gate_sulongsuite_unittest(
        'Linker',
        tasks,
        args,
        testClasses='com.oracle.truffle.llvm.tests.linker',
        tags=['linker', 'sulongBasic', 'sulongCoverage'])
    _sulong_gate_sulongsuite_unittest(
        'Debug',
        tasks,
        args,
        testClasses='LLVMDebugTest',
        tags=['debug', 'sulongBasic', 'sulongCoverage'])
    _sulong_gate_sulongsuite_unittest(
        'IRDebug',
        tasks,
        args,
        testClasses='LLVMIRDebugTest',
        tags=['irdebug', 'sulongBasic', 'sulongCoverage'])
    _sulong_gate_sulongsuite_unittest(
        'BitcodeFormat',
        tasks,
        args,
        testClasses='BitcodeFormatTest',
        tags=['bitcodeFormat', 'sulongBasic', 'sulongCoverage'])
    _sulong_gate_sulongsuite_unittest(
        'OtherTests',
        tasks,
        args,
        testClasses='com.oracle.truffle.llvm.tests.other',
        tags=['otherTests', 'sulongBasic', 'sulongCoverage'])
    _sulong_gate_testsuite('Assembly',
                           'inlineassemblytests',
                           tasks,
                           args,
                           testClasses='InlineAssemblyTest',
                           tags=['assembly', 'sulongMisc', 'sulongCoverage'])
    _sulong_gate_testsuite(
        'Args',
        'other',
        tasks,
        args,
        tags=['args', 'sulongMisc', 'sulongCoverage'],
        testClasses=['com.oracle.truffle.llvm.tests.MainArgsTest'])
    _sulong_gate_testsuite(
        'Callback',
        'other',
        tasks,
        args,
        tags=['callback', 'sulongMisc', 'sulongCoverage'],
        testClasses=['com.oracle.truffle.llvm.tests.CallbackTest'])
    _sulong_gate_testsuite(
        'Varargs',
        'other',
        tasks,
        args,
        tags=['vaargs', 'sulongMisc', 'sulongCoverage'],
        testClasses=['com.oracle.truffle.llvm.tests.VAArgsTest'])
    with Task('TestToolchain',
              tasks,
              tags=['toolchain', 'sulongMisc', 'sulongCoverage']) as t:
        if t:
            mx.command_function(
                'clean')(['--project', 'toolchain-launchers-tests'] +
                         args.extra_build_args)
            mx.command_function(
                'build')(['--project', 'toolchain-launchers-tests'] +
                         args.extra_build_args)
Esempio n. 28
0
def compiler_gate_runner(suites,
                         unit_test_runs,
                         bootstrap_tests,
                         tasks,
                         extraVMarguments=None):

    # Run unit tests in hosted mode
    with JVMCIMode('hosted'):
        for r in unit_test_runs:
            r.run(suites, tasks, extraVMarguments)

    # Run microbench in hosted mode (only for testing the JMH setup)
    with JVMCIMode('hosted'):
        for r in [MicrobenchRun('Microbench', ['TestJMH'])]:
            r.run(tasks, extraVMarguments)

    # Run ctw against rt.jar on server-hosted-jvmci
    with JVMCIMode('hosted'):
        with Task('CTW:hosted', tasks) as t:
            if t:
                ctw([
                    '--ctwopts', '-Inline +ExitVMOnException', '-esa',
                    '-G:+CompileTheWorldMultiThreaded',
                    '-G:-InlineDuringParsing', '-G:-CompileTheWorldVerbose',
                    '-XX:ReservedCodeCacheSize=300m'
                ], _noneAsEmptyList(extraVMarguments))

    # bootstrap tests
    for b in bootstrap_tests:
        b.run(tasks, extraVMarguments)

    # run dacapo sanitychecks
    for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel='release', extraVmArguments=extraVMarguments) \
            + sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel='release', extraVmArguments=extraVMarguments):
        with Task(str(test) + ':' + 'release', tasks) as t:
            if t and not test.test('jvmci'):
                t.abort(test.name + ' Failed')

    # ensure -Xbatch still works
    with JVMCIMode('jit'):
        with Task('DaCapo_pmd:BatchMode', tasks) as t:
            if t:
                dacapo(_noneAsEmptyList(extraVMarguments) + ['-Xbatch', 'pmd'])

    # ensure benchmark counters still work
    with JVMCIMode('jit'):
        with Task('DaCapo_pmd:BenchmarkCounters:product', tasks) as t:
            if t:
                dacapo(
                    _noneAsEmptyList(extraVMarguments) + [
                        '-G:+LIRProfileMoves', '-G:+GenericDynamicCounters',
                        '-XX:JVMCICounterSize=10', 'pmd'
                    ])

    # ensure -Xcomp still works
    with JVMCIMode('jit'):
        with Task('XCompMode:product', tasks) as t:
            if t:
                run_vm(
                    _noneAsEmptyList(extraVMarguments) +
                    ['-Xcomp', '-version'])
Esempio n. 29
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)
Esempio n. 30
0
def _espresso_gate_runner(args, tasks):
    # Jackpot configuration is inherited from Truffle.
    with Task('Jackpot', tasks, tags=[EspressoDefaultTags.jackpot]) as t:
        if t:
            jackpot(['--fail-on-warnings'], suite=None, nonZeroIsFatal=True)