Example #1
0
  @Override
  protected void tearDown() throws Exception {
    super.tearDown();

    for (ITextEditor t : fEditors) {
      t.close(false);
    }

    // Wait for the editors to close
    while (Display.getDefault().readAndDispatch()) {}

    SVDBIndexRegistry rgy = SVCorePlugin.getDefault().getSVDBIndexRegistry();
    rgy.save_state();

    SVCorePlugin.getJobMgr().dispose();

    for (IProject p : fProjects) {
      TestUtils.deleteProject(p);
    }

    if (fTmpDir != null && fTmpDir.exists()) {
      TestUtils.delete(fTmpDir);
    }

    cleanupWorkspace();
  }
  private void int_testMissingIncludeAdded(String testname, File tmpdir) throws RuntimeException {
    BundleUtils utils = new BundleUtils(SVCoreTestsPlugin.getDefault().getBundle());
    LogHandle log = LogFactory.getLogHandle(testname);

    IProject project = TestUtils.createProject("project");
    addProject(project);

    utils.copyBundleDirToWS("/data/basic_lib_missing_inc/", project);

    SVDBIndexRegistry rgy = fIndexRgy;

    ISVDBIndex index =
        rgy.findCreateIndex(
            new NullProgressMonitor(),
            "GENERIC",
            "${workspace_loc}/project/basic_lib_missing_inc/basic_lib_pkg.sv",
            SVDBLibPathIndexFactory.TYPE,
            null);
    index.execIndexChangePlan(new NullProgressMonitor(), new SVDBIndexChangePlanRebuild(index));

    IndexTestUtils.assertFileHasElements(fLog, index, "class1");
    IndexTestUtils.assertDoesNotContain(index, "class1_2");

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(out);

    ps.println("\n\n");
    ps.println("class class1_2;\n");
    ps.println("\n\n");
    ps.println("endclass\n\n");
    ps.flush();

    // Now, write back the file
    TestUtils.copy(out, project.getFile(new Path("basic_lib_missing_inc/class1_2.svh")));

    log.debug(">> SLEEP");
    // Wait a bit...
    try {
      Thread.sleep(2000);
    } catch (InterruptedException e) {
    }
    log.debug("<< SLEEP");

    index.loadIndex(new NullProgressMonitor());

    IndexTestUtils.assertFileHasElements(fLog, index, "class1", "class1_2");

    LogFactory.removeLogHandle(log);
  }
Example #3
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    fLog = LogFactory.getLogHandle(getName());

    cleanupWorkspace();

    fProjects = new ArrayList<IProject>();
    fEditors = new ArrayList<ITextEditor>();

    fTmpDir = TestUtils.createTempDir();
    File db = new File(fTmpDir, "db");

    assertTrue(db.mkdirs());

    SVDBIndexRegistry rgy = SVCorePlugin.getDefault().getSVDBIndexRegistry();
    rgy.init(new TestIndexCacheFactory(db));
  }