aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/pkgcache/IOExceptionsTest.java
diff options
context:
space:
mode:
authorGravatar aehlig <aehlig@google.com>2017-12-19 07:12:25 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-12-19 07:13:52 -0800
commitc801c393bcfabbe6e5058fd77ef2d67660c75da3 (patch)
tree1711325efe0f0e0fa9adb6d2aef8310a666e587b /src/test/java/com/google/devtools/build/lib/pkgcache/IOExceptionsTest.java
parent2918e78a2b3144d5cacc1ab20ab4626a72df797a (diff)
Automated rollback of commit 82e68b75304438c96ff878a0c2b8d18b42002486.
Fixes #4322, #4306. *** Reason for rollback *** Introduces a deadlock (see https://github.com/bazelbuild/bazel/issues/4322) *** Original change description *** Make FileSystem operate on LocalPath instead of Path. PiperOrigin-RevId: 179549866
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/pkgcache/IOExceptionsTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/pkgcache/IOExceptionsTest.java77
1 files changed, 36 insertions, 41 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/IOExceptionsTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/IOExceptionsTest.java
index 9f84f73a57..184f22201b 100644
--- a/src/test/java/com/google/devtools/build/lib/pkgcache/IOExceptionsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/pkgcache/IOExceptionsTest.java
@@ -25,7 +25,6 @@ import com.google.devtools.build.lib.skyframe.TransitiveTargetKey;
import com.google.devtools.build.lib.skyframe.TransitiveTargetValue;
import com.google.devtools.build.lib.vfs.FileStatus;
import com.google.devtools.build.lib.vfs.FileSystem;
-import com.google.devtools.build.lib.vfs.LocalPath;
import com.google.devtools.build.lib.vfs.ModifiedFileSet;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -49,16 +48,15 @@ public class IOExceptionsTest extends PackageLoadingTestCase {
private static final String FS_ROOT = "/fsg";
- private static final Function<LocalPath, String> NULL_FUNCTION =
- new Function<LocalPath, String>() {
- @Override
- @Nullable
- public String apply(LocalPath path) {
- return null;
- }
- };
+ private static final Function<Path, String> NULL_FUNCTION = new Function<Path, String>() {
+ @Override
+ @Nullable
+ public String apply(Path path) {
+ return null;
+ }
+ };
- private Function<LocalPath, String> crashMessage = NULL_FUNCTION;
+ private Function<Path, String> crashMessage = NULL_FUNCTION;
@Before
public final void initializeVisitor() throws Exception {
@@ -84,7 +82,7 @@ public class IOExceptionsTest extends PackageLoadingTestCase {
protected FileSystem createFileSystem() {
return new InMemoryFileSystem(BlazeClock.instance(), PathFragment.create(FS_ROOT)) {
@Override
- public FileStatus stat(LocalPath path, boolean followSymlinks) throws IOException {
+ public FileStatus stat(Path path, boolean followSymlinks) throws IOException {
String crash = crashMessage.apply(path);
if (crash != null) {
throw new IOException(crash);
@@ -99,16 +97,15 @@ public class IOExceptionsTest extends PackageLoadingTestCase {
reporter.removeHandler(failFastHandler); // expect errors
final Path buildPath = scratch.file("pkg/BUILD",
"sh_library(name = 'x')");
- crashMessage =
- new Function<LocalPath, String>() {
- @Override
- public String apply(LocalPath path) {
- if (buildPath.getLocalPath().equals(path)) {
- return "custom crash: " + buildPath;
- }
- return null;
- }
- };
+ crashMessage = new Function<Path, String>() {
+ @Override
+ public String apply(Path path) {
+ if (buildPath.equals(path)) {
+ return "custom crash: " + buildPath;
+ }
+ return null;
+ }
+ };
assertThat(visitTransitively(Label.parseAbsolute("//pkg:x"))).isFalse();
scratch.overwriteFile("pkg/BUILD",
"# another comment to force reload",
@@ -129,16 +126,15 @@ public class IOExceptionsTest extends PackageLoadingTestCase {
"sh_library(name = 'top', deps = ['//pkg:x'])");
final Path buildPath = scratch.file("pkg/BUILD",
"sh_library(name = 'x')");
- crashMessage =
- new Function<LocalPath, String>() {
- @Override
- public String apply(LocalPath path) {
- if (buildPath.getLocalPath().equals(path)) {
- return "custom crash: " + buildPath;
- }
- return null;
- }
- };
+ crashMessage = new Function<Path, String>() {
+ @Override
+ public String apply(Path path) {
+ if (buildPath.equals(path)) {
+ return "custom crash: " + buildPath;
+ }
+ return null;
+ }
+ };
assertThat(visitTransitively(Label.parseAbsolute("//top:top"))).isFalse();
assertContainsEvent("no such package 'pkg'");
// The traditional label visitor does not propagate the original IOException message.
@@ -163,16 +159,15 @@ public class IOExceptionsTest extends PackageLoadingTestCase {
final Path buildPath = scratch.file("top/BUILD",
"sh_library(name = 'x')");
buildPath.getParentDirectory().getRelative("pkg").createDirectory();
- crashMessage =
- new Function<LocalPath, String>() {
- @Override
- public String apply(LocalPath path) {
- if (buildPath.getLocalPath().equals(path)) {
- return "custom crash: " + buildPath;
- }
- return null;
- }
- };
+ crashMessage = new Function<Path, String>() {
+ @Override
+ public String apply(Path path) {
+ if (buildPath.equals(path)) {
+ return "custom crash: " + buildPath;
+ }
+ return null;
+ }
+ };
assertThat(visitTransitively(Label.parseAbsolute("//top/pkg:x"))).isFalse();
}
}