Skip to content

Commit

Permalink
Add a test to document the fact the local actions fail with Skymeld.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 440318640
  • Loading branch information
joeleba authored and copybara-github committed Apr 8, 2022
1 parent 3636aaf commit 32e841d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/test/java/com/google/devtools/build/lib/buildtool/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@ java_test(
"//src/main/java/com/google/devtools/build/lib:runtime",
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/analysis:view_creation_failed_exception",
"//src/main/java/com/google/devtools/build/lib/util/io",
"//src/main/protobuf:failure_details_java_proto",
"//src/test/java/com/google/devtools/build/lib/buildtool/util",
"//third_party:guava",
"//third_party:junit4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
package com.google.devtools.build.lib.buildtool;

import static com.google.common.truth.Truth.assertThat;
import static com.google.devtools.build.lib.server.FailureDetails.Spawn.Code.NON_ZERO_EXIT;
import static org.junit.Assert.assertThrows;

import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.BuildFailedException;
import com.google.devtools.build.lib.analysis.ViewCreationFailedException;
import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase;
import com.google.devtools.build.lib.util.io.RecordingOutErr;
import com.google.testing.junit.testparameterinjector.TestParameter;
import com.google.testing.junit.testparameterinjector.TestParameterInjector;
import java.io.IOException;
Expand Down Expand Up @@ -149,4 +151,31 @@ public void analysisAndExecutionFailure_keepGoing_bothReported() throws Exceptio
"Action foo/execution_failure.out failed: missing input file '//foo:missing'");
events.assertContainsError("rule '//foo:missing' does not exist");
}

@Test
public void noSymlinkPlantedLocalAction_failureNoSuchFileOrDirectory() throws Exception {
addOptions("--spawn_strategy=standalone");
write(
"foo/BUILD",
"genrule(",
" name = 'foo',",
" srcs = ['foo.in'],",
" outs = ['foo.out'],",
" cmd = 'cp foo.in $(location foo.out)'",
")");
write("foo/foo.in");

outErr = new RecordingOutErr();
BuildFailedException e =
assertThrows(BuildFailedException.class, () -> buildTarget("//foo:foo"));
String err = ((RecordingOutErr) outErr).errAsLatin1();

assertThat(e.getDetailedExitCode().getFailureDetail().getSpawn().getCode())
.isEqualTo(NON_ZERO_EXIT);
assertThat(err)
.contains(
"Executing genrule //foo:foo failed: (Exit 1): bash failed: error executing command"
+ " (from target //foo:foo)");
assertThat(err).contains("No such file or directory");
}
}

0 comments on commit 32e841d

Please sign in to comment.