Skip to content

Commit

Permalink
Show duplicates more easily in failing skyframe tests.
Browse files Browse the repository at this point in the history
Work towards platform-based flags: bazelbuild#19409.

PiperOrigin-RevId: 621476576
Change-Id: Ic4b88c051b79d13f0ac7fc12be605836fe22411d
  • Loading branch information
katre authored and Kila2 committed May 13, 2024
1 parent c117ae5 commit 2985649
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,17 @@ static ImmutableCollection<SkyKey> consolidateAndGetReverseDeps(
return ImmutableList.copyOf(reverseDeps);
}
ImmutableSet<SkyKey> set = ImmutableSet.copyOf(reverseDeps);
Preconditions.checkState(
set.size() == reverseDeps.size(),
"Duplicate reverse deps present in %s: %s",
reverseDeps,
entry);
if (set.size() != reverseDeps.size()) {
Set<SkyKey> seen = new HashSet<>();
Set<SkyKey> duplicates = new HashSet<>();
for (SkyKey key : reverseDeps) {
if (seen.add(key)) {
duplicates.add(key);
}
}
throw new IllegalStateException(
String.format("In node %s: duplicate reverse deps present: %s", entry, duplicates));
}
return set;
}
}
Expand Down

0 comments on commit 2985649

Please sign in to comment.