< prev index next >

test/serviceability/dcmd/compiler/CodelistTest.java

Print this page
rev 13185 : 8183151: DCmd Compiler.codelist should print all compiled methods
Summary: Add support for AOT methods in codelist dcmd
Reviewed-by: neliasso
Contributed-by: twisti


  95             for (int level : complevels) {
  96                 // Only test comp level 1 and 4 - level 1, 2 and 3 may interfere with each other
  97                 if (level == 1 || level == 4) {
  98                     TestCase testcase = testcases[level - 1];
  99                     WB.enqueueMethodForCompilation(testcase.method, testcase.level);
 100                     // Set results to false for those methods we must to find
 101                     // We will also assert if we find any test method we don't expect
 102                     testcase.check = false;
 103                 }
 104             }
 105         } finally {
 106             WB.removeCompilerDirective(1);
 107         }
 108 
 109         // Get output from dcmd (diagnostic command)
 110         OutputAnalyzer output = executor.execute("Compiler.codelist");
 111         Iterator<String> lines = output.asLines().iterator();
 112 
 113         // Loop over output set result for all found methods
 114         while (lines.hasNext()) {
 115             String line = lines.next();
 116 
 117             // Fast check for common part of method name
 118             if (line.contains("CodelistTest.testcaseMethod")) {
 119                 String[] parts = line.split(" ");
 120                 int compileID = Integer.parseInt(parts[0]);


 121                 int compileLevel = Integer.parseInt(parts[1]);
 122                 String str = parts[2];





 123 

 124                 for (TestCase testcase : testcases) {
 125                     if (str.contains(testcase.methodName)) {
 126                         Assert.assertFalse(testcase.check, "Must not be found or already found.");
 127                         Assert.assertTrue(testcase.level == compileLevel, "Must have correct level");
 128                         testcase.check = true;
 129                     }
 130                 }
 131             }
 132         }
 133 
 134         // Check all testcases that was run
 135         for (TestCase testcase : testcases) {
 136             Assert.assertTrue(testcase.check, "Missing testcase " + testcase.methodName);
 137         }
 138     }
 139 
 140     @Test
 141     public void jmx() {
 142         run(new JMXExecutor());
 143     }




  95             for (int level : complevels) {
  96                 // Only test comp level 1 and 4 - level 1, 2 and 3 may interfere with each other
  97                 if (level == 1 || level == 4) {
  98                     TestCase testcase = testcases[level - 1];
  99                     WB.enqueueMethodForCompilation(testcase.method, testcase.level);
 100                     // Set results to false for those methods we must to find
 101                     // We will also assert if we find any test method we don't expect
 102                     testcase.check = false;
 103                 }
 104             }
 105         } finally {
 106             WB.removeCompilerDirective(1);
 107         }
 108 
 109         // Get output from dcmd (diagnostic command)
 110         OutputAnalyzer output = executor.execute("Compiler.codelist");
 111         Iterator<String> lines = output.asLines().iterator();
 112 
 113         // Loop over output set result for all found methods
 114         while (lines.hasNext()) {
 115 String line = lines.next();
 116 
 117             // Fast check for common part of method name
 118             if (line.contains("CodelistTest.testcaseMethod")) {
 119                 String[] parts = line.split(" ");
 120                 int compileID = Integer.parseInt(parts[0]);
 121                 Assert.assertTrue(compileID > 0, "CompileID must be positive");
 122                 
 123                 int compileLevel = Integer.parseInt(parts[1]);
 124                 Assert.assertTrue(compileLevel >= -1, "CompileLevel must be at least -1 (AOT)");
 125                 Assert.assertTrue(compileLevel <= 4,  "CompileLevel must be at most 4 (C2)");
 126                 
 127                 int codeState = Integer.parseInt(parts[2]);
 128                 Assert.assertTrue(codeState >= 0, "CodeState must be at least 0 (In Use)");
 129                 Assert.assertTrue(codeState <= 4, "CodeState must be at most 4 (Unloaded)");
 130                 
 131                 String str = parts[3];
 132                 for (TestCase testcase : testcases) {
 133                     if (str.contains(testcase.methodName)) {
 134                         Assert.assertFalse(testcase.check, "Must not be found or already found.");
 135                         Assert.assertTrue(testcase.level == compileLevel, "Must have correct level");
 136                         testcase.check = true;
 137                     }
 138                 }
 139             }
 140         }
 141 
 142         // Check all testcases that was run
 143         for (TestCase testcase : testcases) {
 144             Assert.assertTrue(testcase.check, "Missing testcase " + testcase.methodName);
 145         }
 146     }
 147 
 148     @Test
 149     public void jmx() {
 150         run(new JMXExecutor());
 151     }


< prev index next >