diff --git a/infer/tests/frontend/objc/BlockTest.java b/infer/tests/frontend/objc/BlockTest.java index ebcd04510..cb1695d20 100644 --- a/infer/tests/frontend/objc/BlockTest.java +++ b/infer/tests/frontend/objc/BlockTest.java @@ -14,7 +14,7 @@ import static utils.matchers.DotFilesEqual.dotFileEqualTo; import com.google.common.collect.ImmutableList; -import org.junit.Ignore; +import org.junit.Assume; import org.junit.Rule; import org.junit.Test; @@ -72,10 +72,11 @@ public class BlockTest { newDotFile, dotFileEqualTo(block_dotty)); } - @Test @Ignore + @Test public void whenCaptureRunOnBlockReleaseThenDotFilesAreTheSame() throws InterruptedException, IOException, InferException { + Assume.assumeTrue(InferRunner.runsSupportedXCode()); String block_src = "infer/tests/codetoanalyze/objc/frontend/block/block_release.m"; diff --git a/infer/tests/frontend/objc/NSAssertTest.java b/infer/tests/frontend/objc/NSAssertTest.java index 98a5c9360..722c9ccf7 100644 --- a/infer/tests/frontend/objc/NSAssertTest.java +++ b/infer/tests/frontend/objc/NSAssertTest.java @@ -14,7 +14,7 @@ import static utils.matchers.DotFilesEqual.dotFileEqualTo; import com.google.common.collect.ImmutableList; -import org.junit.Ignore; +import org.junit.Assume; import org.junit.Rule; import org.junit.Test; @@ -32,10 +32,11 @@ public class NSAssertTest { public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); - @Test @Ignore + @Test public void whenCaptureRunOnPropertyThenDotFilesAreTheSame() throws InterruptedException, IOException, InferException { + Assume.assumeTrue(InferRunner.runsSupportedXCode()); String src = "infer/tests/codetoanalyze/objc/frontend/assertions/NSAssert_example.m"; String dotty = "infer/tests/codetoanalyze/objc/frontend/assertions/NSAssert_example.dot"; diff --git a/infer/tests/utils/InferRunner.java b/infer/tests/utils/InferRunner.java index 655d863a9..d7851bbb9 100644 --- a/infer/tests/utils/InferRunner.java +++ b/infer/tests/utils/InferRunner.java @@ -55,6 +55,8 @@ public class InferRunner { private static final String IPHONESIMULATOR_ISYSROOT_SUFFIX = "/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"; + private static final String CURRENT_XCODE_VERSION = "Xcode 7.0"; + private static HashMap inferResultsMap = new HashMap(); @@ -72,6 +74,21 @@ public class InferRunner { 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 createInferJavaCommand( TemporaryFolder folder, ImmutableList sourceFiles,