def gate_substratevm(tasks, quickbuild=False): tag = VmGateTasks.substratevm name = 'Run Truffle API tests on SVM' extra_build_args = [] if quickbuild: tag = VmGateTasks.substratevm_quickbuild name += ' with quickbuild' extra_build_args = ['-Ob'] with Task(name, tasks, tags=[tag]) as t: if t: tests = ['com.oracle.truffle.api.test.polyglot'] with NamedTemporaryFile(prefix='blacklist.', mode='w', delete=False) as fp: # ContextPreInitializationNativeImageTest must run in its own image fp.file.writelines([l + '\n' for l in ['com.oracle.truffle.api.test.polyglot.ContextPreInitializationNativeImageTest']]) blacklist_args = ["--blacklist", fp.name] truffle_with_compilation = [ '--verbose', '--macro:truffle', '-H:MaxRuntimeCompileMethods=5000', '-R:MaxHeapSize=2g', '--enable-url-protocols=jar', '--enable-url-protocols=http' ] args = ['--force-builder-on-cp', '--build-args'] + truffle_with_compilation + extra_build_args + blacklist_args + ['--'] + tests native_image_context, svm = graalvm_svm() with native_image_context(svm.IMAGE_ASSERTION_FLAGS) as native_image: svm._native_unittest(native_image, args)
def gate_svm_sl_tck(tasks): with Task('SVM Truffle TCK', tasks, tags=[VmGateTasks.svm_sl_tck]) as t: if t: tools_suite = mx.suite('tools') if not tools_suite: mx.abort("Cannot resolve tools suite.") svmbuild = mkdtemp() try: options = [ '--macro:truffle', '--tool:all', '-H:Path={}'.format(svmbuild), '-H:Class=org.junit.runner.JUnitCore', ] tests_image_path, tests_file = build_tests_image( svmbuild, options, ['com.oracle.truffle.tck.tests'], [ 'truffle:TRUFFLE_SL_TCK', 'truffle:TRUFFLE_TCK_INSTRUMENTATION' ]) with open(tests_file) as f: test_classes = [l.rstrip() for l in f.readlines()] mx.run([tests_image_path] + test_classes) finally: if not mx._opts.verbose: mx.rmtree(svmbuild)
def _run_test_task(tasks): with Task('Test' + title, tasks, tags=tags + run_tags, description=description) as t: if t: mx_sulong_suite_constituents.run(unittestArgs, testClasses)
def gate_python(tasks): with Task('Python', tasks, tags=[VmGateTasks.python]) as t: if t: python_svm_image_path = join(mx_sdk_vm_impl.graalvm_output(), 'bin', 'graalpython') python_suite = mx.suite("graalpython") python_suite.extensions.run_python_unittests(python_svm_image_path)
def gate_svm_sl_tck(tasks): with Task('SVM Truffle TCK', tasks, tags=[VmGateTasks.svm_sl_tck]) as t: if t: tools_suite = mx.suite('tools') if not tools_suite: mx.abort("Cannot resolve tools suite.") native_image_context, svm = graalvm_svm() with native_image_context(svm.IMAGE_ASSERTION_FLAGS) as native_image: svmbuild = mkdtemp() try: import mx_compiler unittest_deps = [] unittest_file = join(svmbuild, 'truffletck.tests') mx_unittest._run_tests([], lambda deps, vm_launcher, vm_args: unittest_deps.extend(deps), mx_unittest._VMLauncher('dummy_launcher', None, mx_compiler.jdk), ['@Test', '@Parameters'], unittest_file, [], [re.compile('com.oracle.truffle.tck.tests')], None, mx.suite('truffle')) if not exists(unittest_file): mx.abort('TCK tests not found.') unittest_deps.append(mx.dependency('truffle:TRUFFLE_SL_TCK')) unittest_deps.append(mx.dependency('truffle:TRUFFLE_TCK_INSTRUMENTATION')) vm_image_args = mx.get_runtime_jvm_args(unittest_deps, jdk=mx_compiler.jdk) options = [ '--macro:truffle', '--tool:all', '-H:Path={}'.format(svmbuild), '-H:Class=org.junit.runner.JUnitCore', ] tests_image = native_image(vm_image_args + options) with open(unittest_file) as f: test_classes = [l.rstrip() for l in f.readlines()] mx.run([tests_image] + test_classes) finally: mx.rmtree(svmbuild)
def compiler_simple_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) # bootstrap tests for b in bootstrap_tests: b.run(tasks, extraVMarguments) # ensure -Xcomp still works with JVMCIMode('jit'): with Task('XCompMode:product', tasks) as t: if t: run_vm( _noneAsEmptyList(extraVMarguments) + ['-Xcomp', '-version'])
def run(self, tasks, extraVMarguments=None): with Task(self.name, tasks, tags=self.tags) as t: if t: if self.suppress: out = mx.DuplicateSuppressingStream(self.suppress).write else: out = None run_vm(self.args + ['-XX:+UseJVMCICompiler'] + _remove_empty_entries(extraVMarguments) + ['-XX:-TieredCompilation', '-XX:+BootstrapJVMCI', '-version'], out=out)
def gate_ruby(tasks): with Task('Ruby', tasks, tags=[VmGateTasks.ruby]) as t: if t: ruby = join(mx_vm.graalvm_output(), 'jre', 'languages', 'ruby', 'bin', 'truffleruby') truffleruby_suite = mx.suite('truffleruby') truffleruby_suite.extensions.ruby_testdownstream_aot( [ruby, 'spec', 'release'])
def _graal_js_gate_runner(args, tasks): with Task('TestJSCommand', tasks, tags=[GraalJsDefaultTags.default, GraalJsDefaultTags.all]) as t: if t: js(['-Dtruffle.js.ProfileTime=true', '-e', '""']) with Task('UnitTests', tasks, tags=[GraalJsDefaultTags.default, GraalJsDefaultTags.all]) as t: if t: unittest([ '-Dtruffle.js.NashornJavaInterop=true', '--enable-timing', '--very-verbose', 'com.oracle.truffle.js.scriptengine.test' ]) gateTestConfigs = { GraalJsDefaultTags.default: ['gate'], 'noic': [ 'gate', '-Dtruffle.js.PropertyCacheLimit=0', '-Dtruffle.js.FunctionCacheLimit=0' ], 'directbytebuffer': ['gate', '-Dtruffle.js.DirectByteBuffer=true'], 'cloneuninitialized': ['gate', '-Dtruffle.js.TestCloneUninitialized=true'], 'lazytranslation': ['gate', '-Dtruffle.js.LazyTranslation=true'], } gateTestCommands = { 'Test262': test262, 'TestNashorn': testnashorn, 'TestV8': testv8, 'TestInstrumentation': testinstrumentation, 'TestThreading': testthreading, } for testCommandName in gateTestCommands: for testConfigName in gateTestConfigs: testName = '%s-%s' % (testCommandName, testConfigName) with Task(testName, tasks, tags=[testName, testConfigName, GraalJsDefaultTags.all]) as t: if t: gateTestCommands[testCommandName]( gateTestConfigs[testConfigName])
def run(self, suites, tasks, extraVMarguments=None): for suite in suites: with Task(self.name + ': hosted-release ' + suite, tasks) as t: if t: unittest([ '--suite', suite, '--enable-timing', '--verbose', '--fail-fast' ] + self.args + _noneAsEmptyList(extraVMarguments))
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: 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']) with Task('File name length check', tasks) as t: if t: check_filename_length([])
def run(self, suites, tasks, extraVMarguments=None): for suite in suites: with Task(self.name + ': hosted-product ' + suite, tasks, tags=self.tags) as t: if mx_gate.Task.verbose: extra_args = ['--verbose', '--enable-timing'] else: extra_args = [] if t: unittest(['--suite', suite, '--fail-fast'] + extra_args + self.args + _noneAsEmptyList(extraVMarguments))
def execute(self, tasks): with Task('Build_' + self.test_suite, tasks, tags=self.tags, description='Build ' + self.test_suite) as t: if t: mx_sulong_suite_constituents.compileTestSuite( self.test_suite, self.extra_build_args or [])
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 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 -Xcomp still works with JVMCIMode('jit'): with Task('XCompMode:product', tasks) as t: if t: run_vm( _noneAsEmptyList(extraVMarguments) + ['-Xcomp', '-version'])
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)
def _graal_js_gate_runner(args, tasks): with Task('CheckCopyrights', tasks, tags=['style']) as t: if t: if mx.checkcopyrights(['--primary']) != 0: t.abort('Copyright errors found. Please run "mx checkcopyrights --primary -- --fix" to fix them.') with Task('TestJSCommand', tasks, tags=[GraalJsDefaultTags.default, GraalJsDefaultTags.all]) as t: if t: js(['-Dpolyglot.js.profile-time=true', '-e', '""']) with Task('UnitTests', tasks, tags=[GraalJsDefaultTags.default, GraalJsDefaultTags.all]) as t: if t: unittest(['--enable-timing', '--very-verbose', '--suite', _suite.name]) gateTestConfigs = { GraalJsDefaultTags.default: ['gate'], 'noic': ['-Dpolyglot.js.property-cache-limit=0', '-Dpolyglot.js.function-cache-limit=0', 'gate'], 'directbytebuffer': ['-Dpolyglot.js.direct-byte-buffer=true', 'gate'], 'cloneuninitialized': ['-Dpolyglot.js.test-clone-uninitialized=true', 'gate'], 'lazytranslation': ['-Dpolyglot.js.lazy-translation=true', 'gate'], 'shareengine': ['gate', 'shareengine'], 'latestversion': ['gate', 'minesversion=2022'], 'instrument': ['gate', 'instrument', 'timeoutoverall=1800'] } gateTestCommands = { 'Test262': test262, 'TestNashorn': testnashorn, 'TestV8': testv8, } for testCommandName in gateTestCommands: for testConfigName in gateTestConfigs: # TestNashorn is not sensitive to ES version if testCommandName == 'TestNashorn' and testConfigName == 'latestversion': continue testName = '%s-%s' % (testCommandName, testConfigName) with Task(testName, tasks, tags=[testName, testConfigName, GraalJsDefaultTags.all]) as t: if t: gateTestCommands[testCommandName](gateTestConfigs[testConfigName]) with Task('TCK tests', tasks, tags=[GraalJsDefaultTags.all, GraalJsDefaultTags.tck]) as t: if t: import mx_truffle mx_truffle._tck([])
def run(self, tasks, extraVMarguments=None): with JVMCIMode('jit'): with Task(self.name, tasks, tags=self.tags) as t: if t: if self.suppress: out = mx.DuplicateSuppressingStream(self.suppress).write else: out = None run_vm(self.args + _noneAsEmptyList(extraVMarguments) + ['-XX:-TieredCompilation', '-XX:+BootstrapJVMCI', '-version'], out=out)
def _sulong_gate_testsuite(title, test_suite, tasks, args, tags=None, testClasses=None, vmArgs=None): if tags is None: tags = [test_suite] build_tags = ['build_' + t for t in tags] run_tags = ['run_' + t for t in tags] with Task('Build' + title, tasks, tags=tags + build_tags) as t: if t: mx_testsuites.compileTestSuite(test_suite, args.extra_build_args) with Task('Test' + title, tasks, tags=tags + run_tags) as t: if t: mx_testsuites.runTestSuite(test_suite, args, testClasses, (vmArgs or []) + args.extra_llvm_arguments)
def _jvmci_gate_runner(args, tasks): # Build release server VM now so we can run the unit tests with Task('BuildHotSpotJVMCIHosted: release', tasks) as t: if t: _runmultimake(['--jdk-jvm-variants', 'server', '--jdk-debug-levels', 'release']) # Run unit tests in hosted mode with VM(jvmVariant='server', debugLevel='release', jvmciMode='hosted'): with Task('JVMCI UnitTests: hosted-release', tasks) as t: if t: unittest(['--suite', 'jvmci', '--enable-timing', '--verbose', '--fail-fast']) # Build the other VM flavors with Task('BuildHotSpotJVMCIOthers: fastdebug', tasks) as t: if t: _runmultimake(['--jdk-jvm-variants', 'server', '--jdk-debug-levels', 'fastdebug']) with Task('CleanAndBuildIdealGraphVisualizer', tasks, disableJacoco=True) as t: if t and platform.processor() != 'sparc': buildxml = mx._cygpathU2W(join(_suite.dir, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')) mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=_igvBuildEnv())
def gate_svm_truffle_tck_js(tasks): with Task('JavaScript SVM Truffle TCK', tasks, tags=[VmGateTasks.svm_truffle_tck_js]) as t: if t: js_suite = mx.suite('graal-js') if not js_suite: mx.abort("Cannot resolve graal-js suite.") native_image_context, svm = graalvm_svm() with native_image_context(svm.IMAGE_ASSERTION_FLAGS) as native_image: _svm_truffle_tck(native_image, svm.suite, js_suite, 'js')
def svm_gate_body(args, tasks, port=-1): with Task('image helloworld', tasks, tags=[GraalTags.helloworld]) as t: if t: helloworld() with Task('JavaScript', tasks, tags=[GraalTags.js]) as t: if t: image_server(port, IMAGE_ASSERTION_FLAGS + ['-js'], True) test_run([join('svmbuild', 'js'), '-e', 'print("hello:" + Array.from(new Array(10), (x,i) => i*i ).join("|"))'], 'hello:0|1|4|9|16|25|36|49|64|81\n') test_js(suite.dir, [('octane-richards', 1000, 100, 300)]) with Task('Ruby', tasks, tags=[GraalTags.ruby]) as t: if t: image(['-Djava.library.path=/lib64', '--', '-ruby'] + IMAGE_ASSERTION_FLAGS, True) test_ruby([join(os.getcwd(), 'svmbuild', 'ruby'), 'release']) with Task('Python', tasks, tags=[GraalTags.python]) as t: if t: gate_build_python_image(port, []) test_python_smoke([join(os.getcwd(), 'svmbuild', 'python')]) gate_sulong(port, tasks, [])
def _sulong_gate_unittest(title, test_suite, tasks, args, tags=None, testClasses=None, unittestArgs=None): if tags is None: tags = [test_suite] if testClasses is None: testClasses = [test_suite] build_tags = ['build_' + t for t in tags] run_tags = ['run_' + t for t in tags] if not unittestArgs: unittestArgs = [] with Task('Build' + title, tasks, tags=tags + build_tags) as t: if t: mx_testsuites.compileTestSuite(test_suite, args.extra_build_args) with Task('Test' + title, tasks, tags=tags + run_tags) as t: if t: mx_testsuites.run(unittestArgs, testClasses)
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'])
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)
def libgraal_gate_body(args, tasks): msg = check_libgraal_dependencies() if msg: mx.logv('Skipping libgraal because: {}'.format(msg)) return with Task('Build libgraal', tasks, tags=[GraalTags.build, GraalTags.benchmarktest, GraalTags.test, GraalTags.libgraal]) as t: # Build libgraal with assertions in the image builder and assertions in the image if t: build_libgraal(['-J-esa', '-ea']) extra_vm_argument = ['-XX:+UseJVMCICompiler', '-XX:+UseJVMCINativeLibrary', '-XX:JVMCILibPath=' + os.getcwd()] if args.extra_vm_argument: extra_vm_argument += args.extra_vm_argument mx_compiler.compiler_gate_benchmark_runner(tasks, extra_vm_argument, libgraal=True) with Task('Test libgraal', tasks, tags=[GraalTags.libgraal]) as t: if t: mx_unittest.unittest(["--suite", "truffle", "--"] + extra_vm_argument + ["-Dgraal.TruffleCompileImmediately=true", "-Dgraal.TruffleBackgroundCompilation=false"])
def gate_substratevm(tasks): with Task('Run Truffle host interop tests on SVM', tasks, tags=[VmGateTasks.substratevm]) as t: if t: tests = ['ValueHostInteropTest', 'ValueHostConversionTest'] truffle_no_compilation = ['--initialize-at-build-time', '--macro:truffle', '-Dtruffle.TruffleRuntime=com.oracle.truffle.api.impl.DefaultTruffleRuntime'] args = ['--build-args'] + truffle_no_compilation + ['--'] + tests native_image_context, svm = graalvm_svm() with native_image_context(svm.IMAGE_ASSERTION_FLAGS) as native_image: svm._native_unittest(native_image, args)
def gate(args, tasks): with Task('Vm: Basic GraalVM Tests', tasks, tags=[VmGateTasks.graal]) as t: if t: _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())) if mx_vm.has_component('js'): with Task('Vm: Graal.js tests', tasks, tags=[VmGateTasks.graal_js]) as t: if t: pass
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([])
def gate_sulong(native_image, tasks): with Task('Run SulongSuite tests with SVM image', tasks, tags=[GraalTags.sulong]) as t: if t: sulong = truffle_language_ensure('sulong') native_image(['--sulong']) sulong.extensions.testLLVMImage(join(svmbuild_dir(), 'lli'), unittestArgs=['--enable-timing']) with Task('Run Sulong interop tests with SVM image', tasks, tags=[GraalTags.sulong]) as t: if t: sulong = truffle_language_ensure('sulong') sulong.extensions.runLLVMUnittests( functools.partial(native_junit, native_image, build_args=['--sulong']))
def _sulong_gate_unittest(title, test_suite, tasks, args, tags=None, testClasses=None, unittestArgs=None): if tags is None: tags = [test_suite] if testClasses is None: testClasses = [test_suite] build_tags = ['build_' + t for t in tags] run_tags = ['run_' + t for t in tags] if not unittestArgs: unittestArgs = ['--very-verbose', '--enable-timing'] unittestArgs += args.extra_llvm_arguments with Task('Build' + title, tasks, tags=tags + build_tags) as t: if t: mx_testsuites.compileTestSuite(test_suite, args.extra_build_args) with Task('Test' + title, tasks, tags=tags + run_tags) as t: if t: mx_testsuites.run(unittestArgs, testClasses)