Skip to content

Commit

Permalink
Test for good cache usage
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Sep 23, 2024
1 parent 0aa813c commit fbdfdff
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ public Map<PathFragment, Artifact> getMapping() {
return result;
}

if (!mappingRequestedBefore.compareAndSet(false, true)) {
throw new IllegalStateException(
"Runfiles mapping recomputed more than once despite caching enabled: " + execPath);
}
result =
runfiles.getRunfilesInputs(
/* eventHandler= */ null, /* location= */ null, repoMappingManifest);
Expand Down Expand Up @@ -252,7 +256,7 @@ public String getWorkspaceName() {
// for reusing the runfiles within a single build, so don't pay the overhead of a weak reference.
private static boolean cacheRunfilesMappings(RuleContext ruleContext) {
if (!TargetUtils.isTestRule(ruleContext.getTarget())) {
return false;
return true;
}

if (TestActionBuilder.getRunsPerTest(ruleContext) > 1) {
Expand Down

0 comments on commit fbdfdff

Please sign in to comment.