diff options
author | nharmata <nharmata@google.com> | 2017-10-13 21:49:58 +0200 |
---|---|---|
committer | Jakob Buchgraber <buchgr@google.com> | 2017-10-16 17:48:42 +0200 |
commit | f7d5010785c8118e0a28d296a6cabee94706293a (patch) | |
tree | 610e101a7f7b2e7d110098c40cdac540b1ab6389 /src/test/java/com/google/devtools/build/lib | |
parent | 72aae85fbfc7c0809b45a9061d04af85f0a1a9b9 (diff) |
Properly report errors as errors.
RELNOTES: None
PiperOrigin-RevId: 172133468
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorIOTest.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorIOTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorIOTest.java index fc83dfce58..37a992d405 100644 --- a/src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorIOTest.java +++ b/src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorIOTest.java @@ -13,8 +13,10 @@ // limitations under the License. package com.google.devtools.build.lib.pkgcache; +import com.google.common.collect.ImmutableSet; import com.google.common.truth.Truth; import com.google.devtools.build.lib.clock.BlazeClock; +import com.google.devtools.build.lib.events.EventKind; import com.google.devtools.build.lib.vfs.Dirent; import com.google.devtools.build.lib.vfs.FileStatus; import com.google.devtools.build.lib.vfs.FileSystem; @@ -86,9 +88,15 @@ public class TargetPatternEvaluatorIOTest extends AbstractTargetPatternEvaluator this.transformer = createInconsistentFileStateTransformer("parent/badstat"); // When we find all the targets beneath parent in keep_going mode, we get the valid target - // parent:parent, even though processing badstat threw an InconsistentFilesystemException. + // parent:parent, even though processing badstat threw an InconsistentFilesystemException, Truth.assertThat(parseListKeepGoing("//parent/...").getFirst()) .containsExactlyElementsIn(labels("//parent:parent")); + + // And the TargetPatternEvaluator reported the expected ERROR event to the handler. + assertContainsEvent( + "Failed to get information about path, for parent/badstat, skipping: Inconsistent " + + "filesystem operations", + ImmutableSet.of(EventKind.ERROR)); } /** @@ -109,9 +117,15 @@ public class TargetPatternEvaluatorIOTest extends AbstractTargetPatternEvaluator this.transformer = createBadDirectoryListingTransformer("parent/badstat"); // When we find all the targets beneath parent in keep_going mode, we get the valid target - // parent:parent, even though processing badstat threw an InconsistentFilesystemException. + // parent:parent, even though processing badstat threw an IOException, Truth.assertThat(parseListKeepGoing("//parent/...").getFirst()) .containsExactlyElementsIn(labels("//parent:parent")); + + // And the TargetPatternEvaluator reported the expected ERROR event to the handler. + assertContainsEvent( + "Failed to list directory contents, for parent/badstat, skipping: Path ended in " + + "parent/badstat, so readdir failed", + ImmutableSet.of(EventKind.ERROR)); } private Transformer createInconsistentFileStateTransformer(final String badPathSuffix) { |