How to run a specific Graal test?

Doug Simon doug.simon at oracle.com
Tue Nov 29 15:46:22 UTC 2016


> On 29 Nov 2016, at 16:08, Andrew Haley <aph at redhat.com> wrote:
> 
> On 29/11/16 14:44, Doug Simon wrote:
>> If you post the failing stack trace, I could give you more info.
> 
> Attached: it's a VM crash.  As soon as I can duplicate the test in a
> debugger I'll be able to fix it.
> 
> I find it very difficult to run juinit tests because they don't really
> expose what the VM is doing, and it's very hard to run them in a
> single test in a debugger.  I'm sure they're not deliberately making
> it hard, but it sometimes seems that way.

I assume that you’re talking about a native debugger, not a Java debugger. In that case, it can be useful to run *only* the crashing test. Assuming the test that fails is NewMultiArrayTest.test1, you can run:

mx -v unittest NewMultiArrayTest#test1

On my Mac, the output includes:

/Library/Java/JavaVirtualMachines/labsjdk1.8.0_111-jvmci-0.23/bin/java -server -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -d64 -Djvmci.class.path.append=/Users/dsimon/graal/graal-core/mxbuild/dists/graal.jar -Xbootclasspath/a:/Users/dsimon/graal/truffle/mxbuild/dists/truffle-api.jar -esa -ea -Djava.awt.headless=true -cp /Users/dsimon/.mx/cache/HAMCREST_42a25dc3219429f0e5d060061f71acb49bf010a0.jar:/Users/dsimon/.mx/cache/JUNIT_4e031bb61df09069aeb2bffb4019e7a5034a4ee0.jar:/Users/dsimon/Dropbox/mx/mxbuild/java/com.oracle.mxtool.junit/bin:/Library/Java/JavaVirtualMachines/labsjdk1.8.0_111-jvmci-0.23/jre/lib/jvmci-services.jar:/Library/Java/JavaVirtualMachines/labsjdk1.8.0_111-jvmci-0.23/jre/lib/jvmci/jvmci-api.jar:/Users/dsimon/graal/graal-core/mxbuild/graal/com.oracle.graal.test/bin:/Users/dsimon/graal/graal-core/mxbuild/graal/com.oracle.graal.api.test/bin:/Users/dsimon/graal/graal-core/mxbuild/graal/com.oracle.graal.graph.test/bin:/Users/dsimon/.mx/cache/JAVA_ALLOCATION_INSTRUMENTER_476d9a44cd19d6b55f81571077dfa972a4f8a083.jar:/Users/dsimon/graal/graal-core/mxbuild/graal/com.oracle.graal.compiler.test/bin:/Users/dsimon/graal/graal-core/mxbuild/graal/com.oracle.graal.replacements.test/bin -XX:-UseJVMCIClassLoader com.oracle.mxtool.junit.MxJUnitWrapper -JUnitEagerStackTrace 'com.oracle.graal.replacements.test.NewMultiArrayTest#test1’

Now I can debug this in lldb as follows:

dsimon at kurz-3 ~/g/graal-core> lldb /Library/Java/JavaVirtualMachines/labsjdk1.8.0_111-jvmci-0.23/bin/java
(lldb) target create "/Library/Java/JavaVirtualMachines/labsjdk1.8.0_111-jvmci-0.23/bin/java"
Current executable set to '/Library/Java/JavaVirtualMachines/labsjdk1.8.0_111-jvmci-0.23/bin/java' (x86_64).
(lldb) run -server -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -d64 -Djvmci.class.path.append=/Users/dsimon/graal/graal-core/mxbuild/dists/graal.jar -Xbootclasspath/a:/Users/dsimon/graal/truffle/mxbuild/dists/truffle-api.jar -esa -ea -Djava.awt.headless=true -cp /Users/dsimon/.mx/cache/HAMCREST_42a25dc3219429f0e5d060061f71acb49bf010a0.jar:/Users/dsimon/.mx/cache/JUNIT_4e031bb61df09069aeb2bffb4019e7a5034a4ee0.jar:/Users/dsimon/Dropbox/mx/mxbuild/java/com.oracle.mxtool.junit/bin:/Library/Java/JavaVirtualMachines/labsjdk1.8.0_111-jvmci-0.23/jre/lib/jvmci-services.jar:/Library/Java/JavaVirtualMachines/labsjdk1.8.0_111-jvmci-0.23/jre/lib/jvmci/jvmci-api.jar:/Users/dsimon/graal/graal-core/mxbuild/graal/com.oracle.graal.test/bin:/Users/dsimon/graal/graal-core/mxbuild/graal/com.oracle.graal.api.test/bin:/Users/dsimon/graal/graal-core/mxbuild/graal/com.oracle.graal.graph.test/bin:/Users/dsimon/.mx/cache/JAVA_ALLOCATION_INSTRUMENTER_476d9a44cd19d6b55f81571077dfa972a4f8a083.jar:/Users/dsimon/graal/graal-core/mxbuild/graal/com.oracle.graal.compiler.test/bin:/Users/dsimon/graal/graal-core/mxbuild/graal/com.oracle.graal.replacements.test/bin -XX:-UseJVMCIClassLoader com.oracle.mxtool.junit.MxJUnitWrapper -JUnitEagerStackTrace 'com.oracle.graal.replacements.test.NewMultiArrayTest#test1'
Process 45997 launched: '/Library/Java/JavaVirtualMachines/labsjdk1.8.0_111-jvmci-0.23/bin/java' (x86_64)

Hope that helps.

-Doug

> 
> Thanks,
> 
> Andrew.
> 
> 
> 
> com.oracle.graal.replacements.test.NewMultiArrayTest started
>  test1: #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> #  SIGILL (0x4) at pc=0x0000007f79983dd8, pid=46366, tid=46367
> #
> # JRE version: OpenJDK Runtime Environment (9.0) (build 9-internal+0-2016-11-28-162713.aph.hs)
> # Java VM: OpenJDK 64-Bit Server VM (9-internal+0-2016-11-28-162713.aph.hs, mixed mode, tiered, jvmci, compressed oops, g1 gc, linux-aarch64)
> # Problematic frame:
> # C  0x0000007f79983dd8
> #
> # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
> #
> # An error report file with more information is saved as:
> # /nfs/zebedee/home/graal/clean/graal-core/hs_err_pid46366.log
> #
> # If you would like to submit a bug report, please visit:
> #   http://bugreport.java.com/bugreport/crash.jsp
> #
> [exit code: -6]
>  File "/nfs/zebedee/home/graal/clean/mx/mx.py", line 14608, in <module>
>    main()
>  File "/nfs/zebedee/home/graal/clean/mx/mx.py", line 14592, in main
>    retcode = c(command_args)
>  File "/nfs/zebedee/home/graal/clean/mx/mx_gate.py", line 347, in gate
>    runner(args, tasks)
>  File "/nfs/zebedee/home/graal/clean/graal-core/mx.graal-core/mx_graal_core.py", line 474, in _graal_gate_runner
>    compiler_gate_runner(['graal-core', 'truffle'], graal_unit_test_runs, graal_bootstrap_tests, tasks, args.extra_vm_argument)
>  File "/nfs/zebedee/home/graal/clean/graal-core/mx.graal-core/mx_graal_core.py", line 377, in compiler_gate_runner
>    r.run(suites, tasks, ['-XX:-UseJVMCICompiler'] + _remove_empty_entries(extraVMarguments))
>  File "/nfs/zebedee/home/graal/clean/graal-core/mx.graal-core/mx_graal_core.py", line 290, in run
>    if t: unittest(['--suite', suite, '--fail-fast'] + extra_args + self.args + _remove_empty_entries(extraVMarguments))
>  File "/nfs/zebedee/home/graal/clean/mx/mx_unittest.py", line 369, in unittest
>    _unittest(args, ['@Test', '@Parameters'], **parsed_args.__dict__)
>  File "/nfs/zebedee/home/graal/clean/mx/mx_unittest.py", line 257, in _unittest
>    _run_tests(args, harness, vmLauncher, annotations, testfile, blacklist, whitelist, regex, mx.suite(suite) if suite else None)
>  File "/nfs/zebedee/home/graal/clean/mx/mx_unittest.py", line 166, in _run_tests
>    harness(depsContainingTests, vmLauncher, vmArgs)
>  File "/nfs/zebedee/home/graal/clean/mx/mx_unittest.py", line 247, in harness
>    vmLauncher.launcher(*config)
>  File "/nfs/zebedee/home/graal/clean/graal-core/mx.graal-core/mx_graal_core.py", line 495, in _unittest_vm_launcher
>    run_vm(vmArgs + [mainClass] + mainClassArgs)
>  File "/nfs/zebedee/home/graal/clean/graal-core/mx.graal-core/mx_graal_core.py", line 775, in run_vm
>    return run_java(args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
>  File "/nfs/zebedee/home/graal/clean/graal-core/mx.graal-core/mx_graal_core.py", line 750, in run_java
>    return mx.run(cmd, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, env=env)
>  File "/nfs/zebedee/home/graal/clean/mx/mx.py", line 8772, in run
>    abort(retcode)
>  File "/nfs/zebedee/home/graal/clean/mx/mx.py", line 9393, in abort
>    traceback.print_stack()
> gate: 29 Nov 2016 14:19:40: END:   UnitTests: hosted-product graal-core [0:02:46.926390] [disk (free/total): 24.5GB/618.0GB]
> Traceback (most recent call last):
>  File "/nfs/zebedee/home/graal/clean/mx/mx_gate.py", line 347, in gate
>    runner(args, tasks)
>  File "/nfs/zebedee/home/graal/clean/graal-core/mx.graal-core/mx_graal_core.py", line 474, in _graal_gate_runner
>    compiler_gate_runner(['graal-core', 'truffle'], graal_unit_test_runs, graal_bootstrap_tests, tasks, args.extra_vm_argument)
>  File "/nfs/zebedee/home/graal/clean/graal-core/mx.graal-core/mx_graal_core.py", line 377, in compiler_gate_runner
>    r.run(suites, tasks, ['-XX:-UseJVMCICompiler'] + _remove_empty_entries(extraVMarguments))
>  File "/nfs/zebedee/home/graal/clean/graal-core/mx.graal-core/mx_graal_core.py", line 290, in run
>    if t: unittest(['--suite', suite, '--fail-fast'] + extra_args + self.args + _remove_empty_entries(extraVMarguments))
>  File "/nfs/zebedee/home/graal/clean/mx/mx_unittest.py", line 369, in unittest
>    _unittest(args, ['@Test', '@Parameters'], **parsed_args.__dict__)
>  File "/nfs/zebedee/home/graal/clean/mx/mx_unittest.py", line 257, in _unittest
>    _run_tests(args, harness, vmLauncher, annotations, testfile, blacklist, whitelist, regex, mx.suite(suite) if suite else None)
>  File "/nfs/zebedee/home/graal/clean/mx/mx_unittest.py", line 166, in _run_tests
>    harness(depsContainingTests, vmLauncher, vmArgs)
>  File "/nfs/zebedee/home/graal/clean/mx/mx_unittest.py", line 247, in harness
>    vmLauncher.launcher(*config)
>  File "/nfs/zebedee/home/graal/clean/graal-core/mx.graal-core/mx_graal_core.py", line 495, in _unittest_vm_launcher
>    run_vm(vmArgs + [mainClass] + mainClassArgs)
>  File "/nfs/zebedee/home/graal/clean/graal-core/mx.graal-core/mx_graal_core.py", line 775, in run_vm
>    return run_java(args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
>  File "/nfs/zebedee/home/graal/clean/graal-core/mx.graal-core/mx_graal_core.py", line 750, in run_java
>    return mx.run(cmd, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, env=env)
>  File "/nfs/zebedee/home/graal/clean/mx/mx.py", line 8772, in run
>    abort(retcode)
>  File "/nfs/zebedee/home/graal/clean/mx/mx.py", line 9409, in abort
>    raise SystemExit(codeOrMessage)
> SystemExit: -6
> <hs_err_pid46366.log>



More information about the graal-dev mailing list