From e634db03482c8620f2ce39484501bb23e0a74471 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Thu, 5 Aug 2021 15:16:17 +0700 Subject: [PATCH] Stabilise flaky test in Ajc1612Tests By increasing from 10,000 to 1,000,000 rounds, the times compared for performance become considerably longer (but still in the tens or hundreds or milliseconds), decreasing the probability of the test failing due to CPU load or some other random effect. Closes #83. Signed-off-by: Alexander Kriegisch --- tests/bugs1612/pr356612/AnnoBinding.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/bugs1612/pr356612/AnnoBinding.java b/tests/bugs1612/pr356612/AnnoBinding.java index 7bee9c52f..fd47c6785 100644 --- a/tests/bugs1612/pr356612/AnnoBinding.java +++ b/tests/bugs1612/pr356612/AnnoBinding.java @@ -11,13 +11,15 @@ import org.aspectj.lang.reflect.FieldSignature; public class AnnoBinding { public static void main(String[] argv) { long stime = System.currentTimeMillis(); - for (int i = 0; i < 10000; i++) { + // 10,000 or 100,000 rounds are too quick, making the test flaky + final int ROUNDS = 1000 * 1000; + for (int i = 0; i < ROUNDS; i++) { runOne(); } long etime = System.currentTimeMillis(); long manual = (etime - stime); stime = System.currentTimeMillis(); - for (int i = 0; i < 10000; i++) { + for (int i = 0; i < ROUNDS; i++) { runTwo(); } etime = System.currentTimeMillis(); -- 2.39.5