public void run(CommandExecutor executor) {

    TestCase[] testcases = {
      new TestCase(1, "testcaseMethod1"),
      new TestCase(2, "testcaseMethod2"),
      new TestCase(3, "testcaseMethod3"),
      new TestCase(4, "testcaseMethod4"),
    };

    // Lock compilation makes all compiles stay in queue or compile thread before completion
    WB.lockCompilation();

    // Enqueue one test method for each available level
    int[] complevels = CompilerUtils.getAvailableCompilationLevels();
    for (int level : complevels) {
      TestCase testcase = testcases[level - 1];

      boolean added = WB.enqueueMethodForCompilation(testcase.method, testcase.level);
      // Set results to false for those methods we must to find
      // We will also assert if we find any test method we don't expect
      Assert.assertEquals(added, WB.isMethodQueuedForCompilation(testcase.method));
      testcase.check = false;
    }

    // Get output from dcmd (diagnostic command)
    OutputAnalyzer output = executor.execute("Compiler.queue");
    Iterator<String> lines = output.asLines().iterator();

    // Loop over output set result for all found methods
    while (lines.hasNext()) {
      String str = lines.next();
      // Fast check for common part of method name
      if (str.contains("testcaseMethod")) {
        for (TestCase testcase : testcases) {
          if (str.contains(testcase.methodName)) {
            Assert.assertFalse(testcase.check, "Must not be found or already found.");
            testcase.check = true;
          }
        }
      }
    }

    for (TestCase testcase : testcases) {
      if (!testcase.check) {
        // If this method wasn't found it must have been removed by policy,
        // verify that it is now removed from the queue
        Assert.assertFalse(
            WB.isMethodQueuedForCompilation(testcase.method), "Must be found or not in queue");
      }
      // Otherwise all good.
    }

    // Enable compilations again
    WB.unlockCompilation();
  }
  public void testCompatibility(CommandExecutor executor, int comp_level) throws Exception {

    // Call all validation twice to catch error when overwriting a directive
    // Flag is default on
    expect(WB.shouldPrintAssembly(method, comp_level));
    expect(WB.shouldPrintAssembly(nomatch, comp_level));
    expect(WB.shouldPrintAssembly(method, comp_level));
    expect(WB.shouldPrintAssembly(nomatch, comp_level));

    // load directives that turn it off
    executor.execute("Compiler.directives_add " + control_off);
    expect(!WB.shouldPrintAssembly(method, comp_level));
    expect(WB.shouldPrintAssembly(nomatch, comp_level));
    expect(!WB.shouldPrintAssembly(method, comp_level));
    expect(WB.shouldPrintAssembly(nomatch, comp_level));

    // remove and see that it is true again
    executor.execute("Compiler.directives_remove");
    expect(WB.shouldPrintAssembly(method, comp_level));
    expect(WB.shouldPrintAssembly(nomatch, comp_level));
    expect(WB.shouldPrintAssembly(method, comp_level));
    expect(WB.shouldPrintAssembly(nomatch, comp_level));
  }
  public void run(CommandExecutor executor) throws ClassNotFoundException {

    // create a classloader and load our special class
    dummyloader = new DummyClassLoader();
    Class<?> c = Class.forName("TestClass", true, dummyloader);
    if (c.getClassLoader() != dummyloader) {
      Assert.fail("TestClass defined by wrong classloader: " + c.getClassLoader());
    }

    OutputAnalyzer output = executor.execute("VM.classloader_stats");
    Iterator<String> lines = output.asLines().iterator();
    while (lines.hasNext()) {
      String line = lines.next();
      Matcher m = clLine.matcher(line);
      if (m.matches()) {
        // verify that DummyClassLoader has loaded 1 class and 1 anonymous class
        if (m.group(4).equals("ClassLoaderStatsTest$DummyClassLoader")) {
          System.out.println("line: " + line);
          if (!m.group(1).equals("1")) {
            Assert.fail("Should have loaded 1 class: " + line);
          }
          checkPositiveInt(m.group(2));
          checkPositiveInt(m.group(3));

          String next = lines.next();
          System.out.println("next: " + next);
          Matcher m1 = anonLine.matcher(next);
          m1.matches();
          if (!m1.group(1).equals("1")) {
            Assert.fail("Should have loaded 1 anonymous class, but found : " + m1.group(1));
          }
          checkPositiveInt(m1.group(2));
          checkPositiveInt(m1.group(3));
        }
      }
    }
  }