public void testRemoveErrorIndex() {
    SVCorePlugin.getDefault().enableDebug(false);
    List<SVDBMarker> markers;
    IProject p = TestUtils.createProject("error_index");
    addProject(p);

    String error_argfile = "missing_file1.sv\n" + "subdir/missing_file2.sv\n";

    String okay_argfile = "file1.sv\n";

    String file1_sv = "`include \"missing_file.svh\"\n" + "module m1;\n" + "endmodule\n";

    TestUtils.copy(error_argfile, p.getFile("error_argfile.f"));

    TestUtils.copy(okay_argfile, p.getFile("okay_argfile.f"));

    TestUtils.copy(file1_sv, p.getFile("file1.sv"));

    SVDBProjectData pdata = fProjMgr.getProjectData(p);
    SVDBIndexCollection p_index = pdata.getProjectIndexMgr();

    SVProjectFileWrapper w;

    w = pdata.getProjectFileWrapper();
    w.addArgFilePath("${workspace_loc}/error_index/error_argfile.f");

    pdata.setProjectFileWrapper(w);

    CoreReleaseTests.clearErrors();
    p_index.rebuildIndex(new NullProgressMonitor());
    p_index.loadIndex(new NullProgressMonitor());

    // Ensure that we see errors
    //		assertTrue(CoreReleaseTests.getErrors().size() > 0);
    markers = p_index.getMarkers("${workspace_loc}/error_index/error_argfile.f");
    assertNotNull(markers);
    assertTrue((markers.size() > 0));

    // Now, update the index settings and ensure that
    // no errors are seen
    CoreReleaseTests.clearErrors();

    w = pdata.getProjectFileWrapper();
    w.getArgFilePaths().clear();
    w.addArgFilePath("${workspace_loc}/error_index/okay_argfile.f");
    pdata.setProjectFileWrapper(w);

    //		p_index.rebuildIndex(new NullProgressMonitor());
    fIndexRgy.rebuildIndex(new NullProgressMonitor(), p.getName());
    p_index.loadIndex(new NullProgressMonitor());

    assertEquals(0, CoreReleaseTests.getErrors().size());
  }
  private void runTest(
      String testname, String zipfile_path, String proj_path, String arg_file_paths[])
      throws CoreException {
    LogHandle log = LogFactory.getLogHandle(testname);
    CoreReleaseTests.clearErrors();
    BundleUtils utils = new BundleUtils(SVCoreTestsPlugin.getDefault().getBundle());

    cleanupWorkspace();

    // Create a new project for the
    File test_dir = new File(fTmpDir, testname);
    File db_dir = new File(fTmpDir, "db");
    if (test_dir.exists()) {
      assertTrue(test_dir.delete());
    }
    assertTrue(test_dir.mkdirs());

    if (db_dir.exists()) {
      assertTrue(db_dir.delete());
    }
    assertTrue(db_dir.mkdirs());

    utils.unpackBundleZipToFS(zipfile_path, test_dir);
    File project_path = new File(test_dir, proj_path);

    fProject = TestUtils.createProject(project_path.getName(), project_path);

    // Setup appropriate project settings
    SVDBProjectManager p_mgr = SVCorePlugin.getDefault().getProjMgr();
    SVDBProjectData p_data = p_mgr.getProjectData(fProject);

    // Add an argument-file paths
    SVProjectFileWrapper p_wrapper = p_data.getProjectFileWrapper().duplicate();
    if (arg_file_paths != null) {
      for (String arg_file : arg_file_paths) {
        p_wrapper.getArgFilePaths().add(new SVDBPath(arg_file));
        p_wrapper.getArgFilePaths().add(new SVDBPath(arg_file));
      }
    }
    p_data.setProjectFileWrapper(p_wrapper);

    SVDBIndexCollection project_index = p_data.getProjectIndexMgr();
    assertNoErrors(log, project_index);

    // force index loading
    project_index.loadIndex(new NullProgressMonitor());

    IndexTestUtils.assertNoErrWarn(log, project_index);

    for (Exception e : CoreReleaseTests.getErrors()) {
      System.out.println("TEST: " + getName() + " " + e.getMessage());
    }

    assertEquals(0, CoreReleaseTests.getErrors().size());
    project_index.dispose();
    LogFactory.removeLogHandle(log);
  }
  public void testRemoveErrorIndex_2() throws CoreException {
    String testname = "testRemoveErrorIndex_2";
    LogHandle log = LogFactory.getLogHandle(testname);
    SVCorePlugin.getDefault().enableDebug(false);

    IProject p = TestUtils.createProject("error_index");

    String okay_argfile = "file1.sv\n";

    String file1_sv =
        //				"`include \"missing_file.svh\"\n" +
        "module m1;\n" + "endmodule\n";

    String file2_sv =
        //				"`include \"missing_file.svh\"\n" +
        "module m2;\n" + "endmodule\n";

    TestUtils.copy(okay_argfile, p.getFile("okay_argfile.f"));

    TestUtils.copy(file1_sv, p.getFile("file1.sv"));

    p.getFolder("subdir").create(true, true, new NullProgressMonitor());

    TestUtils.copy(file2_sv, p.getFile("subdir/file2.sv"));

    SVDBProjectData pdata = fProjMgr.getProjectData(p);
    SVDBIndexCollection p_index = pdata.getProjectIndexMgr();

    SVProjectFileWrapper w;

    w = pdata.getProjectFileWrapper();
    w.getLibraryPaths().add(new SVDBPath("c:\\foo\\bar\\missing\\dir"));

    pdata.setProjectFileWrapper(w);

    CoreReleaseTests.clearErrors();
    p_index.rebuildIndex(new NullProgressMonitor());
    p_index.loadIndex(new NullProgressMonitor());

    // Ensure that we see errors
    assertTrue(CoreReleaseTests.getErrors().size() > 0);

    // Now, update the index settings and ensure that
    // no errors are seen
    CoreReleaseTests.clearErrors();

    w = pdata.getProjectFileWrapper();
    w.getLibraryPaths().clear();
    w.getArgFilePaths().clear();
    w.addArgFilePath("${workspace_loc}/error_index/okay_argfile.f");
    pdata.setProjectFileWrapper(w);

    fIndexRgy.rebuildIndex(new NullProgressMonitor(), p.getName());
    p_index.loadIndex(new NullProgressMonitor());

    assertEquals(0, CoreReleaseTests.getErrors().size());
    for (ISVDBIndex i : fIndexRgy.getAllProjectLists()) {
      log.debug("Index: " + i.getBaseLocation());
    }

    // Expect the project index plus the built-in index
    assertEquals(2, fIndexRgy.getAllProjectLists().size());
    assertEquals(1, fIndexRgy.getProjectIndexList("error_index").size());
  }