-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
clwb/tests/integrationtests/com/google/idea/blaze/clwb/QuerySyncTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.google.idea.blaze.clwb; | ||
|
||
import static com.google.common.truth.Truth.assertThat; | ||
import static com.google.idea.blaze.clwb.base.Assertions.assertContainsHeader; | ||
|
||
import com.google.idea.blaze.clwb.base.BazelVersionRule; | ||
import com.google.idea.blaze.clwb.base.ClwbIntegrationTestCase; | ||
import com.google.idea.blaze.clwb.base.OSRule; | ||
import com.intellij.util.system.OS; | ||
import java.util.concurrent.ExecutionException; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.JUnit4; | ||
|
||
@RunWith(JUnit4.class) | ||
public class QuerySyncTest extends ClwbIntegrationTestCase { | ||
|
||
// currently query sync only works on linux, TODO: fix mac and windows | ||
@Rule | ||
public final OSRule osRule = new OSRule(OS.Linux); | ||
|
||
// query sync requires bazel 6+ | ||
@Rule | ||
public final BazelVersionRule bazelRule = new BazelVersionRule(6, 0); | ||
|
||
@Test | ||
public void testClwb() throws Exception { | ||
final var success = runQuerySync(); | ||
assertThat(success).isTrue(); | ||
|
||
checkAnalysis(); | ||
checkCompiler(); | ||
} | ||
|
||
private void checkAnalysis() throws ExecutionException { | ||
final var success = enableAnalysisFor(findProjectFile("main/hello-world.cc")); | ||
assertThat(success).isTrue(); | ||
} | ||
|
||
private void checkCompiler() { | ||
final var compilerSettings = findFileCompilerSettings("main/hello-world.cc"); | ||
|
||
// TODO: query sync selects the wrong compiler | ||
// if (SystemInfo.isMac) { | ||
// assertThat(compilerSettings.getCompilerKind()).isEqualTo(ClangCompilerKind.INSTANCE); | ||
// } else if (SystemInfo.isLinux) { | ||
// assertThat(compilerSettings.getCompilerKind()).isEqualTo(GCCCompilerKind.INSTANCE); | ||
// } else if (SystemInfo.isWindows) { | ||
// assertThat(compilerSettings.getCompilerKind()).isEqualTo(MSVCCompilerKind.INSTANCE); | ||
// } | ||
|
||
assertContainsHeader("iostream", compilerSettings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters