Search in sources :

Example 11 with ExecException

use of com.google.devtools.build.lib.actions.ExecException in project bazel by bazelbuild.

the class StandaloneSpawnStrategyTest method testIOSEnvironmentOnNonDarwin.

// 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.getMessage()).contains("Cannot locate iOS SDK on non-darwin operating system");
    }
}
Also used : ExecException(com.google.devtools.build.lib.actions.ExecException) ActionsTestUtil(com.google.devtools.build.lib.actions.util.ActionsTestUtil) BaseSpawn(com.google.devtools.build.lib.actions.BaseSpawn) Spawn(com.google.devtools.build.lib.actions.Spawn) Test(org.junit.Test)

Aggregations

ExecException (com.google.devtools.build.lib.actions.ExecException)11 Executor (com.google.devtools.build.lib.actions.Executor)8 IOException (java.io.IOException)6 Artifact (com.google.devtools.build.lib.actions.Artifact)4 ActionExecutionException (com.google.devtools.build.lib.actions.ActionExecutionException)3 Spawn (com.google.devtools.build.lib.actions.Spawn)3 ThreadCompatible (com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadCompatible)3 Path (com.google.devtools.build.lib.vfs.Path)3 ActionInput (com.google.devtools.build.lib.actions.ActionInput)2 BaseSpawn (com.google.devtools.build.lib.actions.BaseSpawn)2 EnvironmentalExecException (com.google.devtools.build.lib.actions.EnvironmentalExecException)2 SpawnActionContext (com.google.devtools.build.lib.actions.SpawnActionContext)2 Function (com.google.common.base.Function)1 TreeFileArtifact (com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact)1 ArtifactPrefixConflictException (com.google.devtools.build.lib.actions.ArtifactPrefixConflictException)1 ArtifactResolver (com.google.devtools.build.lib.actions.ArtifactResolver)1 SimpleSpawn (com.google.devtools.build.lib.actions.SimpleSpawn)1 TestExecException (com.google.devtools.build.lib.actions.TestExecException)1 UserExecException (com.google.devtools.build.lib.actions.UserExecException)1 ActionsTestUtil (com.google.devtools.build.lib.actions.util.ActionsTestUtil)1