diff options
author | 2017-12-21 10:30:44 -0800 | |
---|---|---|
committer | 2017-12-21 10:34:29 -0800 | |
commit | b30b9335ab185837e03527b4bf9c3c40b41db767 (patch) | |
tree | 664686c7c66b191dfeec2b87de8679e9cdec775a | |
parent | da4200141a5fa04a9e83e39fa1f01c444f228dfc (diff) |
Improve testing for miss details on action cache stats.
The previous tests (internal-only, sorry) were checking for the total
number of misses before testing for the actual breakdown by reason.
This was confusing because the total number was quite mysterious and
because a test failure would point at the total instead of the
breakdown, making the test problems harder to understand.
To resolve this: check for the miss reasons first, which will give a
better indication of what's wrong with the test, and then check for the
total using a number that is derived from the breakdown, which avoids a
magical number in the test.
RELNOTES: None.
PiperOrigin-RevId: 179830122
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java b/src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java index f344242075..eab667a7ff 100644 --- a/src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java +++ b/src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java @@ -652,6 +652,15 @@ public final class ActionsTestUtil { } return result; } + + /** Counts the total number of misses registered so far regardless of their reason. */ + public int countMisses() { + int total = 0; + for (Map.Entry<MissReason, Integer> entry : details.entrySet()) { + total += entry.getValue(); + } + return total; + } } /** |