Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim error stacktraces #729

Closed
pyricau opened this issue Sep 2, 2020 · 0 comments · Fixed by #730
Closed

Trim error stacktraces #729

pyricau opened this issue Sep 2, 2020 · 0 comments · Fixed by #730
Assignees

Comments

@pyricau
Copy link
Contributor

pyricau commented Sep 2, 2020

Junit 4.13 provides Failure.getTrimmedTrace() as an alternative to Failure.getTrace():

    /**
     * Gets a the printed form of the exception, with a trimmed version of the stack trace.
     * This method will attempt to filter out frames of the stack trace that are below
     * the test method call.
     */
    public String getTrimmedTrace() {
        return Throwables.getTrimmedStackTrace(getException());
    }

This could be used in InstrumentationResultPrinter.reportFailure() to report shorter stacktraces, avoiding binder transaction errors (#269) but also making those stacktraces more relevant.

Related conversation: https://github.com/android/android-test/pull/711/files#r480418828

Unfortunately getTrimmedTrace is only available in JUnit 4.13 and Androidx.test still uses junit 4.12.

Another option is to bring in just the part we need until then: https://github.com/junit-team/junit4/blob/r4.13/src/main/java/org/junit/internal/Throwables.java

@brettchabot brettchabot self-assigned this Sep 2, 2020
copybara-service bot pushed a commit that referenced this issue Sep 2, 2020
… classic/non-orchestrator modes.

This change should clean up test failure reporting by:
  - Remove test runner framework related stack frames
  - Truncate stack traces to a 64KB size when running under orchestrator
    to attempt to avoid binder transaction limits.
    This limit is already enforced when running in classic/non-orchestrator mode

JUnit 4.13 has a really nice getTrimmedStackTrace feature, but androidx.test
is fixed to 4.12 for the time being. So as a temporary workaround, copy
the relevant JUnit utilty class into this project.

Fixes #729, and hopefully #269

PiperOrigin-RevId: 329797783
copybara-service bot pushed a commit that referenced this issue Sep 3, 2020
… classic/non-orchestrator modes.

This change should clean up test failure reporting by:
  - Remove test runner framework related stack frames
  - Truncate stack traces to a 64KB size when running under orchestrator
    to attempt to avoid binder transaction limits.
    This limit is already enforced when running in classic/non-orchestrator mode

JUnit 4.13 has a really nice getTrimmedStackTrace feature, but androidx.test
is fixed to 4.12 for the time being. So as a temporary workaround, copy
the relevant JUnit utilty class into this project.

Fixes #729, and hopefully #269

PiperOrigin-RevId: 329797783
copybara-service bot pushed a commit that referenced this issue Sep 16, 2020
… classic/non-orchestrator modes.

This change should clean up test failure reporting by:
  - Remove test runner framework related stack frames
  - Truncate stack traces to a 64KB size when running under orchestrator
    to attempt to avoid binder transaction limits.
    This limit is already enforced when running in classic/non-orchestrator mode

JUnit 4.13 has a really nice getTrimmedStackTrace feature, but androidx.test
is fixed to 4.12 for the time being. So as a temporary workaround, copy
the relevant JUnit change junit-team/junit4#1028 into this project.

Fixes #729, and hopefully #269

PiperOrigin-RevId: 329797783
copybara-service bot pushed a commit that referenced this issue Sep 16, 2020
… classic/non-orchestrator modes.

This change should clean up test failure reporting by:
  - Remove test runner framework related stack frames
  - Truncate stack traces to a 64KB size when running under orchestrator
    to attempt to avoid binder transaction limits.
    This limit is already enforced when running in classic/non-orchestrator mode

JUnit 4.13 has a really nice getTrimmedStackTrace feature, but androidx.test
is fixed to 4.12 for the time being. So as a temporary workaround, copy
the relevant JUnit change junit-team/junit4#1028 into this project.

Fixes #729, and hopefully #269

PiperOrigin-RevId: 329797783
copybara-service bot pushed a commit that referenced this issue Sep 16, 2020
… classic/non-orchestrator modes.

This change should clean up test failure reporting by:
  - Remove test runner framework related stack frames
  - Truncate stack traces to a 64KB size when running under orchestrator
    to attempt to avoid binder transaction limits.
    This limit is already enforced when running in classic/non-orchestrator mode

JUnit 4.13 has a really nice getTrimmedStackTrace feature, but androidx.test
is fixed to 4.12 for the time being. So as a temporary workaround, copy
the relevant JUnit change junit-team/junit4#1028 into this project.

Fixes #729, and hopefully #269

PiperOrigin-RevId: 329797783
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants