17
17
18
18
import com .google .common .collect .ImmutableSet ;
19
19
import com .google .devtools .build .lib .actions .BuildFailedException ;
20
+ import com .google .devtools .build .lib .bugreport .BugReport ;
20
21
import com .google .devtools .build .lib .buildtool .util .BuildIntegrationTestCase ;
21
22
import com .google .devtools .build .lib .events .EventKind ;
22
23
import com .google .devtools .build .lib .vfs .FileSystemUtils ;
@@ -193,16 +194,6 @@ public void emptyDirReplacedWithDifferentSymlink_invalidatesAction() throws Exce
193
194
assertInvalidatedByBuild ();
194
195
}
195
196
196
- @ Test
197
- public void infiniteSymlinkExpansion () throws Exception {
198
- Path dir = sourceDir .getRelative ("subdir/nested2" );
199
- dir .delete ();
200
- dir .createSymbolicLink (PathFragment .create (".." ));
201
- assertThrows (BuildFailedException .class , () -> buildTarget ("//foo" ));
202
- assertContainsEvent ("infinite symlink expansion detected" );
203
- assertContainsEvent ("foo/dir/subdir/nested2" );
204
- }
205
-
206
197
@ Test
207
198
@ Ignore ("TODO(#25834)" )
208
199
public void danglingSymlinkModified_invalidatesAction () throws Exception {
@@ -212,10 +203,23 @@ public void danglingSymlinkModified_invalidatesAction() throws Exception {
212
203
}
213
204
214
205
@ Test
215
- @ Ignore ("TODO(#25834)" )
216
- public void subPackageAdded_invalidatesAction () throws Exception {
206
+ public void crossingPackageBoundary_fails () throws Exception {
217
207
FileSystemUtils .touchFile (sourceDir .getRelative ("subdir/BUILD" ));
218
- assertInvalidatedByBuild ();
208
+ // TODO(#25834): This should not crash Bazel.
209
+ assertThrows (IllegalStateException .class , () -> buildTarget ("//foo" ));
210
+ BugReport .getAndResetLastCrashingThrowableIfInTest ();
211
+ assertContainsEvent (
212
+ "Directory artifact foo/dir crosses package boundary into package rooted at foo/dir/subdir" );
213
+ }
214
+
215
+ @ Test
216
+ public void infiniteSymlinkExpansion_fails () throws Exception {
217
+ Path dir = sourceDir .getRelative ("subdir/nested2" );
218
+ dir .delete ();
219
+ dir .createSymbolicLink (PathFragment .create (".." ));
220
+ assertThrows (BuildFailedException .class , () -> buildTarget ("//foo" ));
221
+ assertContainsEvent ("infinite symlink expansion detected" );
222
+ assertContainsEvent ("foo/dir/subdir/nested2" );
219
223
}
220
224
221
225
private static final String GENRULE_EVENT = "Executing genrule //foo:foo" ;
0 commit comments