test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File jdk Sdiff test/java/lang/invoke/LFCaching

test/java/lang/invoke/LFCaching/LambdaFormTestCase.java

Print this page
rev 11011 : 8067344: Adjust java/lang/invoke/LFCaching/LFGarbageCollectedTest.java for recent changes in java.lang.invoke
Reviewed-by: ?


 115         iterations = Math.min(iterationsByCodeCacheSize,
 116                 Math.min(iterations, iterationsByNonProfiledCodeCacheSize));
 117         if (iterations == 0) {
 118             System.out.println("Warning: code cache size is too small to provide at"
 119                     + " least one iteration! Test will try to do one iteration.");
 120             iterations = 1;
 121         }
 122         System.out.printf("Number of iterations is set to %d (%d cases)%n",
 123                 iterations, iterations * testCaseNum);
 124         System.out.flush();
 125         long startTime = System.currentTimeMillis();
 126         for (long i = 0; i < iterations; i++) {
 127             System.err.println(String.format("Iteration %d:", i));
 128             for (TestMethods testMethod : testMethods) {
 129                 LambdaFormTestCase testCase = ctor.apply(testMethod);
 130                 try {
 131                     System.err.printf("Tested LF caching feature with MethodHandles.%s method.%n",
 132                             testCase.getTestMethod().name);
 133                     testCase.doTest();
 134                     System.err.println("PASSED");




 135                 } catch (Throwable t) {
 136                     t.printStackTrace();
 137                     System.err.println("FAILED");
 138                     passed = false;
 139                     failCounter++;
 140                 }
 141                 testCounter++;
 142             }
 143             long passedTime = System.currentTimeMillis() - startTime;
 144             long avgIterTime = passedTime / (i + 1);
 145             long remainTime = TIMEOUT - passedTime;
 146             if (avgIterTime > 2 * remainTime) {
 147                 System.err.printf("Stopping iterations because of lack of time.%n"
 148                         + "Increase timeout factor for more iterations.%n");
 149                 break;
 150             }
 151         }
 152         if (!passed) {
 153             throw new Error(String.format("%d of %d test cases FAILED! %n"
 154                     + "Rerun the test with the same \"-Dseed=\" option as in the log file!",


 115         iterations = Math.min(iterationsByCodeCacheSize,
 116                 Math.min(iterations, iterationsByNonProfiledCodeCacheSize));
 117         if (iterations == 0) {
 118             System.out.println("Warning: code cache size is too small to provide at"
 119                     + " least one iteration! Test will try to do one iteration.");
 120             iterations = 1;
 121         }
 122         System.out.printf("Number of iterations is set to %d (%d cases)%n",
 123                 iterations, iterations * testCaseNum);
 124         System.out.flush();
 125         long startTime = System.currentTimeMillis();
 126         for (long i = 0; i < iterations; i++) {
 127             System.err.println(String.format("Iteration %d:", i));
 128             for (TestMethods testMethod : testMethods) {
 129                 LambdaFormTestCase testCase = ctor.apply(testMethod);
 130                 try {
 131                     System.err.printf("Tested LF caching feature with MethodHandles.%s method.%n",
 132                             testCase.getTestMethod().name);
 133                     testCase.doTest();
 134                     System.err.println("PASSED");
 135                 } catch (OutOfMemoryError e) {
 136                     // Don't swallow OOME so a heap dump can be created.
 137                     System.err.println("FAILED");
 138                     throw e;
 139                 } catch (Throwable t) {
 140                     t.printStackTrace();
 141                     System.err.println("FAILED");
 142                     passed = false;
 143                     failCounter++;
 144                 }
 145                 testCounter++;
 146             }
 147             long passedTime = System.currentTimeMillis() - startTime;
 148             long avgIterTime = passedTime / (i + 1);
 149             long remainTime = TIMEOUT - passedTime;
 150             if (avgIterTime > 2 * remainTime) {
 151                 System.err.printf("Stopping iterations because of lack of time.%n"
 152                         + "Increase timeout factor for more iterations.%n");
 153                 break;
 154             }
 155         }
 156         if (!passed) {
 157             throw new Error(String.format("%d of %d test cases FAILED! %n"
 158                     + "Rerun the test with the same \"-Dseed=\" option as in the log file!",
test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File