aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
diff options
context:
space:
mode:
authorGravatar nharmata <nharmata@google.com>2017-06-16 00:26:27 +0200
committerGravatar Yun Peng <pcloudy@google.com>2017-06-16 09:27:24 +0200
commitbea67e9e7bc5b25dc0569bc429d92434a76b9a84 (patch)
treed0f71a262248ffe4676fd746a428fc1c1f6ce48e /src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
parent0bd2102ea33f8c1bc40fbfb2acabcd46895011f3 (diff)
A bunch of unrelated cleanups:
-Have SkylarkImportLookupFunction include causes in the SkyFunctionExceptions it throws. -Better transitive skyframe error declarations in ASTFileLookupFunction. -Have ErrorInfo differentiate between direct and transitive transience. -Introduce ErrorInfoManager and have ParallelEvaluator/ParallelEvaluatorContext use it. RELNOTES: None PiperOrigin-RevId: 159163186
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
index f9ff08e22d..ea00194bab 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
@@ -681,6 +681,24 @@ public class PackageFunctionTest extends BuildViewTestCase {
assertThat(errorInfo.getException()).hasCauseThat().isSameAs(exn);
}
+ @Test
+ public void testPackageLoadingErrorOnIOExceptionReadingBzlFile() throws Exception {
+ scratch.file("foo/BUILD", "load('//foo:bzl.bzl', 'x')");
+ Path fooBzlFilePath = scratch.file("foo/bzl.bzl");
+ IOException exn = new IOException("nope");
+ fs.throwExceptionOnGetInputStream(fooBzlFilePath, exn);
+
+ SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo"));
+ EvaluationResult<PackageValue> result = SkyframeExecutorTestUtils.evaluate(
+ getSkyframeExecutor(), skyKey, /*keepGoing=*/false, reporter);
+ assertThat(result.hasError()).isTrue();
+ ErrorInfo errorInfo = result.getError(skyKey);
+ String errorMessage = errorInfo.getException().getMessage();
+ assertThat(errorMessage).contains("nope");
+ assertThat(errorInfo.getException()).isInstanceOf(NoSuchPackageException.class);
+ assertThat(errorInfo.getException()).hasCauseThat().isSameAs(exn);
+ }
+
private static class CustomInMemoryFs extends InMemoryFileSystem {
private abstract static class FileStatusOrException {
abstract FileStatus get() throws IOException;