diff options
author | 2017-06-13 12:56:07 +0200 | |
---|---|---|
committer | 2017-06-13 17:13:17 +0200 | |
commit | 1d62c67a2d6d6eccf415ad5647d860d08f4c5966 (patch) | |
tree | 23eeec1aa45038fc5693b09c8d2556df5f92aa59 /src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java | |
parent | 3e87c626ed76536420aa06e4c258209b32bb76e0 (diff) |
Extract the MacOS/XCode env rewrite logic into lib.exec.apple
Also add an interface to allow injecting that logic into LocalSpawnRunner; this
is in preparation for rewriting StandaloneSpawnStrategy to use
LocalSpawnRunner.
At the same time, this reduces the dependencies from exec / standalone to
rules.apple, which is a prerequisite for micro-Bazel.
There's a small semantic change hidden here - we now only set the new
XCodeLocalEnvProvider if we're actually running on Darwin, so we no longer
fail execution on non-Darwin platforms if XCODE_VERSION_OVERRIDE or
APPLE_SDK_VERSION_OVERRIDE is set. As a result, I moved the corresponding test
from StandaloneSpawnStrategyTest to the new XCodeLocalEnvProviderTest.
While I'm at it, also open source DottedVersionTest and CacheManagerTest.
PiperOrigin-RevId: 158829077
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java b/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java index d8f54b637c..5f437637f3 100644 --- a/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java +++ b/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java @@ -38,7 +38,6 @@ import com.google.devtools.build.lib.exec.BlazeExecutor; import com.google.devtools.build.lib.exec.ExecutionOptions; import com.google.devtools.build.lib.exec.SingleBuildFileCache; import com.google.devtools.build.lib.integration.util.IntegrationMock; -import com.google.devtools.build.lib.rules.apple.AppleConfiguration; import com.google.devtools.build.lib.testutil.TestConstants; import com.google.devtools.build.lib.testutil.TestFileOutErr; import com.google.devtools.build.lib.testutil.TestUtils; @@ -212,29 +211,4 @@ public class StandaloneSpawnStrategyTest { assertThat(err()).isEqualTo("Oops!\n"); assertThat(out()).isEmpty(); } - - // Test an action with environment variables set indicating an action running on a darwin host - // system. Such actions should fail given the fact that these tests run on a non darwin - // architecture. - @Test - public void testIOSEnvironmentOnNonDarwin() throws Exception { - if (OS.getCurrent() == OS.DARWIN) { - return; - } - Spawn spawn = new BaseSpawn.Local( - Arrays.asList("/bin/sh", "-c", "echo $SDKROOT"), - ImmutableMap.<String, String>of(AppleConfiguration.APPLE_SDK_VERSION_ENV_NAME, "8.4", - AppleConfiguration.APPLE_SDK_PLATFORM_ENV_NAME, "iPhoneSimulator"), - new ActionsTestUtil.NullAction(), - ResourceSet.ZERO); - - try { - run(spawn); - fail("action should fail due to being unable to resolve SDKROOT"); - } catch (ExecException e) { - assertThat(e) - .hasMessageThat() - .contains("Cannot locate iOS SDK on non-darwin operating system"); - } - } } |