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);
  }
  public void testCovergroupTypeOptionMergeInstances() {
    String doc =
        "class my_class1;\n"
            + // 1
            "\n"
            + "    covergroup foo;\n"
            + "        type_option.mer<<MARK>>\n"
            + "    endgroup\n"
            + "endclass\n";

    SVCorePlugin.getDefault().enableDebug(false);
    Tuple<SVDBFile, TextTagPosUtils> ini = contentAssistSetup(doc);

    StringBIDITextScanner scanner = new StringBIDITextScanner(ini.second().getStrippedData());
    TestCompletionProcessor cp = new TestCompletionProcessor(ini.first(), fIndexMgr);

    scanner.seek(ini.second().getPosMap().get("MARK"));

    ISVDBIndexIterator index_it = cp.getIndexIterator();
    SVDBIndexValidator v = new SVDBIndexValidator();

    v.validateIndex(index_it, SVDBIndexValidator.ExpectErrors);

    IndexTestUtils.assertFileHasElements(index_it, "my_class1" /*, "my_class1::foo"*/);

    cp.computeProposals(scanner, ini.first(), ini.second().getLineMap().get("MARK"));
    List<SVCompletionProposal> proposals = cp.getCompletionProposals();

    assertEquals(1, proposals.size());

    // TODO: at some point, my_class1 and my_class2 will not be proposals,
    // since they are types not variables
    validateResults(new String[] {"merge_instances"}, proposals);
  }
Exemplo n.º 3
0
  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);
  }
Exemplo n.º 4
0
  private void runTest(String name, String path) {
    BundleUtils utils = new BundleUtils(SVCoreTestsPlugin.getDefault().getBundle());

    File pdir = new File(fTmpDir, path);
    assertTrue(pdir.mkdirs());

    utils.unpackBundleZipToFS("uvmprimer-master.zip", pdir);

    utils.unpackBundleZipToFS("uvm.zip", pdir);

    File filelist = new File(pdir, "filelist.f");

    SVFileUtils.copy(
        "+define+QUESTA\n"
            + "+incdir+./uvm/src\n"
            + "./uvm/src/uvm_pkg.sv\n"
            + "+incdir+./uvmprimer-master/"
            + path
            + "\n"
            + "-F uvmprimer-master/"
            + path
            + "/rtl.f\n"
            + "-F uvmprimer-master/"
            + path
            + "/tb.f\n",
        filelist);

    ISVDBIndex index =
        fIndexRgy.findCreateIndex(
            new NullProgressMonitor(),
            "GENERIC",
            filelist.toString(),
            SVDBArgFileIndexFactory.TYPE,
            null);
    index.loadIndex(new NullProgressMonitor());

    IndexTestUtils.assertNoErrWarn(fLog, index);
  }