Skip to content

Commit

Permalink
Enable EditDuringBuildTest
Browse files Browse the repository at this point in the history
Input had to be made writable by the sandbox. This makes the assumption that the
input path the rule sees and as staged by the test are the same thing (aka we're
not copying inputs into the environment), which seems to hold for now.

PiperOrigin-RevId: 428832842
  • Loading branch information
michajlo authored and copybara-github committed Feb 15, 2022
1 parent 34f20a1 commit b194653
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/test/java/com/google/devtools/build/lib/buildtool/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ java_test(
name = "EditDuringBuildTest",
srcs = ["EditDuringBuildTest.java"],
tags = [
"manual",
"no_windows",
],
deps = [
Expand Down Expand Up @@ -609,7 +608,6 @@ build_test(
":ContextProviderInitializationTest",
":CorruptedActionCacheTest",
":DanglingSymlinkTest",
":EditDuringBuildTest",
":EnvironmentRestrictedBuildTest",
":IncludeValidationTest",
":LabelCrossesPackageBoundaryTest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public class EditDuringBuildTest extends BuildIntegrationTestCase {

@Test
public void testEditDuringBuild() throws Exception {
Path in = write("edit/in", "line1");
in.setLastModifiedTime(123456789);

// Make in writable from sandbox (in case sandbox strategy is used).
String absoluteInPath = in.getPathString();
addOptions("--sandbox_writable_path=" + absoluteInPath);

// The "echo" effects editing of the source file during the build:
write("edit/BUILD",
"genrule(name = 'edit',",
Expand All @@ -49,9 +56,6 @@ public void testEditDuringBuild() throws Exception {
" cmd = '/bin/cp $(location in) $(location out) && "
+ "echo line2 >>$(location in)')");

Path in = write("edit/in", "line1");
in.setLastModifiedTime(123456789);

// Edit during build => undefined result (in fact, "line1")
String out = buildAndReadOutputFile();
assertThat(out).isEqualTo("line1\n");
Expand Down

0 comments on commit b194653

Please sign in to comment.