Skip to content

[GR-69986] mx unittestcan't reliably execute seleted tests #12213

@simonis

Description

@simonis

mx unittest --help prints the following usage instructions:

usage: mx unittest ... [test filters...] [VM options...]
...
    If test filters are supplied, only tests whose fully qualified name
    includes a filter as a substring are run.

    For example:

       mx unittest -Djdk.graal.Dump= -Djdk.graal.MethodFilter=BC_aload -Djdk.graal.PrintCFG=true BC_aload

    will run all JUnit test classes that contain 'BC_aload' in their
    fully qualified name and will pass these options to the VM:

        -Djdk.graal.Dump= -Djdk.graal.MethodFilter=BC_aload -Djdk.graal.PrintCFG=true

Unfortunately, executing only selected tests by applying specific filters, doesn't always work reliably, because some tests rely on setup configurations done for other tests. E.g. when executing:

$ mx --primary-suite vm --env ce unittest --record-results --print-failed failed.txt --use-graalvm com.oracle.graal.pointsto.standalone.test

The will fail with:

test(com.oracle.graal.pointsto.standalone.test.AnalysisEntryPointsFileTest)
java.lang.IllegalAccessError: superinterface check failed: class com.oracle.graal.pointsto.infrastructure.WrappedMetaAccess (in unnamed module @0x75a1cd57) cannot access class jdk.vm.ci.meta.MetaAccessProvider (in module jdk.internal.vm.ci) because module jdk.internal.vm.ci does not export jdk.vm.ci.meta to unnamed module @0x75a1cd57

because the mx unittest doesn't set up the corresponding -JUnitOpenPackages 'jdk.internal.vm.ci/*=org.graalvm.truffle.runtime,jdk.graal.compiler,ALL-UNNAMED' option. If we just run mx unitetest without filter this setup will be done e.g. by compiler/mx.compiler.py in GraalUnittestConfig and com.oracle.graal.pointsto.standalone.test won't run into this issue.

But mx unittest should be rewritten in such a way that it picks up the dependencies for all tests independently, no matter if they are executed together with other tests or not. Otherwise, test filters don't make a lot of sense.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions