Skip to content

Commit

Permalink
Fix "compare" function in "RunDownBean.getTopLeaks". (#411)
Browse files Browse the repository at this point in the history
Rationale
The Skyline Nightly Test Results page displays an error if there are a lot of leaks reported because the "Compare" method implementation in "getTopLeaks" does not return consistent results. This was because it was mistakenly comparing the wrong set of numbers (comparing number of bytes leaked in one test to handle leaks in the other test) such that Compare(a, b) was not necessarily the opposite of Compare(b, a).
  • Loading branch information
nickshulman authored and labkey-jeckels committed Oct 23, 2024
1 parent 10cae44 commit e45ba90
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions testresults/src/org/labkey/testresults/view/RunDownBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ public Map<String, List<TestLeakDetail>> getTopLeaks(int n, boolean isStatRun) {
}

double mem1 = getLeakMemoryAverage(l1);
double mem2 = getLeakHandleAverage(l2);
if (mem1 != mem2)
double mem2 = getLeakMemoryAverage(l2);
if (Double.compare(mem2, mem1) != 0)
{
return (int)(mem2 - mem1);
return Double.compare(mem2, mem1);
}

double handle1 = getLeakHandleAverage(l1);
double handle2 = getLeakHandleAverage(l2);
return (int)(handle2 - handle1);
return Double.compare(handle2, handle1);
});
Map<String, List<TestLeakDetail>> newMap = new LinkedHashMap<>();
if (n == 0)
Expand Down

0 comments on commit e45ba90

Please sign in to comment.