aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java50
1 files changed, 9 insertions, 41 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java
index cb558228bc..32dffabba7 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java
@@ -96,7 +96,7 @@ public abstract class GlobFunctionTest {
private AtomicReference<PathPackageLocator> pkgLocator;
private TimestampGranularityMonitor tsgm;
- private static final PackageIdentifier PKG_PATH_ID = PackageIdentifier.createInDefaultRepo("pkg");
+ private static final PackageIdentifier PKG_ID = PackageIdentifier.createInDefaultRepo("pkg");
@Before
public final void setUp() throws Exception {
@@ -104,7 +104,7 @@ public abstract class GlobFunctionTest {
root = fs.getRootDirectory().getRelative("root/workspace");
writableRoot = fs.getRootDirectory().getRelative("writableRoot/workspace");
outputBase = fs.getRootDirectory().getRelative("output_base");
- pkgPath = root.getRelative(PKG_PATH_ID.getPackageFragment());
+ pkgPath = root.getRelative(PKG_ID.getPackageFragment());
pkgLocator =
new AtomicReference<>(
@@ -267,33 +267,6 @@ public abstract class GlobFunctionTest {
}
@Test
- public void testGlobMissingPackage() throws Exception {
- // This is a malformed value key, because "missing" is not a package. Nevertheless, we have a
- // sanity check that building the corresponding GlobValue fails loudly. The test depends on
- // implementation details of ParallelEvaluator and GlobFunction.
- SkyKey skyKey =
- GlobValue.key(
- PackageIdentifier.createInDefaultRepo("missing"),
- "foo",
- false,
- PathFragment.EMPTY_FRAGMENT);
- try {
- driver.evaluate(
- ImmutableList.of(skyKey),
- false,
- SkyframeExecutor.DEFAULT_THREAD_COUNT,
- NullEventHandler.INSTANCE);
- fail();
- } catch (RuntimeException e) {
- assertThat(e.getMessage())
- .contains("Unrecoverable error while evaluating node '" + skyKey + "'");
- Throwable cause = e.getCause();
- assertThat(cause).isInstanceOf(IllegalStateException.class);
- assertThat(cause.getMessage()).contains("isn't an existing package");
- }
- }
-
- @Test
public void testGlobDoesNotCrossPackageBoundary() throws Exception {
FileSystemUtils.createEmptyFile(pkgPath.getRelative("foo/BUILD"));
// "foo/bar" should not be in the results because foo is a separate package.
@@ -360,7 +333,7 @@ public abstract class GlobFunctionTest {
}
private GlobValue runGlob(boolean excludeDirs, String pattern) throws Exception {
- SkyKey skyKey = GlobValue.key(PKG_PATH_ID, pattern, excludeDirs, PathFragment.EMPTY_FRAGMENT);
+ SkyKey skyKey = GlobValue.key(PKG_ID, root, pattern, excludeDirs, PathFragment.EMPTY_FRAGMENT);
EvaluationResult<SkyValue> result =
driver.evaluate(
ImmutableList.of(skyKey),
@@ -444,7 +417,7 @@ public abstract class GlobFunctionTest {
private void assertIllegalPattern(String pattern) {
try {
- GlobValue.key(PKG_PATH_ID, pattern, false, PathFragment.EMPTY_FRAGMENT);
+ GlobValue.key(PKG_ID, root, pattern, false, PathFragment.EMPTY_FRAGMENT);
fail("invalid pattern not detected: " + pattern);
} catch (InvalidGlobPatternException e) {
// Expected.
@@ -582,7 +555,6 @@ public abstract class GlobFunctionTest {
/** Regression test for b/13319874: Directory listing crash. */
@Test
public void testResilienceToFilesystemInconsistencies_DirectoryExistence() throws Exception {
- long nodeId = pkgPath.getRelative("BUILD").stat().getNodeId();
// Our custom filesystem says "pkgPath/BUILD" exists but "pkgPath" does not exist.
fs.stubStat(pkgPath, null);
RootedPath pkgRootedPath = RootedPath.toRootedPath(root, pkgPath);
@@ -590,13 +562,8 @@ public abstract class GlobFunctionTest {
FileValue pkgDirValue =
FileValue.value(pkgRootedPath, pkgDirFileStateValue, pkgRootedPath, pkgDirFileStateValue);
differencer.inject(ImmutableMap.of(FileValue.key(pkgRootedPath), pkgDirValue));
- String expectedMessage =
- "Some filesystem operations implied /root/workspace/pkg/BUILD was a "
- + "regular file with size of 0 and mtime of 0 and nodeId of "
- + nodeId
- + " and mtime of 0 "
- + "but others made us think it was a nonexistent path";
- SkyKey skyKey = GlobValue.key(PKG_PATH_ID, "*/foo", false, PathFragment.EMPTY_FRAGMENT);
+ String expectedMessage = "/root/workspace/pkg is no longer an existing directory";
+ SkyKey skyKey = GlobValue.key(PKG_ID, root, "*/foo", false, PathFragment.EMPTY_FRAGMENT);
EvaluationResult<GlobValue> result =
driver.evaluate(
ImmutableList.of(skyKey),
@@ -623,7 +590,7 @@ public abstract class GlobFunctionTest {
ImmutableMap.of(
DirectoryListingStateValue.key(fooBarDirRootedPath), fooBarDirListingValue));
String expectedMessage = "/root/workspace/pkg/foo/bar/wiz is no longer an existing directory.";
- SkyKey skyKey = GlobValue.key(PKG_PATH_ID, "**/wiz", false, PathFragment.EMPTY_FRAGMENT);
+ SkyKey skyKey = GlobValue.key(PKG_ID, root, "**/wiz", false, PathFragment.EMPTY_FRAGMENT);
EvaluationResult<GlobValue> result =
driver.evaluate(
ImmutableList.of(skyKey),
@@ -695,7 +662,8 @@ public abstract class GlobFunctionTest {
ImmutableMap.of(DirectoryListingStateValue.key(wizRootedPath), wizDirListingValue));
String expectedMessage =
"readdir and stat disagree about whether " + fileRootedPath.asPath() + " is a symlink";
- SkyKey skyKey = GlobValue.key(PKG_PATH_ID, "foo/bar/wiz/*", false, PathFragment.EMPTY_FRAGMENT);
+ SkyKey skyKey = GlobValue.key(PKG_ID, root, "foo/bar/wiz/*", false,
+ PathFragment.EMPTY_FRAGMENT);
EvaluationResult<GlobValue> result =
driver.evaluate(
ImmutableList.of(skyKey),