Skip to content

Commit

Permalink
Make sure indexer has finished the files in question
Browse files Browse the repository at this point in the history
I saw in one test run this raw output for testCommonSDK:

50% 1/2 sources, 0 headers: parsing source.cpp (/baz1666753431025)

which I think means that the indexing was not done for source.cpp
so apply this pattern to testCommonSDK and IndexSearchTest
both have intermittent failures on GitHub actions but pass
fine locally.

Part of #117
  • Loading branch information
jonahgraham committed Oct 26, 2022
1 parent fb788b5 commit ed726f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;

import junit.framework.TestSuite;

Expand All @@ -62,6 +63,11 @@ public void setUp() throws Exception {
fProject = createProject(true, "resources/indexTests/search");
}
fIndex = CCorePlugin.getIndexManager().getIndex(fProject);
waitUntilFileIsIndexed(fIndex, fProject.getProject().getFile(new Path("/enumerator.cpp")));
waitUntilFileIsIndexed(fIndex, fProject.getProject().getFile(new Path("/macro.c")));
waitUntilFileIsIndexed(fIndex, fProject.getProject().getFile(new Path("/nested.cpp")));
waitUntilFileIsIndexed(fIndex, fProject.getProject().getFile(new Path("/staticFunc1.cpp")));
waitUntilFileIsIndexed(fIndex, fProject.getProject().getFile(new Path("/staticFunc2.cpp")));
fIndex.acquireReadLock();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public boolean providesFor(ICProject project) throws CoreException {

{
IIndex index = CCorePlugin.getIndexManager().getIndex(cproject2, A_FRAGMENT_OPTIONS);
waitUntilFileIsIndexed(index, cproject2.getProject().getFile(new Path("/source.cpp")));
index.acquireReadLock();
try {
IBinding[] bindings = index.findBindings("A".toCharArray(), IndexFilter.ALL, npm());
Expand All @@ -209,6 +210,7 @@ public boolean acceptBinding(IBinding binding) {

{
IIndex index = CCorePlugin.getIndexManager().getIndex(cproject3, A_FRAGMENT_OPTIONS);
waitUntilFileIsIndexed(index, cproject3.getProject().getFile(new Path("/source.cpp")));
index.acquireReadLock();
try {
IBinding[] bindings = index.findBindings("A".toCharArray(), IndexFilter.ALL, npm());
Expand All @@ -229,6 +231,8 @@ public boolean acceptBinding(IBinding binding) {
{
IIndex index = CCorePlugin.getIndexManager().getIndex(new ICProject[] { cproject2, cproject3 },
A_FRAGMENT_OPTIONS);
waitUntilFileIsIndexed(index, cproject2.getProject().getFile(new Path("/source.cpp")));
waitUntilFileIsIndexed(index, cproject3.getProject().getFile(new Path("/source.cpp")));
index.acquireReadLock();
try {
IBinding[] bindings = index.findBindings("A".toCharArray(), IndexFilter.ALL, npm());
Expand Down

0 comments on commit ed726f1

Please sign in to comment.