mfridman / tparse

CLI tool for summarizing go test output. Pipe friendly. CI/CD friendly.
MIT License
998 stars 22 forks source link

Modify `--follow` behavior by minimizing noisy output #122

Closed mfridman closed 3 months ago

mfridman commented 3 months ago

Fix #121

[!TIP] If you want the existing behavior, I added a --follow-verbose flag. But please do let me know if this affected you, as I plan to remove this before cutting a v1.0.0. Thank you!

This PR modifies the behavior of tparse --follow, see linked issue for more details.

TL;DR - the modifies behavior of this flag is to suppress a lot of the noisy output, specifically:

=== RUN
=== PAUSE
=== CONT
=== PASS
=== SKIP

--- PASS:
--- SKIP:

PASS
FAIL

Before (175 lines)

=== RUN   TestSearch
--- PASS: TestSearch (0.00s)
=== RUN   TestFind
=== RUN   TestFind/foo
=== RUN   TestFind/#00
=== RUN   TestFind/foo#01
=== RUN   TestFind/bar
=== RUN   TestFind/zx
=== RUN   TestFind/aa
=== RUN   TestFind/ab
=== RUN   TestFind/ad
=== RUN   TestFind/ca
=== RUN   TestFind/ra
=== RUN   TestFind/bb
=== RUN   TestFind/mo
=== RUN   TestFind/nb
=== RUN   TestFind/qo
=== RUN   TestFind/tr
=== RUN   TestFind/vo
=== RUN   TestFind/xr
=== RUN   TestFind/aa#01
=== RUN   TestFind/ab#01
=== RUN   TestFind/ac
=== RUN   TestFind/ad#01
=== RUN   TestFind/ax
=== RUN   TestFind/ca#01
=== RUN   TestFind/cc
=== RUN   TestFind/dd
=== RUN   TestFind/xy
=== RUN   TestFind/zz
=== RUN   TestFind/da
=== RUN   TestFind/db
=== RUN   TestFind/ma
=== RUN   TestFind/mb
=== RUN   TestFind/xx
=== RUN   TestFind/ab#02
=== RUN   TestFind/zz#01
--- PASS: TestFind (0.00s)
    --- PASS: TestFind/foo (0.00s)
    --- PASS: TestFind/#00 (0.00s)
    --- PASS: TestFind/foo#01 (0.00s)
    --- PASS: TestFind/bar (0.00s)
    --- PASS: TestFind/zx (0.00s)
    --- PASS: TestFind/aa (0.00s)
    --- PASS: TestFind/ab (0.00s)
    --- PASS: TestFind/ad (0.00s)
    --- PASS: TestFind/ca (0.00s)
    --- PASS: TestFind/ra (0.00s)
    --- PASS: TestFind/bb (0.00s)
    --- PASS: TestFind/mo (0.00s)
    --- PASS: TestFind/nb (0.00s)
    --- PASS: TestFind/qo (0.00s)
    --- PASS: TestFind/tr (0.00s)
    --- PASS: TestFind/vo (0.00s)
    --- PASS: TestFind/xr (0.00s)
    --- PASS: TestFind/aa#01 (0.00s)
    --- PASS: TestFind/ab#01 (0.00s)
    --- PASS: TestFind/ac (0.00s)
    --- PASS: TestFind/ad#01 (0.00s)
    --- PASS: TestFind/ax (0.00s)
    --- PASS: TestFind/ca#01 (0.00s)
    --- PASS: TestFind/cc (0.00s)
    --- PASS: TestFind/dd (0.00s)
    --- PASS: TestFind/xy (0.00s)
    --- PASS: TestFind/zz (0.00s)
    --- PASS: TestFind/da (0.00s)
    --- PASS: TestFind/db (0.00s)
    --- PASS: TestFind/ma (0.00s)
    --- PASS: TestFind/mb (0.00s)
    --- PASS: TestFind/xx (0.00s)
    --- PASS: TestFind/ab#02 (0.00s)
    --- PASS: TestFind/zz#01 (0.00s)
=== RUN   TestSearchEfficiency
--- PASS: TestSearchEfficiency (0.00s)
=== RUN   TestSearchWrappers
--- PASS: TestSearchWrappers (0.00s)
=== RUN   TestSearchWrappersDontAlloc
    search_test.go:209: skipping; GOMAXPROCS>1
--- SKIP: TestSearchWrappersDontAlloc (0.00s)
=== RUN   TestSearchExhaustive
--- PASS: TestSearchExhaustive (0.00s)
=== RUN   TestFindExhaustive
--- PASS: TestFindExhaustive (0.00s)
=== RUN   TestSortIntSlice
--- PASS: TestSortIntSlice (0.00s)
=== RUN   TestSortFloat64Slice
--- PASS: TestSortFloat64Slice (0.00s)
=== RUN   TestSortStringSlice
--- PASS: TestSortStringSlice (0.00s)
=== RUN   TestInts
--- PASS: TestInts (0.00s)
=== RUN   TestFloat64s
--- PASS: TestFloat64s (0.00s)
=== RUN   TestStrings
--- PASS: TestStrings (0.00s)
=== RUN   TestSlice
--- PASS: TestSlice (0.00s)
=== RUN   TestSortLarge_Random
--- PASS: TestSortLarge_Random (0.06s)
=== RUN   TestReverseSortIntSlice
--- PASS: TestReverseSortIntSlice (0.00s)
=== RUN   TestBreakPatterns
--- PASS: TestBreakPatterns (0.00s)
=== RUN   TestReverseRange
--- PASS: TestReverseRange (0.00s)
=== RUN   TestNonDeterministicComparison
--- PASS: TestNonDeterministicComparison (0.00s)
=== RUN   TestSortBM
--- PASS: TestSortBM (0.04s)
=== RUN   TestHeapsortBM
--- PASS: TestHeapsortBM (0.09s)
=== RUN   TestStableBM
--- PASS: TestStableBM (0.06s)
=== RUN   TestAdversary
--- PASS: TestAdversary (0.00s)
=== RUN   TestStableInts
--- PASS: TestStableInts (0.00s)
=== RUN   TestStability
--- PASS: TestStability (0.04s)
=== RUN   TestCountStableOps
    sort_test.go:701: Stable      100 elements:         849 Swap,        748 Less
    sort_test.go:701: Stable      300 elements:        3942 Swap,       3110 Less
    sort_test.go:701: Stable     1000 elements:       19885 Swap,      12260 Less
    sort_test.go:701: Stable     3000 elements:       82386 Swap,      42984 Less
    sort_test.go:701: Stable    10000 elements:      349143 Swap,     166420 Less
    sort_test.go:701: Stable    30000 elements:     1340022 Swap,     557898 Less
    sort_test.go:701: Stable   100000 elements:     5790686 Swap,    2086425 Less
    sort_test.go:701: Stable   300000 elements:    20467955 Swap,    6872283 Less
    sort_test.go:701: Stable  1000000 elements:    84469597 Swap,   25119882 Less
--- PASS: TestCountStableOps (0.55s)
=== RUN   TestCountSortOps
    sort_test.go:701: Sort        100 elements:         185 Swap,        568 Less
    sort_test.go:701: Sort        300 elements:         624 Swap,       2250 Less
    sort_test.go:701: Sort       1000 elements:        2497 Swap,       9566 Less
    sort_test.go:701: Sort       3000 elements:        8619 Swap,      34191 Less
    sort_test.go:701: Sort      10000 elements:       32700 Swap,     131628 Less
    sort_test.go:701: Sort      30000 elements:      110751 Swap,     440481 Less
    sort_test.go:701: Sort     100000 elements:      412053 Swap,    1647751 Less
    sort_test.go:701: Sort     300000 elements:     1335371 Swap,    5663460 Less
    sort_test.go:701: Sort    1000000 elements:     4913816 Swap,   20296643 Less
--- PASS: TestCountSortOps (0.18s)
=== RUN   Example
--- PASS: Example (0.00s)
=== RUN   Example_sortKeys
--- PASS: Example_sortKeys (0.00s)
=== RUN   Example_sortMultiKeys
--- PASS: Example_sortMultiKeys (0.00s)
=== RUN   ExampleSearch
--- PASS: ExampleSearch (0.00s)
=== RUN   ExampleSearch_descendingOrder
--- PASS: ExampleSearch_descendingOrder (0.00s)
=== RUN   ExampleSearchFloat64s
--- PASS: ExampleSearchFloat64s (0.00s)
=== RUN   ExampleSearchInts
--- PASS: ExampleSearchInts (0.00s)
=== RUN   ExampleInts
--- PASS: ExampleInts (0.00s)
=== RUN   ExampleIntsAreSorted
--- PASS: ExampleIntsAreSorted (0.00s)
=== RUN   ExampleFloat64s
--- PASS: ExampleFloat64s (0.00s)
=== RUN   ExampleFloat64sAreSorted
--- PASS: ExampleFloat64sAreSorted (0.00s)
=== RUN   ExampleReverse
--- PASS: ExampleReverse (0.00s)
=== RUN   ExampleSlice
--- PASS: ExampleSlice (0.00s)
=== RUN   ExampleSliceStable
--- PASS: ExampleSliceStable (0.00s)
=== RUN   ExampleStrings
--- PASS: ExampleStrings (0.00s)
=== RUN   Example_sortWrapper
--- PASS: Example_sortWrapper (0.00s)
PASS
ok      sort    1.100s

After (26 lines)

    search_test.go:209: skipping; GOMAXPROCS>1
    sort_test.go:701: Stable      100 elements:         908 Swap,        774 Less
    sort_test.go:701: Stable      300 elements:        3898 Swap,       2985 Less
    sort_test.go:701: Stable     1000 elements:       19527 Swap,      12127 Less
    sort_test.go:701: Stable     3000 elements:       82084 Swap,      42922 Less
    sort_test.go:701: Stable    10000 elements:      349602 Swap,     166324 Less
    sort_test.go:701: Stable    30000 elements:     1339818 Swap,     558389 Less
    sort_test.go:701: Stable   100000 elements:     5784321 Swap,    2083401 Less
    sort_test.go:701: Stable   300000 elements:    20456574 Swap,    6867954 Less
    sort_test.go:701: Stable  1000000 elements:    84473272 Swap,   25115140 Less
    sort_test.go:701: Sort        100 elements:         178 Swap,        615 Less
    sort_test.go:701: Sort        300 elements:         643 Swap,       2334 Less
    sort_test.go:701: Sort       1000 elements:        2466 Swap,       9755 Less
    sort_test.go:701: Sort       3000 elements:        8537 Swap,      33571 Less
    sort_test.go:701: Sort      10000 elements:       33008 Swap,     129872 Less
    sort_test.go:701: Sort      30000 elements:      109971 Swap,     447990 Less
    sort_test.go:701: Sort     100000 elements:      411526 Swap,    1658825 Less
    sort_test.go:701: Sort     300000 elements:     1347677 Swap,    5512633 Less
    sort_test.go:701: Sort    1000000 elements:     4930310 Swap,   20075115 Less
ok      sort    1.102s
┌───────────────────────────────────────────────────────────┐
│  STATUS │ ELAPSED │ PACKAGE │ COVER │ PASS │ FAIL │ SKIP  │
│─────────┼─────────┼─────────┼───────┼──────┼──────┼───────│
│  PASS   │  1.10s  │ sort    │  --   │  76  │  0   │  1    │
└───────────────────────────────────────────────────────────┘