Skip to content
Snippets Groups Projects
  • Bryan C. Mills's avatar
    55b8e16b
    testing: use monotonic counts to attribute races in subtests · 55b8e16b
    Bryan C. Mills authored
    This implements the approach I described in
    https://go-review.git.corp.google.com/c/go/+/494057/1#message-5c9773bded2f89b4058848cb036b860aa6716de3.
    
    Specifically:
    
    - Each level of test atomically records the cumulative number of races
      seen as of the last race-induced test failure.
    
    - When a subtest fails, it logs the race error, and then updates its
      parents' counters so that they will not log the same error.
    
    - We check each test or benchmark for races before it starts running
      each of its subtests or sub-benchmark, before unblocking parallel
      subtests, and after running any cleanup functions.
    
    With this implementation, it should be the case that every test that
    is running when a race is detected reports that race, and any race
    reported for a subtest is not redundantly reported for its parent.
    
    The regression tests are based on those added in CL 494057 and
    CL 501895, with a few additions based on my own review of the code.
    
    Fixes #60083.
    
    Change-Id: I578ae929f192a7a951b31b17ecb560cbbf1ef7a1
    Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-linux-amd64-longtest-race,gotip-windows-amd64-longtest
    Reviewed-on: https://go-review.googlesource.com/c/go/+/506300
    
    
    Reviewed-by: default avatarIan Lance Taylor <iant@google.com>
    Auto-Submit: Bryan Mills <bcmills@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    55b8e16b
    History
    testing: use monotonic counts to attribute races in subtests
    Bryan C. Mills authored
    This implements the approach I described in
    https://go-review.git.corp.google.com/c/go/+/494057/1#message-5c9773bded2f89b4058848cb036b860aa6716de3.
    
    Specifically:
    
    - Each level of test atomically records the cumulative number of races
      seen as of the last race-induced test failure.
    
    - When a subtest fails, it logs the race error, and then updates its
      parents' counters so that they will not log the same error.
    
    - We check each test or benchmark for races before it starts running
      each of its subtests or sub-benchmark, before unblocking parallel
      subtests, and after running any cleanup functions.
    
    With this implementation, it should be the case that every test that
    is running when a race is detected reports that race, and any race
    reported for a subtest is not redundantly reported for its parent.
    
    The regression tests are based on those added in CL 494057 and
    CL 501895, with a few additions based on my own review of the code.
    
    Fixes #60083.
    
    Change-Id: I578ae929f192a7a951b31b17ecb560cbbf1ef7a1
    Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-linux-amd64-longtest-race,gotip-windows-amd64-longtest
    Reviewed-on: https://go-review.googlesource.com/c/go/+/506300
    
    
    Reviewed-by: default avatarIan Lance Taylor <iant@google.com>
    Auto-Submit: Bryan Mills <bcmills@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.