Example #1
0
graalvm_hostvm_configs = [('jvm', [], ['--jvm'], 50),
                          ('native', [], ['--native'], 100)]


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


mx_gate.add_gate_runner(_suite, _sdk_gate_runner)


def build_oracle_compliant_javadoc_args(suite, product_name, feature_name):
    """
    :type product_name: str
    :type feature_name: str
    """
    version = suite.release_version()
    revision = suite.vc.parent(suite.vc_dir)
    copyright_year = str(
        datetime.datetime.fromtimestamp(
            suite.vc.parent_info(suite.vc_dir)['committer-ts']).year)
    return [
        '--arg', '@-header', '--arg',
        '<b>%s %s Java API Reference<br>%s</b><br>%s' %
Example #2
0
        'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'tfl',
        'tflm'
    ],
                                 _suite,
                                 env_file=False)
else:
    mx_sdk_vm.register_vm_config('svm', [
        'bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'gu',
        'gvm', 'nfi', 'ni', 'nil', 'nju', 'nic', 'poly', 'polynative', 'rgx',
        'sdk', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm',
        'svml', 'tfl', 'tflm'
    ],
                                 _suite,
                                 env_file=False)

mx_gate.add_gate_runner(_suite, mx_vm_gate.gate_body)


def mx_post_parse_cmd_line(args):
    mx_vm_benchmark.register_graalvm_vms()


def mx_register_dynamic_suite_constituents(register_project,
                                           register_distribution):
    """
    :type register_project: (mx.Project) -> None
    :type register_distribution: (mx.Distribution) -> None
    """
    if mx_sdk_vm_impl.has_component('FastR'):
        fastr_release_env = mx.get_env('FASTR_RELEASE', None)
        if fastr_release_env != 'true':
        '-esa', '-G:+TraceRA', '-G:RegisterPressure=' + _registers,
        '-G:+ExitVMOnException', '-G:+LIRUnlockBackendRestart'
    ]),
    BootstrapTest('BootstrapWithImmutableCode', [
        '-esa', '-G:+ImmutableCode', '-G:+VerifyPhases',
        '-G:+ExitVMOnException'
    ]),
]


def _graal_gate_runner(args, tasks):
    compiler_gate_runner(['graal'], graal_unit_test_runs,
                         graal_bootstrap_tests, tasks, args.extra_vm_argument)


mx_gate.add_gate_runner(_suite, _graal_gate_runner)
mx_gate.add_gate_argument(
    '--extra-vm-argument',
    action='append',
    help=
    'add extra vm argument to gate tasks if applicable (multiple occurrences allowed)'
)


def _unittest_vm_launcher(vmArgs, mainClass, mainClassArgs):
    run_vm(vmArgs + [mainClass] + mainClassArgs)


mx_unittest.set_vm_launcher('JDK9 VM launcher', _unittest_vm_launcher)

Example #4
0
    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)))

mx_gate.add_gate_runner(_suite, _truffle_gate_runner)

mx.update_commands(_suite, {
    'javadoc' : [javadoc, '[SL args|@VM options]'],
    'sl' : [sl, '[SL args|@VM options]'],
})

def _is_graalvm(jdk):
    releaseFile = os.path.join(jdk.home, "release")
    if exists(releaseFile):
        with open(releaseFile) as f:
            pattern = re.compile('^GRAALVM_VERSION=*')
            for line in f.readlines():
                if pattern.match(line):
                    return True
    return False
Example #5
0
    with mx_gate.Task('UnitTests: ExpectedTestOutput file check', tasks) as t:
        if t:
            if junit(['--tests', _gate_noapps_unit_tests(), '--check-expected-output']) != 0:
                t.abort('unit tests expected output check failed')

    with mx_gate.Task('UnitTests: +EST', tasks) as t:
        if t:
            if junit(['--J', '@-DR:+NewStateTransition', '--tests', _gate_noapps_unit_tests()]) != 0:
                t.abort('unit tests failed')

    with mx_gate.Task('UnitTests: -EST', tasks) as t:
        if t:
            if junit(['--J', '@-DR:-NewStateTransition', '--tests', _gate_noapps_unit_tests()]) != 0:
                t.abort('unit tests failed')

mx_gate.add_gate_runner(_fastr_suite, _fastr_gate_runner)

def gate(args):
    '''Run the R gate'''
    # exclude findbugs until compliant
    mx_gate.gate(args + ['-x', '-t', 'FindBugs,Checkheaders,Distribution Overlap Check,BuildJavaWithEcj'])

def _test_harness_body_install_new(args, vmArgs):
    '''the callback from mx.test'''
    libinstall = abspath("lib.install.cran")
    # make sure its empty
    shutil.rmtree(libinstall, ignore_errors=True)
    os.mkdir(libinstall)
    install_tmp = "install.tmp"
    shutil.rmtree(install_tmp, ignore_errors=True)
    os.mkdir(install_tmp)
Example #6
0
    truffleruby_suite = truffle_language_ensure('ruby', extract=False)

    suite_dir = truffleruby_suite.dir
    distsToExtract = ['TRUFFLERUBY-ZIP', 'TRUFFLERUBY-SPECS']
    lib = join(suite_dir, 'lib')
    if not exists(lib):
        # Binary suite, extract the distributions
        for dist_name in distsToExtract:
            mx.log('Extract distribution {} to {}'.format(dist_name, suite_dir))
            dist = mx.distribution(dist_name)
            with tarfile.open(dist.path, 'r:') as archive:
                archive.extractall(suite_dir)

    mx.command_function('ruby_testdownstream_aot')([aot_bin, 'spec', debug_build])

mx_gate.add_gate_runner(suite, svm_gate_body)

def cinterfacetutorial(native_image, args=None):
    """Build and run the tutorial for the C interface"""

    args = [] if args is None else args
    tutorial_proj = mx.dependency('com.oracle.svm.tutorial')
    cSourceDir = join(tutorial_proj.dir, 'native')
    buildDir = join(svmbuild_dir(), tutorial_proj.name, 'build')

    # clean / create output directory
    if exists(buildDir):
        remove_tree(buildDir)
    mkpath(buildDir)

    # Build the shared library from Java code
Example #7
0
        support_distributions=[
            'graalsqueak:GRAALSQUEAK_GRAALVM_SUPPORT',
        ],
        launcher_configs=[
            mx_sdk.LanguageLauncherConfig(
                language=LANGUAGE_ID,
                destination='bin/<exe:graalsqueak>',
                jar_distributions=['graalsqueak:GRAALSQUEAK_LAUNCHER'],
                main_class='%s.launcher.GraalSqueakLauncher' % PACKAGE_NAME,
                extra_jvm_args=BASE_VM_ARGS,
                build_args=[
                    # '--pgo-instrument',  # (uncomment to enable profiling)
                    # '--pgo',  # (uncomment to recompile with profiling info)
                ],
            )
        ],
        post_install_msg=None,
    ))

mx.update_commands(_suite, {
    'squeak': [_squeak, '[options]'],
})

mx_gate.add_gate_runner(_suite, _graalsqueak_gate_runner)

if mx.is_windows():
    # This patch works around "SSL: CERTIFICATE_VERIFY_FAILED" errors (See
    # https://www.python.org/dev/peps/pep-0476/).
    import ssl
    ssl._create_default_https_context = ssl._create_unverified_context
Example #8
0
import mx
import mx_sdk
from mx_unittest import unittest
from mx_gate import Task, add_gate_runner

_suite = mx.suite('regex')


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


mx_sdk.register_graalvm_component(
    mx_sdk.GraalVmLanguage(
        suite=_suite,
        name='TRegex',
        short_name='rgx',
        dir_name='regex',
        license_files=[],
        third_party_license_files=[],
        dependencies=['Truffle'],
        truffle_jars=['regex:TREGEX'],
        support_distributions=['regex:TREGEX_GRAALVM_SUPPORT'],
    ))

add_gate_runner(_suite, _tregex_tests_gate_runner)
Example #9
0
            mx.log('Extract distribution {} to {}'.format(
                dist_name, suite_dir))
            dist = mx.distribution(dist_name)
            with tarfile.open(dist.path, 'r:') as archive:
                archive.extractall(suite_dir)

    mx.command_function('ruby_testdownstream_aot')(
        [aot_bin, 'spec', debug_build])


def _svm_gate_body_server(args, tasks):
    with compile_server(["-H:+HostedAssertions"]) as port:
        svm_gate_body(args, tasks, port)


mx_gate.add_gate_runner(suite, _svm_gate_body_server)


def _substratevm_clibrary_path():
    clibrary_subdir = join('clibraries', mx.get_os() + "-" + mx.get_arch())
    return ','.join((join(root, clibrary_subdir) for root in clibrary_roots))


def _parse_standard_arguments(defaultAssertionsEnabled, args):
    hostedAssertions = defaultAssertionsEnabled
    i = 0
    while i < len(args):
        if args[i] == '-H:+HostedAssertions':
            hostedAssertions = True
            args.pop(i)
        elif args[i] == '-H:-HostedAssertions':
Example #10
0
import mx
import mx_gate
import mx_subst

from mx_gate import Task
from mx_unittest import unittest

_suite = mx.suite('sdk')

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

mx_gate.add_gate_runner(_suite, _sdk_gate_runner)


def javadoc(args):
    """build the Javadoc for all API packages"""
    mx.javadoc(['--unified', '--exclude-packages', 'org.graalvm.polyglot.tck'] + args)


class AbstractNativeImageConfig(object):
    __metaclass__ = ABCMeta

    def __init__(self, destination, jar_distributions, build_args, links=None):
        """
        :type destination: str
        :type jar_distributions: list[str]
        :type build_args: list[str]
Example #11
0
        vmArgs = vmArgs + ['--add-exports=java.base/jdk.internal.module=ALL-UNNAMED']

        # This is required for the call to setAccessible in
        # TruffleTCK.testValueWithSource to work.
        vmArgs = vmArgs + ['--add-opens=com.oracle.truffle.truffle_api/com.oracle.truffle.api.vm=ALL-UNNAMED', '--add-modules=ALL-MODULE-PATH']
    return (vmArgs, mainClass, mainClassArgs)

mx_unittest.add_config_participant(_unittest_config_participant)

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

mx_gate.add_gate_runner(_suite, _tools_gate_runner)

mx_sdk.register_graalvm_component(mx_sdk.GraalVmTool(
    suite=_suite,
    name='GraalVM Chrome Inspector',
    short_name='ins',
    dir_name='chromeinspector',
    license_files=[],
    third_party_license_files=[],
    truffle_jars=['tools:CHROMEINSPECTOR'],
    support_distributions=['tools:CHROMEINSPECTOR_GRAALVM_SUPPORT'],
    include_by_default=True,
))

mx_sdk.register_graalvm_component(mx_sdk.GraalVmTool(
    suite=_suite,
Example #12
0
    out = mx.OutputCapture()
    err = mx.OutputCapture()
    expected_output = "Hello from Python"
    with tempfile.NamedTemporaryFile() as f:
        f.write("print('%s')\n" % expected_output)
        f.flush()
        os.system("ls -l %s" % args[0])
        os.system("ls -l %s" % f.name)
        exitcode = mx.run([args[0], f.name], nonZeroIsFatal=False, out=out, err=err)
        if exitcode != 0:
            mx.abort("Python binary failed to execute: out=" + out.data+ " err=" + err.data)
        if out.data != expected_output + "\n":
            mx.abort("Python smoke test failed")
        mx.log("Python binary says: " + out.data)

mx_gate.add_gate_runner(suite, svm_gate_body)

def cinterfacetutorial(native_image, args=None):
    """Build and run the tutorial for the C interface"""

    args = [] if args is None else args
    tutorial_proj = mx.dependency('com.oracle.svm.tutorial')
    cSourceDir = join(tutorial_proj.dir, 'native')
    buildDir = join(svmbuild_dir(), tutorial_proj.name, 'build')

    # clean / create output directory
    if exists(buildDir):
        remove_tree(buildDir)
    mkpath(buildDir)

    # Build the shared library from Java code
Example #13
0
    # 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())

mx_gate.add_gate_runner(_suite, _jvmci_gate_runner)
mx_gate.add_gate_argument('-g', '--only-build-jvmci', action='store_false', dest='buildNonJVMCI', help='only build the JVMCI VM')

def _igvJdk():
    v8u20 = mx.VersionSpec("1.8.0_20")
    v8u40 = mx.VersionSpec("1.8.0_40")
    v8 = mx.VersionSpec("1.8")
    def _igvJdkVersionCheck(version):
        return version >= v8 and (version < v8u20 or version >= v8u40)
    return mx.get_jdk(_igvJdkVersionCheck, versionDescription='>= 1.8 and < 1.8.0u20 or >= 1.8.0u40', purpose="building & running IGV").home

def _igvBuildEnv():
        # When the http_proxy environment variable is set, convert it to the proxy settings that ant needs
    env = dict(os.environ)
    proxy = os.environ.get('http_proxy')
    if not (proxy is None) and len(proxy) > 0:
Example #14
0
    BootstrapTest('BootstrapWithSystemAssertions', 'fastdebug', ['-esa', '-G:+VerifyGraalGraphs', '-G:+VerifyGraalGraphEdges'], tags=[GraalTags.bootstrap]),
    BootstrapTest('BootstrapWithSystemAssertionsNoCoop', 'fastdebug', ['-esa', '-XX:-UseCompressedOops', '-G:+ExitVMOnException'], tags=[GraalTags.fulltest]),
    BootstrapTest('BootstrapWithGCVerification', 'product', ['-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-G:+ExitVMOnException'], tags=[GraalTags.fulltest], suppress=['VerifyAfterGC:', 'VerifyBeforeGC:']),
    BootstrapTest('BootstrapWithG1GCVerification', 'product', ['-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-G:+ExitVMOnException'], tags=[GraalTags.fulltest], suppress=['VerifyAfterGC:', 'VerifyBeforeGC:']),
    BootstrapTest('BootstrapEconomyWithSystemAssertions', 'fastdebug', ['-esa', '-Djvmci.Compiler=graal-economy', '-G:+ExitVMOnException'], tags=[GraalTags.fulltest]),
    BootstrapTest('BootstrapWithExceptionEdges', 'fastdebug', ['-esa', '-G:+StressInvokeWithExceptionNode', '-G:+ExitVMOnException'], tags=[GraalTags.fulltest]),
    BootstrapTest('BootstrapWithRegisterPressure', 'product', ['-esa', '-G:RegisterPressure=' + _registers, '-G:+ExitVMOnException', '-G:+LIRUnlockBackendRestart'], tags=[GraalTags.fulltest]),
    BootstrapTest('BootstrapTraceRAWithRegisterPressure', 'product', ['-esa', '-G:+TraceRA', '-G:RegisterPressure=' + _registers, '-G:+ExitVMOnException', '-G:+LIRUnlockBackendRestart'], tags=[GraalTags.fulltest]),
    BootstrapTest('BootstrapWithImmutableCode', 'product', ['-esa', '-G:+ImmutableCode', '-G:+VerifyPhases', '-G:+ExitVMOnException'], tags=[GraalTags.fulltest]),
]


def _graal_gate_runner(args, tasks):
    compiler_gate_runner(['graal-core', 'truffle'], graal_unit_test_runs, graal_bootstrap_tests, tasks, args.extra_vm_argument)

mx_gate.add_gate_runner(_suite, _graal_gate_runner)
mx_gate.add_gate_argument('--extra-vm-argument', action='append', help='add extra vm argument to gate tasks if applicable (multiple occurrences allowed)')

def _unittest_vm_launcher(vmArgs, mainClass, mainClassArgs):
    run_vm(vmArgs + [mainClass] + mainClassArgs)

mx_unittest.set_vm_launcher('JDK9 VM launcher', _unittest_vm_launcher)

def _parseVmArgs(jdk, args, addDefaultArgs=True):
    args = mx.expand_project_in_args(args, insitu=False)
    jacocoArgs = mx_gate.get_jacoco_agent_args()
    if jacocoArgs:
        args = jacocoArgs + args

    # Support for -G: options
    def translateGOption(arg):
Example #15
0
                ['--enable-timing', '--very-verbose', '--suite', 'brainfck'])

    # Jackpot configuration is inherited from Truffle.
    with Task('Jackpot', tasks, tags=[BrainfckDefaultTags.jackpot]) as t:
        if t:
            jackpot(['--fail-on-warnings'], suite=None, nonZeroIsFatal=True)


def verify_ci(args):
    """Verify CI configuration"""
    mx.verify_ci(args, mx.suite('truffle'), _suite, 'common.json')


# REGISTER MX GATE RUNNER
#########################
add_gate_runner(_suite, _brainfck_gate_runner)

mx_sdk_vm.register_graalvm_component(
    mx_sdk_vm.GraalVmLanguage(
        suite=_suite,
        name='Brainfck',
        short_name='bf',
        license_files=[],
        third_party_license_files=[],
        dependencies=['Truffle'],
        truffle_jars=['brainfck:BRAINFCK'],
        support_distributions=['brainfck:BRAINFCK_SUPPORT'],
        launcher_configs=[
            mx_sdk_vm.LanguageLauncherConfig(
                destination='bin/<exe:bf>',
                jar_distributions=['brainfck:BRAINFCK_LAUNCHER'],
            jar_distributions=['trufflesqueak:TRUFFLESQUEAK_LAUNCHER'],
            main_class='%s.launcher.TruffleSqueakLauncher' % PACKAGE_NAME,
            extra_jvm_args=BASE_VM_ARGS,
            build_args=[
                # '--pgo-instrument',  # (uncomment to enable profiling)
                # '--pgo',  # (uncomment to recompile with profiling info)
            ],
        )
    ],
    post_install_msg=(None if not _SVM else "\nNOTES:\n---------------\n" +
            "TruffleSqueak (SVM) requires SDL2 to be installed on your system:\n" +
            "- On Debian/Ubuntu, you can install SDL2 via `sudo apt-get install libsdl2-2.0`.\n" +
            "- On macOS, you can install SDL2 with Homebrew: `brew install sdl2`.\n\n" +
            "The pre-compiled native image is used by default and does not include other languages. " +
            "Run TruffleSqueak in JVM mode (via `trufflesqueak --jvm`) for polyglot access."),
))


mx.update_commands(_SUITE, {
    'squeak': [_squeak, '[options]'],
    'squeak-gvm': [_squeak_graalvm_launcher, '[options]'],
})

mx_gate.add_gate_runner(_SUITE, _trufflesqueak_gate_runner)

if mx.is_windows():
    # This patch works around "SSL: CERTIFICATE_VERIFY_FAILED" errors (See
    # https://www.python.org/dev/peps/pep-0476/).
    import ssl
    ssl._create_default_https_context = ssl._create_unverified_context
Example #17
0
    '3.9',
]

# the clang-format versions that can be used for formatting the test case C and C++ files
clangFormatVersions = ['3.4']

# the basic LLVM dependencies for running the test cases and executing the mx commands
basicLLVMDependencies = ['clang', 'clang++', 'opt', 'llc', 'llvm-as']


def _graal_llvm_gate_runner(args, tasks):
    """gate function"""
    executeGate()


add_gate_runner(_suite, _graal_llvm_gate_runner)


def executeGate():
    """executes the TruffleLLVM gate tasks"""
    tasks = []
    with Task('BasicChecks', tasks) as t:
        if t: runChecks()
    mx_testsuites.runSuite()


def travis1(args=None):
    """executes the first Travis job (Javac build, benchmarks, polyglot, interop, tck, asm, types, and LLVM test cases)"""
    tasks = []
    with Task('BuildJavaWithJavac', tasks) as t:
        if t:
Example #18
0
    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")


mx_gate.add_gate_runner(_fastr_suite, _fastr_gate_runner)


def rgate(args):
    '''
    Run 'mx.gate' with given args (used in CI system).
    N.B. This will fail if run without certain exclusions; use the local
    'gate' command for that.
    '''
    mx_gate.gate(args)


def _unittest_config_participant(config):
    vmArgs, mainClass, mainClassArgs = config
    # need to pass location of FASTR_UNIT_TESTS_NATIVE
    d = mx.distribution('FASTR_UNIT_TESTS_NATIVE')
Example #19
0
        ],
        launcher_configs=[
            mx_sdk.LanguageLauncherConfig(
                language=LANGUAGE_ID,
                destination='bin/<exe:trufflesqueak>',
                jar_distributions=['trufflesqueak:TRUFFLESQUEAK_LAUNCHER'],
                main_class='%s.launcher.TruffleSqueakLauncher' % PACKAGE_NAME,
                extra_jvm_args=BASE_VM_ARGS,
                build_args=[
                    # '--pgo-instrument',  # (uncomment to enable profiling)
                    # '--pgo',  # (uncomment to recompile with profiling info)
                ],
            )
        ],
        post_install_msg=None,
    ))

mx.update_commands(
    _suite, {
        'squeak': [_squeak, '[options]'],
        'squeak-gvm': [_squeak_graalvm_launcher, '[options]'],
    })

mx_gate.add_gate_runner(_suite, _trufflesqueak_gate_runner)

if mx.is_windows():
    # This patch works around "SSL: CERTIFICATE_VERIFY_FAILED" errors (See
    # https://www.python.org/dev/peps/pep-0476/).
    import ssl
    ssl._create_default_https_context = ssl._create_unverified_context
Example #20
0
        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')

add_gate_runner(_suite, _sulong_gate_runner)


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'
Example #21
0
    pythonTestBenchmarks = {
        'binarytrees3'  : '12',
        'fannkuchredux3': '9',
        'fasta3'        : '250000',
        'mandelbrot3'   : '600',
        'meteor3'       : '2098',
        'nbody3'        : '100000',
        'spectralnorm3' : '500',
        'richards3'     : '3',
        'bm-ai'         : '0',
        'pidigits'      : '0',
        'pypy-go'       : '1',
    }
    for name, iterations in sorted(pythonTestBenchmarks.iteritems()):
        with Task('PythonBenchmarksTest:' + name, tasks, tags=ZippyTags.benchmarktest) as t:
            if t: _gate_python_benchmarks_tests("zippy/benchmarks/src/benchmarks/" + name + ".py", iterations, vmargs)


def _zippy_gate_runner(args, tasks):
    extra_args = None if not _mx_graal else args.extra_vm_argument
    zippy_gate_runner(['zippy'], tasks, extra_args)

mx_gate.add_gate_runner(_suite, _zippy_gate_runner)


mx.update_commands(_suite, {
    # core overrides
    # new commands
    'python' : [python, '[Python args|@VM options]'],
})
Example #22
0
            commonArgs = ['-ea', '-esa']
            unitTestDir = join(
                mx.project(
                    'com.oracle.truffle.trufflenode.jniboundaryprofiler').dir,
                'tests')
            mx.run(['rm', '-rf', 'node_modules', 'build'], cwd=unitTestDir)
            npm([
                '--scripts-prepend-node-path=auto', 'install',
                '--nodedir=' + _suite.dir
            ] + commonArgs,
                cwd=unitTestDir)
            node(['-profile-native-boundary', 'test.js'] + commonArgs,
                 cwd=unitTestDir)


mx_gate.add_gate_runner(_suite, _graal_nodejs_post_gate_runner)


def python_cmd():
    if _currentOs == 'windows':
        return 'python.exe'
    else:
        return join(_suite.mxDir, 'python2', 'python')


class GraalNodeJsProject(mx.NativeProject):  # pylint: disable=too-many-ancestors
    def __init__(self, suite, name, deps, workingSets, results, output,
                 **args):
        self.suite = suite
        self.name = name
        mx.NativeProject.__init__(self, suite, name, '', [], deps, workingSets,
            ],
                   out=mx.TeeOutputCapture(out),
                   err=mx.TeeOutputCapture(out))
            assert "Using preinitialized context." in out.data

    with Task('GraalPython GraalVM native embedding',
              tasks,
              tags=[
                  GraalPythonTags.svm, GraalPythonTags.graalvm,
                  GraalPythonTags.native_image_embedder
              ]) as task:
        if task:
            run_embedded_native_python_test()


mx_gate.add_gate_runner(SUITE, graalpython_gate_runner)


def run_embedded_native_python_test(args=None):
    """
    Test that embedding an engine where a context was initialized at native image
    build-time is enough to create multiple contexts from that engine without
    those contexts having access to the core files, due to caching in the shared
    engine.
    """
    with mx.TempDirCwd(os.getcwd()) as dirname:
        python_launcher = python_gvm()
        graalvm_javac = os.path.join(os.path.dirname(python_launcher), "javac")
        graalvm_native_image = os.path.join(os.path.dirname(python_launcher),
                                            "native-image")
Example #24
0

class EspressoDefaultTags:
    jackpot = 'jackpot'


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)


# REGISTER MX GATE RUNNER
#########################
add_gate_runner(_suite, _espresso_gate_runner)

if mx_sdk_vm.base_jdk_version() > 8:
    if mx.is_windows():
        lib_espresso_cp = '%GRAALVM_HOME%\\lib\\graalvm\\lib-espresso.jar'
    else:
        lib_espresso_cp = '${GRAALVM_HOME}/lib/graalvm/lib-espresso.jar'
else:
    if mx.is_windows():
        lib_espresso_cp = '%GRAALVM_HOME%\\jre\\lib\\graalvm\\lib-espresso.jar'
    else:
        lib_espresso_cp = '${GRAALVM_HOME}/jre/lib/graalvm/lib-espresso.jar'

mx_sdk_vm.register_graalvm_component(
    mx_sdk_vm.GraalVmLanguage(
        suite=_suite,
Example #25
0
    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.")


add_gate_runner(_suite, graal_wasm_gate_runner)

#
# Project types.
#

benchmark_methods = [
    "_benchmarkIterationsCount", "_benchmarkSetupOnce", "_benchmarkSetupEach",
    "_benchmarkTeardownEach", "_benchmarkRun", "_main"
]


def remove_extension(filename):
    if filename.endswith(".c"):
        return filename[:-2]
    if filename.endswith(".wat"):
Example #26
0
    _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)


add_gate_runner(_suite, _sulong_gate_runner)
add_gate_argument('--extra-llvm-argument', dest='extra_llvm_arguments', action='append',
                  help='add extra llvm arguments to gate tasks', default=[])



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('<sulong_home>')]
    if imageArgs is not None:
        aotArgs += imageArgs
    if aotArgs:
        args += ['-Dsulongtest.testAOTArgs=' + ' '.join(aotArgs)]
Example #27
0
    # 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())

mx_gate.add_gate_runner(_suite, _jvmci_gate_runner)
mx_gate.add_gate_argument('-g', '--only-build-jvmci', action='store_false', dest='buildNonJVMCI', help='only build the JVMCI VM')

def _igvJdk():
    v8u20 = mx.VersionSpec("1.8.0_20")
    v8u40 = mx.VersionSpec("1.8.0_40")
    v8 = mx.VersionSpec("1.8")
    def _igvJdkVersionCheck(version):
        return version >= v8 and (version < v8u20 or version >= v8u40)
    return mx.get_jdk(_igvJdkVersionCheck, versionDescription='>= 1.8 and < 1.8.0u20 or >= 1.8.0u40', purpose="building & running IGV").home

def _igvBuildEnv():
        # When the http_proxy environment variable is set, convert it to the proxy settings that ant needs
    env = dict(os.environ)
    proxy = os.environ.get('http_proxy')
    if not (proxy is None) and len(proxy) > 0:
Example #28
0
        '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])


add_gate_runner(_suite, _graal_js_gate_runner)


class ArchiveProject(mx.ArchivableProject):
    def __init__(self, suite, name, deps, workingSets, theLicense, **args):
        mx.ArchivableProject.__init__(self, suite, name, deps, workingSets,
                                      theLicense)
        assert 'prefix' in args
        assert 'outputDir' in args

    def output_dir(self):
        return join(self.dir, self.outputDir)

    def archive_prefix(self):
        return self.prefix
Example #29
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 Signature Tests', tasks) as t:
        if t: sigtest(['--check', 'binary'])
    with Task('Tools UnitTests', tasks) as t:
        if t:
            unittest([
                '--suite', 'tools', '--enable-timing', '--verbose',
                '--fail-fast'
            ])


mx_gate.add_gate_runner(_suite, _tools_gate_runner)

mx_sdk_vm.register_graalvm_component(
    mx_sdk_vm.GraalVmTool(
        suite=_suite,
        name='GraalVM Language Server',
        short_name='lsp',
        dir_name='lsp',
        license_files=[],
        third_party_license_files=[],
        truffle_jars=['tools:LSP_API', 'tools:LSP'],
        support_distributions=['tools:LSP_GRAALVM_SUPPORT'],
        include_by_default=True,
    ))

mx_sdk_vm.register_graalvm_component(
Example #30
0
_gccSuiteDirRoot = join(_gccSuiteDir, 'gcc-5.2.0/gcc/testsuite/')

_llvmSuiteDir = join(_root, "com.oracle.truffle.llvm.test/suites/llvm/")
_llvmSuiteDirRoot = join(_llvmSuiteDir, 'test-suite-3.2.src')

_nwccSuiteDir = join(_root, "com.oracle.truffle.llvm.test/suites/nwcc/")

_benchGameSuiteDir = join(_root, "com.oracle.truffle.llvm.test/suites/benchmarkgame/")

_dragonEggPath = _toolDir + 'tools/dragonegg/dragonegg-3.2.src/dragonegg.so'

def _graal_llvm_gate_runner(args, tasks):
    """gate function"""
    executeGate()

add_gate_runner(_suite, _graal_llvm_gate_runner)

def executeGate():
    """executes the TruffleLLVM gate tasks"""
    tasks = []
    with Task('BuildHotSpotGraalServer: product', tasks) as t:
        if t: buildvms(['-c', '--vms', 'server', '--builds', 'product'])
    with VM('server', 'product'):
        with Task('Findbugs', tasks) as t:
            if t: mx_findbugs.findbugs([])
    with VM('server', 'product'):
        with Task('TestBenchmarks', tasks) as t:
            if t: runBenchmarkTestCases()
    with VM('server', 'product'):
        with Task('TestTypes', tasks) as t:
            if t: runTypeTestCases()
Example #31
0
                "--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)


mx_gate.add_gate_runner(_suite, graalpython_gate_runner)


def _run_downstream_svm(commands, binary=False):
    new_rewrites = None
    if binary:
        localmvn = "/tmp/graalpythonsnapshots"
        localmvnrepl = "file://%s" % localmvn
        publicmvn = mx.repository("python-public-snapshots").url
        publicmvnpattern = re.compile(publicmvn)
        git = mx.GitConfig()

        new_rewrites = [{
            publicmvnpattern.pattern: {
                "replacement": localmvnrepl
            }
Example #32
0
def build(args, vm=None):
    """build the Java sources"""
    opts2 = mx.build(['--source', '1.7'] + args)
    assert len(opts2.remainder) == 0

def sl(args):
    """run an SL program"""
    vmArgs, slArgs = mx.extract_VM_args(args)
    mx.run_java(vmArgs + ['-cp', mx.classpath(["TRUFFLE_API", "com.oracle.truffle.sl"]), "com.oracle.truffle.sl.SLLanguage"] + slArgs)

def sldebug(args):
    """run a simple command line debugger for the Simple Language"""
    vmArgs, slArgs = mx.extract_VM_args(args, useDoubleDash=True)
    mx.run_java(vmArgs + ['-cp', mx.classpath("com.oracle.truffle.sl.tools"), "com.oracle.truffle.sl.tools.debug.SLREPL"] + slArgs)

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

mx_gate.add_gate_runner(_suite, _truffle_gate_runner)

mx.update_commands(_suite, {
    'sl' : [sl, '[SL args|@VM options]'],
    'sldebug' : [sldebug, '[SL args|@VM options]'],
})
Example #33
0
    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"])

mx_gate.add_gate_runner(suite, libgraal_gate_body)

def javac_image_command(javac_path):
    return [join(javac_path, 'javac'), "-proc:none", "-bootclasspath",
            join(mx_compiler.jdk.home, "jre", "lib", "rt.jar")]


def _native_junit(native_image, unittest_args, build_args=None, run_args=None, blacklist=None, whitelist=None):
    unittest_args = unittest_args
    build_args = build_args or []
    run_args = run_args or ['--verbose']
    junit_native_dir = join(svmbuild_dir(), platform_name(), 'junit')
    mkpath(junit_native_dir)
    junit_tmp_dir = tempfile.mkdtemp(dir=junit_native_dir)
    try:
        unittest_deps = []