Skip to content

LinkageError causes the test run to fail #439

@flooey

Description

@flooey

Description

If there is a class in the classpath that will not load due to changes in the underlying system (causing a LinkageError), the test runner process crashes when scanning the classpath.

I believe this can be fixed by adjusting the logic around https://github.com/android/android-test/blob/master/runner/android_junit_runner/java/androidx/test/internal/runner/TestLoader.java#L80 to catch LinkageError and report it similarly to ClassNotFoundException, though I don't know if you want to report it identically.

This was originally reported at google/conscrypt#713.

Steps to Reproduce

Include a class that cannot load on the classpath (eg, a class that overrides a final method). The class need not be a test class or referenced by any other class.

Expected Results

The test run should ignore the unloadable class and test the loadable classes.

Actual Results

The test runner crashes.

AndroidX Test and Android OS Versions

All versions, as far as I can tell.

Link to a public git repo demonstrating the problem:

Using an Android 10 device:

git clone https://github.com/flooey/okhttp
# Set ANDROID_SDK_ROOT appropriately
cd okhttp
./gradlew android-test:connectedCheck

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions