Skip some frontend tests when xcode version doesn't match

master
Andrzej Kotulski 9 years ago
parent 79df8d2b3c
commit b810ae68b4

@ -14,7 +14,7 @@ import static utils.matchers.DotFilesEqual.dotFileEqualTo;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.junit.Ignore; import org.junit.Assume;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@ -72,10 +72,11 @@ public class BlockTest {
newDotFile, dotFileEqualTo(block_dotty)); newDotFile, dotFileEqualTo(block_dotty));
} }
@Test @Ignore @Test
public void whenCaptureRunOnBlockReleaseThenDotFilesAreTheSame() public void whenCaptureRunOnBlockReleaseThenDotFilesAreTheSame()
throws InterruptedException, IOException, InferException { throws InterruptedException, IOException, InferException {
Assume.assumeTrue(InferRunner.runsSupportedXCode());
String block_src = String block_src =
"infer/tests/codetoanalyze/objc/frontend/block/block_release.m"; "infer/tests/codetoanalyze/objc/frontend/block/block_release.m";

@ -14,7 +14,7 @@ import static utils.matchers.DotFilesEqual.dotFileEqualTo;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.junit.Ignore; import org.junit.Assume;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@ -32,10 +32,11 @@ public class NSAssertTest {
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
@Test @Ignore @Test
public void whenCaptureRunOnPropertyThenDotFilesAreTheSame() public void whenCaptureRunOnPropertyThenDotFilesAreTheSame()
throws InterruptedException, IOException, InferException { throws InterruptedException, IOException, InferException {
Assume.assumeTrue(InferRunner.runsSupportedXCode());
String src = "infer/tests/codetoanalyze/objc/frontend/assertions/NSAssert_example.m"; String src = "infer/tests/codetoanalyze/objc/frontend/assertions/NSAssert_example.m";
String dotty = "infer/tests/codetoanalyze/objc/frontend/assertions/NSAssert_example.dot"; String dotty = "infer/tests/codetoanalyze/objc/frontend/assertions/NSAssert_example.dot";

@ -55,6 +55,8 @@ public class InferRunner {
private static final String IPHONESIMULATOR_ISYSROOT_SUFFIX = private static final String IPHONESIMULATOR_ISYSROOT_SUFFIX =
"/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"; "/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
private static final String CURRENT_XCODE_VERSION = "Xcode 7.0";
private static HashMap<String, InferResults> inferResultsMap = private static HashMap<String, InferResults> inferResultsMap =
new HashMap<String, InferResults>(); new HashMap<String, InferResults>();
@ -72,6 +74,21 @@ public class InferRunner {
return line; return line;
} }
private static String getXCodeVersion() throws IOException, InterruptedException {
ProcessBuilder pb = new ProcessBuilder("xcodebuild", "-version");
Process process = pb.start();
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line = br.readLine();
process.waitFor();
return line;
}
public static boolean runsSupportedXCode() throws IOException, InterruptedException {
return InferRunner.getXCodeVersion().equals(CURRENT_XCODE_VERSION);
}
private static ImmutableList<String> createInferJavaCommand( private static ImmutableList<String> createInferJavaCommand(
TemporaryFolder folder, TemporaryFolder folder,
ImmutableList<String> sourceFiles, ImmutableList<String> sourceFiles,

Loading…
Cancel
Save