mirror of
https://github.com/rtk-ai/rtk.git
synced 2026-09-19 07:33:17 +08:00
97dbf98cc6
Under `mvn -q`, Maven 3.x suppresses all `[INFO]` lines: no `BUILD SUCCESS` footer, no `[INFO] Running` markers, no module banners. The existing surefire/compile/package filters all key off the English-footer guard and `[INFO] Running`/CLOSE state machine, so under `-q` they fell through and shipped the raw output unchanged (0% savings on PR #1956 reviewer's measurement). Reviewer (@pszymkowiak on PR #1956) listed `-q` handling in the path-to-merge as "worth a note or handling". This commit implements the handling. Behavior captured from `mvn -q test` on Maven 3.9.9 + Surefire 3.5.5 with JUnit 5: - Green run emits ZERO bytes — filter returns empty output. - Failure run emits ~27 lines: per-class CLOSE line, exception + stack trace, `[ERROR] Failures:` summary, aggregate `[ERROR] Tests run: N, Failures: F, ...`, and the `[ERROR] Failed to execute goal` terminator, followed by a ~10-line `[ERROR] See .../[Help 1].../Re-run Maven .../To see the full stack trace .../For more information ...` boilerplate block pointing at log files and help URLs. `filter_quiet` keeps the failure-signal lines and the user-code stack frames; drops the framework frames (existing deny-list) and the post-failure boilerplate block. Routing: `is_quiet` checks argv for `-q` or `--quiet`. When set, `run()` short-circuits the phase-based filter selection and routes non-passthrough phases to `filter_quiet`. Passthrough phases (`clean`, `site`, plugin goals) remain passthrough under `-q`. Measured savings on the captured fail fixture: 51.1% (174 -> 85 tokens). Green run: 0 -> 0 (no overhead). Safety net: unclassified `[ERROR]` lines are kept rather than dropped — better to leak a line than hide signal. Tests added (7): - `quiet_detects_short_flag` / `quiet_detects_long_flag` / `quiet_does_not_match_unrelated_flags` for `is_quiet`. - `quiet_green_run_is_empty` — empty input contract. - `quiet_fail_strips_framework_and_boilerplate` — kept-list and drop-list assertions on the real fixture. - `savings_mvn_quiet_fail` — >=50% savings target on the fixture. - `quiet_unknown_error_line_kept_as_safety_net` — unclassified `[ERROR]` not silently dropped. New fixture: `tests/fixtures/mvn_quiet_fail_raw.txt` (27 lines, 770 bytes) captured from a real `mvn -q test` run against a JUnit 5 / Surefire 3.5.5 project with one failing test.
28 lines
1.8 KiB
Plaintext
28 lines
1.8 KiB
Plaintext
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.069 s <<< FAILURE! -- in x.FailTest
|
|
[ERROR] x.FailTest.this_will_fail -- Time elapsed: 0.030 s <<< FAILURE!
|
|
org.opentest4j.AssertionFailedError: deliberate failure for rtk -q filter testing ==> expected: <1> but was: <2>
|
|
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
|
|
at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
|
|
at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
|
|
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150)
|
|
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:563)
|
|
at x.FailTest.this_will_fail(FailTest.java:9)
|
|
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
|
|
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
|
|
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
|
|
|
|
[ERROR] Failures:
|
|
[ERROR] FailTest.this_will_fail:9 deliberate failure for rtk -q filter testing ==> expected: <1> but was: <2>
|
|
[ERROR] Tests run: 6, Failures: 1, Errors: 0, Skipped: 0
|
|
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.5:test (default-test) on project mvnq: There are test failures.
|
|
[ERROR]
|
|
[ERROR] See /tmp/mvnq/target/surefire-reports for the individual test results.
|
|
[ERROR] See dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
|
|
[ERROR] -> [Help 1]
|
|
[ERROR]
|
|
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
|
|
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
|
|
[ERROR]
|
|
[ERROR] For more information about the errors and possible solutions, please read the following articles:
|
|
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
|