Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 1 | // Copyright 2015 The Bazel Authors. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package com.google.devtools.build.lib.skyframe; |
| 16 | |
| 17 | import static com.google.common.truth.Truth.assertThat; |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 18 | import static org.junit.Assert.fail; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 19 | |
| 20 | import com.google.common.base.Predicates; |
| 21 | import com.google.common.collect.ImmutableList; |
| 22 | import com.google.common.collect.ImmutableMap; |
| 23 | import com.google.common.collect.Maps; |
Googler | c804c66 | 2016-12-01 16:53:28 +0000 | [diff] [blame] | 24 | import com.google.common.collect.Sets; |
shahan | 602cc85 | 2018-06-06 20:09:57 -0700 | [diff] [blame] | 25 | import com.google.devtools.build.lib.actions.FileStateValue; |
Florian Weikert | cca703a | 2015-12-07 09:56:38 +0000 | [diff] [blame] | 26 | import com.google.devtools.build.lib.analysis.util.BuildViewTestCase; |
philwo | 3bcb9f6 | 2017-09-06 12:52:21 +0200 | [diff] [blame] | 27 | import com.google.devtools.build.lib.clock.BlazeClock; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 28 | import com.google.devtools.build.lib.cmdline.Label; |
| 29 | import com.google.devtools.build.lib.cmdline.PackageIdentifier; |
| 30 | import com.google.devtools.build.lib.packages.ConstantRuleVisibility; |
nharmata | ff688bf | 2017-06-07 17:03:52 -0400 | [diff] [blame] | 31 | import com.google.devtools.build.lib.packages.NoSuchPackageException; |
Nathan Harmata | 2022ad8 | 2016-02-22 23:04:14 +0000 | [diff] [blame] | 32 | import com.google.devtools.build.lib.packages.NoSuchTargetException; |
brandjon | 674ab86 | 2017-10-06 23:17:33 +0200 | [diff] [blame] | 33 | import com.google.devtools.build.lib.packages.SkylarkSemanticsOptions; |
Janak Ramakrishnan | 326c698 | 2016-09-27 14:58:26 +0000 | [diff] [blame] | 34 | import com.google.devtools.build.lib.pkgcache.PackageCacheOptions; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 35 | import com.google.devtools.build.lib.pkgcache.PathPackageLocator; |
| 36 | import com.google.devtools.build.lib.skyframe.util.SkyframeExecutorTestUtils; |
| 37 | import com.google.devtools.build.lib.testutil.ManualClock; |
Ulf Adams | c73051c6 | 2016-03-23 09:18:13 +0000 | [diff] [blame] | 38 | import com.google.devtools.build.lib.util.io.TimestampGranularityMonitor; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 39 | import com.google.devtools.build.lib.vfs.Dirent; |
| 40 | import com.google.devtools.build.lib.vfs.FileStatus; |
| 41 | import com.google.devtools.build.lib.vfs.FileSystem; |
| 42 | import com.google.devtools.build.lib.vfs.FileSystemUtils; |
| 43 | import com.google.devtools.build.lib.vfs.ModifiedFileSet; |
| 44 | import com.google.devtools.build.lib.vfs.Path; |
| 45 | import com.google.devtools.build.lib.vfs.PathFragment; |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 46 | import com.google.devtools.build.lib.vfs.Root; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 47 | import com.google.devtools.build.lib.vfs.RootedPath; |
| 48 | import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem; |
| 49 | import com.google.devtools.build.skyframe.ErrorInfo; |
| 50 | import com.google.devtools.build.skyframe.EvaluationResult; |
| 51 | import com.google.devtools.build.skyframe.RecordingDifferencer; |
| 52 | import com.google.devtools.build.skyframe.SkyKey; |
| 53 | import com.google.devtools.build.skyframe.SkyValue; |
Janak Ramakrishnan | 326c698 | 2016-09-27 14:58:26 +0000 | [diff] [blame] | 54 | import com.google.devtools.common.options.Options; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 55 | import java.io.IOException; |
nharmata | ff688bf | 2017-06-07 17:03:52 -0400 | [diff] [blame] | 56 | import java.io.InputStream; |
Janak Ramakrishnan | ffbc28a | 2017-02-13 22:51:45 +0000 | [diff] [blame] | 57 | import java.util.ArrayList; |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 58 | import java.util.Arrays; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 59 | import java.util.Collection; |
Janak Ramakrishnan | ffbc28a | 2017-02-13 22:51:45 +0000 | [diff] [blame] | 60 | import java.util.List; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 61 | import java.util.Map; |
Googler | c804c66 | 2016-12-01 16:53:28 +0000 | [diff] [blame] | 62 | import java.util.Set; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 63 | import java.util.UUID; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 64 | import javax.annotation.Nullable; |
John Cater | 9469591 | 2016-08-03 12:09:39 +0000 | [diff] [blame] | 65 | import org.junit.Test; |
| 66 | import org.junit.runner.RunWith; |
| 67 | import org.junit.runners.JUnit4; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 68 | |
| 69 | /** |
| 70 | * Unit tests of specific functionality of PackageFunction. Note that it's already tested |
| 71 | * indirectly in several other places. |
| 72 | */ |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 73 | @RunWith(JUnit4.class) |
Florian Weikert | cca703a | 2015-12-07 09:56:38 +0000 | [diff] [blame] | 74 | public class PackageFunctionTest extends BuildViewTestCase { |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 75 | |
| 76 | private CustomInMemoryFs fs = new CustomInMemoryFs(new ManualClock()); |
| 77 | |
Ulf Adams | c73051c6 | 2016-03-23 09:18:13 +0000 | [diff] [blame] | 78 | private void preparePackageLoading(Path... roots) { |
Janak Ramakrishnan | 326c698 | 2016-09-27 14:58:26 +0000 | [diff] [blame] | 79 | PackageCacheOptions packageCacheOptions = Options.getDefaults(PackageCacheOptions.class); |
| 80 | packageCacheOptions.defaultVisibility = ConstantRuleVisibility.PUBLIC; |
| 81 | packageCacheOptions.showLoadingProgress = true; |
| 82 | packageCacheOptions.globbingThreads = 7; |
Klaus Aehlig | 6f33a1c | 2016-09-13 16:46:10 +0000 | [diff] [blame] | 83 | getSkyframeExecutor() |
| 84 | .preparePackageLoading( |
John Cater | e0d1d0e | 2017-11-28 20:47:41 -0800 | [diff] [blame] | 85 | new PathPackageLocator( |
| 86 | outputBase, |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 87 | Arrays.stream(roots).map(Root::fromPath).collect(ImmutableList.toImmutableList()), |
John Cater | e0d1d0e | 2017-11-28 20:47:41 -0800 | [diff] [blame] | 88 | BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY), |
Janak Ramakrishnan | 326c698 | 2016-09-27 14:58:26 +0000 | [diff] [blame] | 89 | packageCacheOptions, |
brandjon | 7dc3416 | 2017-04-27 18:34:33 +0200 | [diff] [blame] | 90 | Options.getDefaults(SkylarkSemanticsOptions.class), |
laurentlb | 99958b8 | 2018-08-20 06:24:23 -0700 | [diff] [blame^] | 91 | "", |
Klaus Aehlig | 6f33a1c | 2016-09-13 16:46:10 +0000 | [diff] [blame] | 92 | UUID.randomUUID(), |
| 93 | ImmutableMap.<String, String>of(), |
| 94 | new TimestampGranularityMonitor(BlazeClock.instance())); |
juliexxia | 651797f | 2018-08-01 11:45:13 -0700 | [diff] [blame] | 95 | skyframeExecutor.setActionEnv(ImmutableMap.<String, String>of()); |
Ulf Adams | c73051c6 | 2016-03-23 09:18:13 +0000 | [diff] [blame] | 96 | } |
| 97 | |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 98 | @Override |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 99 | protected FileSystem createFileSystem() { |
| 100 | return fs; |
| 101 | } |
| 102 | |
| 103 | private PackageValue validPackage(SkyKey skyKey) throws InterruptedException { |
| 104 | EvaluationResult<PackageValue> result = SkyframeExecutorTestUtils.evaluate( |
| 105 | getSkyframeExecutor(), skyKey, /*keepGoing=*/false, reporter); |
| 106 | if (result.hasError()) { |
| 107 | fail(result.getError(skyKey).getException().getMessage()); |
| 108 | } |
| 109 | PackageValue value = result.get(skyKey); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 110 | assertThat(value.getPackage().containsErrors()).isFalse(); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 111 | return value; |
| 112 | } |
| 113 | |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 114 | @Test |
John Cater | 9469591 | 2016-08-03 12:09:39 +0000 | [diff] [blame] | 115 | public void testValidPackage() throws Exception { |
| 116 | scratch.file("pkg/BUILD"); |
| 117 | validPackage(PackageValue.key(PackageIdentifier.parse("@//pkg"))); |
| 118 | } |
| 119 | |
| 120 | @Test |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 121 | public void testPropagatesFilesystemInconsistencies() throws Exception { |
| 122 | reporter.removeHandler(failFastHandler); |
| 123 | RecordingDifferencer differencer = getSkyframeExecutor().getDifferencerForTesting(); |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 124 | Root pkgRoot = getSkyframeExecutor().getPathEntries().get(0); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 125 | Path fooBuildFile = scratch.file("foo/BUILD"); |
| 126 | Path fooDir = fooBuildFile.getParentDirectory(); |
| 127 | |
neerajen | 89188eb | 2018-07-19 13:03:43 -0700 | [diff] [blame] | 128 | // Our custom filesystem says that fooDir is neither a file nor directory nor symlink |
| 129 | FileStatus inconsistentFileStatus = new FileStatus() { |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 130 | @Override |
| 131 | public boolean isFile() { |
neerajen | 89188eb | 2018-07-19 13:03:43 -0700 | [diff] [blame] | 132 | return false; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | @Override |
| 136 | public boolean isDirectory() { |
| 137 | return false; |
| 138 | } |
| 139 | |
| 140 | @Override |
| 141 | public boolean isSymbolicLink() { |
| 142 | return false; |
| 143 | } |
| 144 | |
| 145 | @Override |
| 146 | public boolean isSpecialFile() { |
| 147 | return false; |
| 148 | } |
| 149 | |
| 150 | @Override |
| 151 | public long getSize() throws IOException { |
| 152 | return 0; |
| 153 | } |
| 154 | |
| 155 | @Override |
| 156 | public long getLastModifiedTime() throws IOException { |
| 157 | return 0; |
| 158 | } |
| 159 | |
| 160 | @Override |
| 161 | public long getLastChangeTime() throws IOException { |
| 162 | return 0; |
| 163 | } |
| 164 | |
| 165 | @Override |
| 166 | public long getNodeId() throws IOException { |
| 167 | return 0; |
| 168 | } |
| 169 | }; |
neerajen | 89188eb | 2018-07-19 13:03:43 -0700 | [diff] [blame] | 170 | |
| 171 | fs.stubStat(fooBuildFile, inconsistentFileStatus); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 172 | RootedPath pkgRootedPath = RootedPath.toRootedPath(pkgRoot, fooDir); |
Ulf Adams | c73051c6 | 2016-03-23 09:18:13 +0000 | [diff] [blame] | 173 | SkyValue fooDirValue = FileStateValue.create(pkgRootedPath, tsgm); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 174 | differencer.inject(ImmutableMap.of(FileStateValue.key(pkgRootedPath), fooDirValue)); |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 175 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
neerajen | 89188eb | 2018-07-19 13:03:43 -0700 | [diff] [blame] | 176 | String expectedMessage = "according to stat, existing path /workspace/foo/BUILD is neither" |
| 177 | + " a file nor directory nor symlink."; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 178 | EvaluationResult<PackageValue> result = SkyframeExecutorTestUtils.evaluate( |
| 179 | getSkyframeExecutor(), skyKey, /*keepGoing=*/false, reporter); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 180 | assertThat(result.hasError()).isTrue(); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 181 | ErrorInfo errorInfo = result.getError(skyKey); |
| 182 | String errorMessage = errorInfo.getException().getMessage(); |
| 183 | assertThat(errorMessage).contains("Inconsistent filesystem operations"); |
| 184 | assertThat(errorMessage).contains(expectedMessage); |
| 185 | } |
| 186 | |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 187 | @Test |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 188 | public void testPropagatesFilesystemInconsistencies_Globbing() throws Exception { |
| 189 | reporter.removeHandler(failFastHandler); |
| 190 | RecordingDifferencer differencer = getSkyframeExecutor().getDifferencerForTesting(); |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 191 | Root pkgRoot = getSkyframeExecutor().getPathEntries().get(0); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 192 | scratch.file("foo/BUILD", |
| 193 | "subinclude('//a:a')", |
| 194 | "sh_library(name = 'foo', srcs = glob(['bar/**/baz.sh']))"); |
| 195 | scratch.file("a/BUILD"); |
| 196 | scratch.file("a/a"); |
| 197 | Path bazFile = scratch.file("foo/bar/baz/baz.sh"); |
| 198 | Path bazDir = bazFile.getParentDirectory(); |
| 199 | Path barDir = bazDir.getParentDirectory(); |
| 200 | |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 201 | // Our custom filesystem says "foo/bar/baz" does not exist but it also says that "foo/bar" |
| 202 | // has a child directory "baz". |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 203 | fs.stubStat(bazDir, null); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 204 | RootedPath barDirRootedPath = RootedPath.toRootedPath(pkgRoot, barDir); |
janakr | e54491e | 2018-07-11 16:29:13 -0700 | [diff] [blame] | 205 | differencer.inject( |
| 206 | ImmutableMap.of( |
| 207 | DirectoryListingStateValue.key(barDirRootedPath), |
| 208 | DirectoryListingStateValue.create( |
| 209 | ImmutableList.of(new Dirent("baz", Dirent.Type.DIRECTORY))))); |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 210 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
Nathan Harmata | c0f3d4e | 2016-10-17 15:49:34 +0000 | [diff] [blame] | 211 | String expectedMessage = "/workspace/foo/bar/baz is no longer an existing directory"; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 212 | EvaluationResult<PackageValue> result = SkyframeExecutorTestUtils.evaluate( |
| 213 | getSkyframeExecutor(), skyKey, /*keepGoing=*/false, reporter); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 214 | assertThat(result.hasError()).isTrue(); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 215 | ErrorInfo errorInfo = result.getError(skyKey); |
| 216 | String errorMessage = errorInfo.getException().getMessage(); |
| 217 | assertThat(errorMessage).contains("Inconsistent filesystem operations"); |
| 218 | assertThat(errorMessage).contains(expectedMessage); |
| 219 | } |
| 220 | |
| 221 | /** Regression test for unexpected exception type from PackageValue. */ |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 222 | @Test |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 223 | public void testDiscrepancyBetweenLegacyAndSkyframePackageLoadingErrors() throws Exception { |
| 224 | reporter.removeHandler(failFastHandler); |
| 225 | Path fooBuildFile = scratch.file("foo/BUILD", |
| 226 | "sh_library(name = 'foo', srcs = glob(['bar/*.sh']))"); |
| 227 | Path fooDir = fooBuildFile.getParentDirectory(); |
| 228 | Path barDir = fooDir.getRelative("bar"); |
| 229 | scratch.file("foo/bar/baz.sh"); |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 230 | fs.scheduleMakeUnreadableAfterReaddir(barDir); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 231 | |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 232 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 233 | String expectedMessage = "Encountered error 'Directory is not readable'"; |
| 234 | EvaluationResult<PackageValue> result = SkyframeExecutorTestUtils.evaluate( |
| 235 | getSkyframeExecutor(), skyKey, /*keepGoing=*/false, reporter); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 236 | assertThat(result.hasError()).isTrue(); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 237 | ErrorInfo errorInfo = result.getError(skyKey); |
| 238 | String errorMessage = errorInfo.getException().getMessage(); |
| 239 | assertThat(errorMessage).contains("Inconsistent filesystem operations"); |
| 240 | assertThat(errorMessage).contains(expectedMessage); |
| 241 | } |
| 242 | |
Janak Ramakrishnan | 063b488 | 2016-07-18 20:33:28 +0000 | [diff] [blame] | 243 | @SuppressWarnings("unchecked") // Cast of srcs attribute to Iterable<Label>. |
| 244 | @Test |
| 245 | public void testGlobOrderStable() throws Exception { |
| 246 | scratch.file("foo/BUILD", "sh_library(name = 'foo', srcs = glob(['**/*.txt']))"); |
| 247 | scratch.file("foo/b.txt"); |
| 248 | scratch.file("foo/c/c.txt"); |
| 249 | preparePackageLoading(rootDirectory); |
| 250 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
| 251 | PackageValue value = validPackage(skyKey); |
| 252 | assertThat( |
| 253 | (Iterable<Label>) |
| 254 | value |
| 255 | .getPackage() |
| 256 | .getTarget("foo") |
| 257 | .getAssociatedRule() |
| 258 | .getAttributeContainer() |
| 259 | .getAttr("srcs")) |
| 260 | .containsExactly( |
| 261 | Label.parseAbsoluteUnchecked("//foo:b.txt"), |
| 262 | Label.parseAbsoluteUnchecked("//foo:c/c.txt")) |
| 263 | .inOrder(); |
| 264 | scratch.file("foo/d.txt"); |
| 265 | getSkyframeExecutor() |
| 266 | .invalidateFilesUnderPathForTesting( |
| 267 | reporter, |
nharmata | b4060b6 | 2017-04-04 17:11:39 +0000 | [diff] [blame] | 268 | ModifiedFileSet.builder().modify(PathFragment.create("foo/d.txt")).build(), |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 269 | Root.fromPath(rootDirectory)); |
Janak Ramakrishnan | 063b488 | 2016-07-18 20:33:28 +0000 | [diff] [blame] | 270 | value = validPackage(skyKey); |
| 271 | assertThat( |
| 272 | (Iterable<Label>) |
| 273 | value |
| 274 | .getPackage() |
| 275 | .getTarget("foo") |
| 276 | .getAssociatedRule() |
| 277 | .getAttributeContainer() |
| 278 | .getAttr("srcs")) |
| 279 | .containsExactly( |
| 280 | Label.parseAbsoluteUnchecked("//foo:b.txt"), |
| 281 | Label.parseAbsoluteUnchecked("//foo:c/c.txt"), |
| 282 | Label.parseAbsoluteUnchecked("//foo:d.txt")) |
| 283 | .inOrder(); |
| 284 | } |
| 285 | |
Janak Ramakrishnan | 063b488 | 2016-07-18 20:33:28 +0000 | [diff] [blame] | 286 | @Test |
| 287 | public void testGlobOrderStableWithLegacyAndSkyframeComponents() throws Exception { |
| 288 | scratch.file("foo/BUILD", "sh_library(name = 'foo', srcs = glob(['*.txt']))"); |
| 289 | scratch.file("foo/b.txt"); |
| 290 | scratch.file("foo/a.config"); |
| 291 | preparePackageLoading(rootDirectory); |
| 292 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
Janak Ramakrishnan | ffbc28a | 2017-02-13 22:51:45 +0000 | [diff] [blame] | 293 | assertSrcs(validPackage(skyKey), "foo", "//foo:b.txt"); |
Janak Ramakrishnan | 063b488 | 2016-07-18 20:33:28 +0000 | [diff] [blame] | 294 | scratch.overwriteFile( |
| 295 | "foo/BUILD", "sh_library(name = 'foo', srcs = glob(['*.txt', '*.config']))"); |
| 296 | getSkyframeExecutor() |
| 297 | .invalidateFilesUnderPathForTesting( |
| 298 | reporter, |
nharmata | b4060b6 | 2017-04-04 17:11:39 +0000 | [diff] [blame] | 299 | ModifiedFileSet.builder().modify(PathFragment.create("foo/BUILD")).build(), |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 300 | Root.fromPath(rootDirectory)); |
Janak Ramakrishnan | ffbc28a | 2017-02-13 22:51:45 +0000 | [diff] [blame] | 301 | assertSrcs(validPackage(skyKey), "foo", "//foo:a.config", "//foo:b.txt"); |
Janak Ramakrishnan | 063b488 | 2016-07-18 20:33:28 +0000 | [diff] [blame] | 302 | scratch.overwriteFile( |
| 303 | "foo/BUILD", "sh_library(name = 'foo', srcs = glob(['*.txt', '*.config'])) # comment"); |
| 304 | getSkyframeExecutor() |
| 305 | .invalidateFilesUnderPathForTesting( |
| 306 | reporter, |
nharmata | b4060b6 | 2017-04-04 17:11:39 +0000 | [diff] [blame] | 307 | ModifiedFileSet.builder().modify(PathFragment.create("foo/BUILD")).build(), |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 308 | Root.fromPath(rootDirectory)); |
Janak Ramakrishnan | ffbc28a | 2017-02-13 22:51:45 +0000 | [diff] [blame] | 309 | assertSrcs(validPackage(skyKey), "foo", "//foo:a.config", "//foo:b.txt"); |
Nathan Harmata | 44e1e3a | 2016-08-23 21:22:17 +0000 | [diff] [blame] | 310 | getSkyframeExecutor().resetEvaluator(); |
Janak Ramakrishnan | 326c698 | 2016-09-27 14:58:26 +0000 | [diff] [blame] | 311 | PackageCacheOptions packageCacheOptions = Options.getDefaults(PackageCacheOptions.class); |
| 312 | packageCacheOptions.defaultVisibility = ConstantRuleVisibility.PUBLIC; |
| 313 | packageCacheOptions.showLoadingProgress = true; |
| 314 | packageCacheOptions.globbingThreads = 7; |
Klaus Aehlig | 6f33a1c | 2016-09-13 16:46:10 +0000 | [diff] [blame] | 315 | getSkyframeExecutor() |
| 316 | .preparePackageLoading( |
John Cater | e0d1d0e | 2017-11-28 20:47:41 -0800 | [diff] [blame] | 317 | new PathPackageLocator( |
| 318 | outputBase, |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 319 | ImmutableList.of(Root.fromPath(rootDirectory)), |
John Cater | e0d1d0e | 2017-11-28 20:47:41 -0800 | [diff] [blame] | 320 | BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY), |
Janak Ramakrishnan | 326c698 | 2016-09-27 14:58:26 +0000 | [diff] [blame] | 321 | packageCacheOptions, |
brandjon | 7dc3416 | 2017-04-27 18:34:33 +0200 | [diff] [blame] | 322 | Options.getDefaults(SkylarkSemanticsOptions.class), |
laurentlb | 99958b8 | 2018-08-20 06:24:23 -0700 | [diff] [blame^] | 323 | "", |
Klaus Aehlig | 6f33a1c | 2016-09-13 16:46:10 +0000 | [diff] [blame] | 324 | UUID.randomUUID(), |
Klaus Aehlig | 03b9cfd | 2016-09-14 13:14:39 +0000 | [diff] [blame] | 325 | ImmutableMap.<String, String>of(), |
Klaus Aehlig | 6f33a1c | 2016-09-13 16:46:10 +0000 | [diff] [blame] | 326 | tsgm); |
juliexxia | 651797f | 2018-08-01 11:45:13 -0700 | [diff] [blame] | 327 | getSkyframeExecutor().setActionEnv(ImmutableMap.<String, String>of()); |
Janak Ramakrishnan | ffbc28a | 2017-02-13 22:51:45 +0000 | [diff] [blame] | 328 | assertSrcs(validPackage(skyKey), "foo", "//foo:a.config", "//foo:b.txt"); |
Janak Ramakrishnan | 063b488 | 2016-07-18 20:33:28 +0000 | [diff] [blame] | 329 | } |
| 330 | |
Janak Ramakrishnan | ffbc28a | 2017-02-13 22:51:45 +0000 | [diff] [blame] | 331 | /** |
| 332 | * Tests that a symlink to a file outside of the package root is handled consistently. If the |
| 333 | * default behavior of Bazel was changed from {@code |
| 334 | * ExternalFileAction#DEPEND_ON_EXTERNAL_PKG_FOR_EXTERNAL_REPO_PATHS} to {@code |
| 335 | * ExternalFileAction#ASSUME_NON_EXISTENT_AND_IMMUTABLE_FOR_EXTERNAL_PATHS} then foo/link.sh |
| 336 | * should no longer appear in the srcs of //foo:foo. However, either way the srcs should be the |
| 337 | * same independent of the evaluation being incremental or clean. |
| 338 | */ |
| 339 | @Test |
| 340 | public void testGlobWithExternalSymlink() throws Exception { |
| 341 | scratch.file( |
| 342 | "foo/BUILD", |
| 343 | "sh_library(name = 'foo', srcs = glob(['*.sh']))", |
| 344 | "sh_library(name = 'bar', srcs = glob(['link.sh']))", |
| 345 | "sh_library(name = 'baz', srcs = glob(['subdir_link/*.txt']))"); |
| 346 | scratch.file("foo/ordinary.sh"); |
| 347 | Path externalTarget = scratch.file("../ops/target.txt"); |
| 348 | FileSystemUtils.ensureSymbolicLink(scratch.resolve("foo/link.sh"), externalTarget); |
| 349 | FileSystemUtils.ensureSymbolicLink( |
| 350 | scratch.resolve("foo/subdir_link"), externalTarget.getParentDirectory()); |
| 351 | preparePackageLoading(rootDirectory); |
| 352 | SkyKey fooKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
| 353 | PackageValue fooValue = validPackage(fooKey); |
| 354 | assertSrcs(fooValue, "foo", "//foo:link.sh", "//foo:ordinary.sh"); |
| 355 | assertSrcs(fooValue, "bar", "//foo:link.sh"); |
| 356 | assertSrcs(fooValue, "baz", "//foo:subdir_link/target.txt"); |
| 357 | scratch.overwriteFile( |
| 358 | "foo/BUILD", |
| 359 | "sh_library(name = 'foo', srcs = glob(['*.sh'])) #comment", |
| 360 | "sh_library(name = 'bar', srcs = glob(['link.sh']))", |
| 361 | "sh_library(name = 'baz', srcs = glob(['subdir_link/*.txt']))"); |
| 362 | getSkyframeExecutor() |
| 363 | .invalidateFilesUnderPathForTesting( |
| 364 | reporter, |
nharmata | b4060b6 | 2017-04-04 17:11:39 +0000 | [diff] [blame] | 365 | ModifiedFileSet.builder().modify(PathFragment.create("foo/BUILD")).build(), |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 366 | Root.fromPath(rootDirectory)); |
Janak Ramakrishnan | ffbc28a | 2017-02-13 22:51:45 +0000 | [diff] [blame] | 367 | PackageValue fooValue2 = validPackage(fooKey); |
| 368 | assertThat(fooValue2).isNotEqualTo(fooValue); |
| 369 | assertSrcs(fooValue2, "foo", "//foo:link.sh", "//foo:ordinary.sh"); |
| 370 | assertSrcs(fooValue2, "bar", "//foo:link.sh"); |
| 371 | assertSrcs(fooValue2, "baz", "//foo:subdir_link/target.txt"); |
| 372 | } |
| 373 | |
| 374 | private static void assertSrcs(PackageValue value, String targetName, String... expected) |
| 375 | throws NoSuchTargetException { |
| 376 | List<Label> expectedLabels = new ArrayList<>(); |
| 377 | for (String item : expected) { |
| 378 | expectedLabels.add(Label.parseAbsoluteUnchecked(item)); |
| 379 | } |
| 380 | assertThat(getSrcs(value, targetName)).containsExactlyElementsIn(expectedLabels).inOrder(); |
| 381 | } |
| 382 | |
| 383 | @SuppressWarnings("unchecked") |
| 384 | private static Iterable<Label> getSrcs(PackageValue packageValue, String targetName) |
| 385 | throws NoSuchTargetException { |
| 386 | return (Iterable<Label>) |
| 387 | packageValue |
| 388 | .getPackage() |
| 389 | .getTarget(targetName) |
| 390 | .getAssociatedRule() |
| 391 | .getAttributeContainer() |
| 392 | .getAttr("srcs"); |
| 393 | } |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 394 | @Test |
Janak Ramakrishnan | 4e2e408 | 2017-01-06 06:28:45 +0000 | [diff] [blame] | 395 | public void testOneNewElementInMultipleGlob() throws Exception { |
| 396 | scratch.file( |
| 397 | "foo/BUILD", |
| 398 | "sh_library(name = 'foo', srcs = glob(['*.sh']))", |
| 399 | "sh_library(name = 'bar', srcs = glob(['*.sh', '*.txt']))"); |
| 400 | preparePackageLoading(rootDirectory); |
| 401 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
| 402 | PackageValue value = validPackage(skyKey); |
| 403 | scratch.file("foo/irrelevent"); |
| 404 | getSkyframeExecutor() |
| 405 | .invalidateFilesUnderPathForTesting( |
| 406 | reporter, |
nharmata | b4060b6 | 2017-04-04 17:11:39 +0000 | [diff] [blame] | 407 | ModifiedFileSet.builder().modify(PathFragment.create("foo/irrelevant")).build(), |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 408 | Root.fromPath(rootDirectory)); |
Janak Ramakrishnan | 4e2e408 | 2017-01-06 06:28:45 +0000 | [diff] [blame] | 409 | assertThat(validPackage(skyKey)).isSameAs(value); |
| 410 | } |
| 411 | |
| 412 | @Test |
| 413 | public void testNoNewElementInMultipleGlob() throws Exception { |
| 414 | scratch.file( |
| 415 | "foo/BUILD", |
| 416 | "sh_library(name = 'foo', srcs = glob(['*.sh', '*.txt']))", |
| 417 | "sh_library(name = 'bar', srcs = glob(['*.sh', '*.txt']))"); |
| 418 | preparePackageLoading(rootDirectory); |
| 419 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
| 420 | PackageValue value = validPackage(skyKey); |
| 421 | scratch.file("foo/irrelevent"); |
| 422 | getSkyframeExecutor() |
| 423 | .invalidateFilesUnderPathForTesting( |
| 424 | reporter, |
nharmata | b4060b6 | 2017-04-04 17:11:39 +0000 | [diff] [blame] | 425 | ModifiedFileSet.builder().modify(PathFragment.create("foo/irrelevant")).build(), |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 426 | Root.fromPath(rootDirectory)); |
Janak Ramakrishnan | 4e2e408 | 2017-01-06 06:28:45 +0000 | [diff] [blame] | 427 | assertThat(validPackage(skyKey)).isSameAs(value); |
| 428 | } |
| 429 | |
| 430 | @Test |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 431 | public void testTransitiveSkylarkDepsStoredInPackage() throws Exception { |
| 432 | scratch.file("foo/BUILD", |
laurentlb | 5ddd804 | 2017-11-30 12:03:31 -0800 | [diff] [blame] | 433 | "load('//bar:ext.bzl', 'a')"); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 434 | scratch.file("bar/BUILD"); |
| 435 | scratch.file("bar/ext.bzl", |
laurentlb | 5ddd804 | 2017-11-30 12:03:31 -0800 | [diff] [blame] | 436 | "load('//baz:ext.bzl', 'b')", |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 437 | "a = b"); |
| 438 | scratch.file("baz/BUILD"); |
| 439 | scratch.file("baz/ext.bzl", |
| 440 | "b = 1"); |
| 441 | scratch.file("qux/BUILD"); |
| 442 | scratch.file("qux/ext.bzl", |
| 443 | "c = 1"); |
| 444 | |
Ulf Adams | c73051c6 | 2016-03-23 09:18:13 +0000 | [diff] [blame] | 445 | preparePackageLoading(rootDirectory); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 446 | |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 447 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 448 | PackageValue value = validPackage(skyKey); |
dannark | 90e2b4b | 2018-06-27 13:35:04 -0700 | [diff] [blame] | 449 | assertThat(value.getPackage().getSkylarkFileDependencies()) |
| 450 | .containsExactly( |
| 451 | Label.parseAbsolute("//bar:ext.bzl", ImmutableMap.of()), |
| 452 | Label.parseAbsolute("//baz:ext.bzl", ImmutableMap.of())); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 453 | |
| 454 | scratch.overwriteFile("bar/ext.bzl", |
laurentlb | 5ddd804 | 2017-11-30 12:03:31 -0800 | [diff] [blame] | 455 | "load('//qux:ext.bzl', 'c')", |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 456 | "a = c"); |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 457 | getSkyframeExecutor() |
| 458 | .invalidateFilesUnderPathForTesting( |
| 459 | reporter, |
| 460 | ModifiedFileSet.builder().modify(PathFragment.create("bar/ext.bzl")).build(), |
| 461 | Root.fromPath(rootDirectory)); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 462 | |
| 463 | value = validPackage(skyKey); |
dannark | 90e2b4b | 2018-06-27 13:35:04 -0700 | [diff] [blame] | 464 | assertThat(value.getPackage().getSkylarkFileDependencies()) |
| 465 | .containsExactly( |
| 466 | Label.parseAbsolute("//bar:ext.bzl", ImmutableMap.of()), |
| 467 | Label.parseAbsolute("//qux:ext.bzl", ImmutableMap.of())); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 468 | } |
| 469 | |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 470 | @Test |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 471 | public void testNonExistingSkylarkExtension() throws Exception { |
| 472 | reporter.removeHandler(failFastHandler); |
| 473 | scratch.file("test/skylark/BUILD", |
laurentlb | 5ddd804 | 2017-11-30 12:03:31 -0800 | [diff] [blame] | 474 | "load('//test/skylark:bad_extension.bzl', 'some_symbol')", |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 475 | "genrule(name = gr,", |
| 476 | " outs = ['out.txt'],", |
| 477 | " cmd = 'echo hello >@')"); |
| 478 | invalidatePackages(); |
| 479 | |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 480 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//test/skylark")); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 481 | EvaluationResult<PackageValue> result = SkyframeExecutorTestUtils.evaluate( |
| 482 | getSkyframeExecutor(), skyKey, /*keepGoing=*/false, reporter); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 483 | assertThat(result.hasError()).isTrue(); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 484 | ErrorInfo errorInfo = result.getError(skyKey); |
John Field | 1ea7fc3 | 2015-12-22 19:37:19 +0000 | [diff] [blame] | 485 | String expectedMsg = "error loading package 'test/skylark': " |
| 486 | + "Extension file not found. Unable to load file '//test/skylark:bad_extension.bzl': " |
| 487 | + "file doesn't exist or isn't a file"; |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 488 | assertThat(errorInfo.getException()) |
John Field | 1ea7fc3 | 2015-12-22 19:37:19 +0000 | [diff] [blame] | 489 | .hasMessage(expectedMsg); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 490 | } |
| 491 | |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 492 | @Test |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 493 | public void testNonExistingSkylarkExtensionFromExtension() throws Exception { |
| 494 | reporter.removeHandler(failFastHandler); |
| 495 | scratch.file("test/skylark/extension.bzl", |
laurentlb | 5ddd804 | 2017-11-30 12:03:31 -0800 | [diff] [blame] | 496 | "load('//test/skylark:bad_extension.bzl', 'some_symbol')", |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 497 | "a = 'a'"); |
| 498 | scratch.file("test/skylark/BUILD", |
laurentlb | 5ddd804 | 2017-11-30 12:03:31 -0800 | [diff] [blame] | 499 | "load('//test/skylark:extension.bzl', 'a')", |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 500 | "genrule(name = gr,", |
| 501 | " outs = ['out.txt'],", |
| 502 | " cmd = 'echo hello >@')"); |
| 503 | invalidatePackages(); |
| 504 | |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 505 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//test/skylark")); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 506 | EvaluationResult<PackageValue> result = SkyframeExecutorTestUtils.evaluate( |
| 507 | getSkyframeExecutor(), skyKey, /*keepGoing=*/false, reporter); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 508 | assertThat(result.hasError()).isTrue(); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 509 | ErrorInfo errorInfo = result.getError(skyKey); |
| 510 | assertThat(errorInfo.getException()) |
| 511 | .hasMessage("error loading package 'test/skylark': Extension file not found. " |
| 512 | + "Unable to load file '//test/skylark:bad_extension.bzl': " |
| 513 | + "file doesn't exist or isn't a file"); |
| 514 | } |
| 515 | |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 516 | @Test |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 517 | public void testSymlinkCycleWithSkylarkExtension() throws Exception { |
| 518 | reporter.removeHandler(failFastHandler); |
| 519 | Path extensionFilePath = scratch.resolve("/workspace/test/skylark/extension.bzl"); |
nharmata | b4060b6 | 2017-04-04 17:11:39 +0000 | [diff] [blame] | 520 | FileSystemUtils.ensureSymbolicLink(extensionFilePath, PathFragment.create("extension.bzl")); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 521 | scratch.file("test/skylark/BUILD", |
laurentlb | 5ddd804 | 2017-11-30 12:03:31 -0800 | [diff] [blame] | 522 | "load('//test/skylark:extension.bzl', 'a')", |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 523 | "genrule(name = gr,", |
| 524 | " outs = ['out.txt'],", |
| 525 | " cmd = 'echo hello >@')"); |
| 526 | invalidatePackages(); |
| 527 | |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 528 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//test/skylark")); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 529 | EvaluationResult<PackageValue> result = SkyframeExecutorTestUtils.evaluate( |
| 530 | getSkyframeExecutor(), skyKey, /*keepGoing=*/false, reporter); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 531 | assertThat(result.hasError()).isTrue(); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 532 | ErrorInfo errorInfo = result.getError(skyKey); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 533 | assertThat(errorInfo.getRootCauseOfException()).isEqualTo(skyKey); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 534 | assertThat(errorInfo.getException()) |
| 535 | .hasMessage( |
| 536 | "error loading package 'test/skylark': Encountered error while reading extension " |
| 537 | + "file 'test/skylark/extension.bzl': Symlink cycle"); |
| 538 | } |
| 539 | |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 540 | @Test |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 541 | public void testIOErrorLookingForSubpackageForLabelIsHandled() throws Exception { |
| 542 | reporter.removeHandler(failFastHandler); |
| 543 | scratch.file("foo/BUILD", |
| 544 | "sh_library(name = 'foo', srcs = ['bar/baz.sh'])"); |
| 545 | Path barBuildFile = scratch.file("foo/bar/BUILD"); |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 546 | fs.stubStatError(barBuildFile, new IOException("nope")); |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 547 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 548 | EvaluationResult<PackageValue> result = SkyframeExecutorTestUtils.evaluate( |
| 549 | getSkyframeExecutor(), skyKey, /*keepGoing=*/false, reporter); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 550 | assertThat(result.hasError()).isTrue(); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 551 | assertContainsEvent("nope"); |
| 552 | } |
| 553 | |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 554 | @Test |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 555 | public void testLoadRelativePath() throws Exception { |
laurentlb | 5ddd804 | 2017-11-30 12:03:31 -0800 | [diff] [blame] | 556 | scratch.file("pkg/BUILD", "load(':ext.bzl', 'a')"); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 557 | scratch.file("pkg/ext.bzl", "a = 1"); |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 558 | validPackage(PackageValue.key(PackageIdentifier.parse("@//pkg"))); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 559 | } |
| 560 | |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 561 | @Test |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 562 | public void testLoadAbsolutePath() throws Exception { |
| 563 | scratch.file("pkg1/BUILD"); |
| 564 | scratch.file("pkg2/BUILD", |
laurentlb | 5ddd804 | 2017-11-30 12:03:31 -0800 | [diff] [blame] | 565 | "load('//pkg1:ext.bzl', 'a')"); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 566 | scratch.file("pkg1/ext.bzl", "a = 1"); |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 567 | validPackage(PackageValue.key(PackageIdentifier.parse("@//pkg2"))); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 568 | } |
| 569 | |
Florian Weikert | 92b2236 | 2015-12-03 10:17:18 +0000 | [diff] [blame] | 570 | @Test |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 571 | public void testBadWorkspaceFile() throws Exception { |
| 572 | Path workspacePath = scratch.overwriteFile("WORKSPACE", "junk"); |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 573 | SkyKey skyKey = PackageValue.key(PackageIdentifier.createInMainRepo("external")); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 574 | getSkyframeExecutor() |
| 575 | .invalidate( |
| 576 | Predicates.equalTo( |
shahan | 602cc85 | 2018-06-06 20:09:57 -0700 | [diff] [blame] | 577 | FileStateValue.key( |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 578 | RootedPath.toRootedPath( |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 579 | Root.fromPath(workspacePath.getParentDirectory()), |
nharmata | b4060b6 | 2017-04-04 17:11:39 +0000 | [diff] [blame] | 580 | PathFragment.create(workspacePath.getBaseName()))))); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 581 | |
| 582 | reporter.removeHandler(failFastHandler); |
| 583 | EvaluationResult<PackageValue> result = |
| 584 | SkyframeExecutorTestUtils.evaluate( |
| 585 | getSkyframeExecutor(), skyKey, /*keepGoing=*/ false, reporter); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 586 | assertThat(result.hasError()).isFalse(); |
| 587 | assertThat(result.get(skyKey).getPackage().containsErrors()).isTrue(); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 588 | } |
| 589 | |
Nathan Harmata | 2022ad8 | 2016-02-22 23:04:14 +0000 | [diff] [blame] | 590 | // Regression test for the two ugly consequences of a bug where GlobFunction incorrectly matched |
| 591 | // dangling symlinks. |
| 592 | @Test |
| 593 | public void testIncrementalSkyframeHybridGlobbingOnDanglingSymlink() throws Exception { |
| 594 | Path packageDirPath = scratch.file("foo/BUILD", |
| 595 | "exports_files(glob(['*.txt']))").getParentDirectory(); |
| 596 | scratch.file("foo/existing.txt"); |
| 597 | FileSystemUtils.ensureSymbolicLink(packageDirPath.getChild("dangling.txt"), "nope"); |
| 598 | |
Ulf Adams | c73051c6 | 2016-03-23 09:18:13 +0000 | [diff] [blame] | 599 | preparePackageLoading(rootDirectory); |
Nathan Harmata | 2022ad8 | 2016-02-22 23:04:14 +0000 | [diff] [blame] | 600 | |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 601 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
Nathan Harmata | 2022ad8 | 2016-02-22 23:04:14 +0000 | [diff] [blame] | 602 | PackageValue value = validPackage(skyKey); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 603 | assertThat(value.getPackage().containsErrors()).isFalse(); |
Nathan Harmata | 2022ad8 | 2016-02-22 23:04:14 +0000 | [diff] [blame] | 604 | assertThat(value.getPackage().getTarget("existing.txt").getName()).isEqualTo("existing.txt"); |
| 605 | try { |
| 606 | value.getPackage().getTarget("dangling.txt"); |
| 607 | fail(); |
| 608 | } catch (NoSuchTargetException expected) { |
| 609 | } |
| 610 | |
| 611 | scratch.overwriteFile("foo/BUILD", |
Laurent Le Brun | b639ca8 | 2017-01-17 11:18:23 +0000 | [diff] [blame] | 612 | "exports_files(glob(['*.txt']))", |
Nathan Harmata | 2022ad8 | 2016-02-22 23:04:14 +0000 | [diff] [blame] | 613 | "#some-irrelevant-comment"); |
| 614 | |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 615 | getSkyframeExecutor() |
| 616 | .invalidateFilesUnderPathForTesting( |
| 617 | reporter, |
| 618 | ModifiedFileSet.builder().modify(PathFragment.create("foo/BUILD")).build(), |
| 619 | Root.fromPath(rootDirectory)); |
Nathan Harmata | 2022ad8 | 2016-02-22 23:04:14 +0000 | [diff] [blame] | 620 | |
| 621 | value = validPackage(skyKey); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 622 | assertThat(value.getPackage().containsErrors()).isFalse(); |
Nathan Harmata | 2022ad8 | 2016-02-22 23:04:14 +0000 | [diff] [blame] | 623 | assertThat(value.getPackage().getTarget("existing.txt").getName()).isEqualTo("existing.txt"); |
| 624 | try { |
| 625 | value.getPackage().getTarget("dangling.txt"); |
| 626 | fail(); |
| 627 | } catch (NoSuchTargetException expected) { |
| 628 | // One consequence of the bug was that dangling symlinks were matched by globs evaluated by |
| 629 | // Skyframe globbing, meaning there would incorrectly be corresponding targets in packages |
| 630 | // that had skyframe cache hits during skyframe hybrid globbing. |
| 631 | } |
| 632 | |
| 633 | scratch.file("foo/nope"); |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 634 | getSkyframeExecutor() |
| 635 | .invalidateFilesUnderPathForTesting( |
| 636 | reporter, |
| 637 | ModifiedFileSet.builder().modify(PathFragment.create("foo/nope")).build(), |
| 638 | Root.fromPath(rootDirectory)); |
Nathan Harmata | 2022ad8 | 2016-02-22 23:04:14 +0000 | [diff] [blame] | 639 | |
| 640 | PackageValue newValue = validPackage(skyKey); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 641 | assertThat(newValue.getPackage().containsErrors()).isFalse(); |
Nathan Harmata | 2022ad8 | 2016-02-22 23:04:14 +0000 | [diff] [blame] | 642 | assertThat(newValue.getPackage().getTarget("existing.txt").getName()).isEqualTo("existing.txt"); |
| 643 | // Another consequence of the bug is that change pruning would incorrectly cut off changes that |
| 644 | // caused a dangling symlink potentially matched by a glob to come into existence. |
| 645 | assertThat(newValue.getPackage().getTarget("dangling.txt").getName()).isEqualTo("dangling.txt"); |
| 646 | assertThat(newValue.getPackage()).isNotSameAs(value.getPackage()); |
| 647 | } |
| 648 | |
Nathan Harmata | 86c319e | 2016-02-25 01:12:22 +0000 | [diff] [blame] | 649 | // Regression test for Skyframe globbing incorrectly matching the package's directory path on |
| 650 | // 'glob(['**'], exclude_directories = 0)'. We test for this directly by triggering |
| 651 | // hybrid globbing (gives coverage for both legacy globbing and skyframe globbing). |
| 652 | @Test |
| 653 | public void testRecursiveGlobNeverMatchesPackageDirectory() throws Exception { |
| 654 | scratch.file("foo/BUILD", |
| 655 | "[sh_library(name = x + '-matched') for x in glob(['**'], exclude_directories = 0)]"); |
| 656 | scratch.file("foo/bar"); |
| 657 | |
Ulf Adams | c73051c6 | 2016-03-23 09:18:13 +0000 | [diff] [blame] | 658 | preparePackageLoading(rootDirectory); |
Nathan Harmata | 86c319e | 2016-02-25 01:12:22 +0000 | [diff] [blame] | 659 | |
Brian Silverman | d7d6d62 | 2016-03-17 09:53:39 +0000 | [diff] [blame] | 660 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
Nathan Harmata | 86c319e | 2016-02-25 01:12:22 +0000 | [diff] [blame] | 661 | PackageValue value = validPackage(skyKey); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 662 | assertThat(value.getPackage().containsErrors()).isFalse(); |
Nathan Harmata | 86c319e | 2016-02-25 01:12:22 +0000 | [diff] [blame] | 663 | assertThat(value.getPackage().getTarget("bar-matched").getName()).isEqualTo("bar-matched"); |
| 664 | try { |
| 665 | value.getPackage().getTarget("-matched"); |
| 666 | fail(); |
| 667 | } catch (NoSuchTargetException expected) { |
| 668 | } |
| 669 | |
| 670 | scratch.overwriteFile("foo/BUILD", |
| 671 | "[sh_library(name = x + '-matched') for x in glob(['**'], exclude_directories = 0)]", |
| 672 | "#some-irrelevant-comment"); |
tomlu | ee6a686 | 2018-01-17 14:36:26 -0800 | [diff] [blame] | 673 | getSkyframeExecutor() |
| 674 | .invalidateFilesUnderPathForTesting( |
| 675 | reporter, |
| 676 | ModifiedFileSet.builder().modify(PathFragment.create("foo/BUILD")).build(), |
| 677 | Root.fromPath(rootDirectory)); |
Nathan Harmata | 86c319e | 2016-02-25 01:12:22 +0000 | [diff] [blame] | 678 | |
| 679 | value = validPackage(skyKey); |
lberki | aea56b3 | 2017-05-30 12:35:33 +0200 | [diff] [blame] | 680 | assertThat(value.getPackage().containsErrors()).isFalse(); |
Nathan Harmata | 86c319e | 2016-02-25 01:12:22 +0000 | [diff] [blame] | 681 | assertThat(value.getPackage().getTarget("bar-matched").getName()).isEqualTo("bar-matched"); |
| 682 | try { |
| 683 | value.getPackage().getTarget("-matched"); |
| 684 | fail(); |
| 685 | } catch (NoSuchTargetException expected) { |
| 686 | } |
| 687 | } |
| 688 | |
nharmata | ff688bf | 2017-06-07 17:03:52 -0400 | [diff] [blame] | 689 | @Test |
| 690 | public void testPackageLoadingErrorOnIOExceptionReadingBuildFile() throws Exception { |
| 691 | Path fooBuildFilePath = scratch.file("foo/BUILD"); |
| 692 | IOException exn = new IOException("nope"); |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 693 | fs.throwExceptionOnGetInputStream(fooBuildFilePath, exn); |
nharmata | ff688bf | 2017-06-07 17:03:52 -0400 | [diff] [blame] | 694 | |
| 695 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
| 696 | EvaluationResult<PackageValue> result = SkyframeExecutorTestUtils.evaluate( |
| 697 | getSkyframeExecutor(), skyKey, /*keepGoing=*/false, reporter); |
| 698 | assertThat(result.hasError()).isTrue(); |
| 699 | ErrorInfo errorInfo = result.getError(skyKey); |
| 700 | String errorMessage = errorInfo.getException().getMessage(); |
| 701 | assertThat(errorMessage).contains("nope"); |
| 702 | assertThat(errorInfo.getException()).isInstanceOf(NoSuchPackageException.class); |
nharmata | 351efff | 2018-03-30 15:04:38 -0700 | [diff] [blame] | 703 | assertThat(errorInfo.getException()).hasCauseThat().isInstanceOf(IOException.class); |
nharmata | ff688bf | 2017-06-07 17:03:52 -0400 | [diff] [blame] | 704 | } |
| 705 | |
nharmata | bea67e9 | 2017-06-16 00:26:27 +0200 | [diff] [blame] | 706 | @Test |
| 707 | public void testPackageLoadingErrorOnIOExceptionReadingBzlFile() throws Exception { |
| 708 | scratch.file("foo/BUILD", "load('//foo:bzl.bzl', 'x')"); |
| 709 | Path fooBzlFilePath = scratch.file("foo/bzl.bzl"); |
| 710 | IOException exn = new IOException("nope"); |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 711 | fs.throwExceptionOnGetInputStream(fooBzlFilePath, exn); |
nharmata | bea67e9 | 2017-06-16 00:26:27 +0200 | [diff] [blame] | 712 | |
| 713 | SkyKey skyKey = PackageValue.key(PackageIdentifier.parse("@//foo")); |
| 714 | EvaluationResult<PackageValue> result = SkyframeExecutorTestUtils.evaluate( |
| 715 | getSkyframeExecutor(), skyKey, /*keepGoing=*/false, reporter); |
| 716 | assertThat(result.hasError()).isTrue(); |
| 717 | ErrorInfo errorInfo = result.getError(skyKey); |
| 718 | String errorMessage = errorInfo.getException().getMessage(); |
| 719 | assertThat(errorMessage).contains("nope"); |
| 720 | assertThat(errorInfo.getException()).isInstanceOf(NoSuchPackageException.class); |
nharmata | 351efff | 2018-03-30 15:04:38 -0700 | [diff] [blame] | 721 | assertThat(errorInfo.getException()).hasCauseThat().isInstanceOf(IOException.class); |
nharmata | bea67e9 | 2017-06-16 00:26:27 +0200 | [diff] [blame] | 722 | } |
| 723 | |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 724 | private static class CustomInMemoryFs extends InMemoryFileSystem { |
Googler | c804c66 | 2016-12-01 16:53:28 +0000 | [diff] [blame] | 725 | private abstract static class FileStatusOrException { |
| 726 | abstract FileStatus get() throws IOException; |
| 727 | |
| 728 | private static class ExceptionImpl extends FileStatusOrException { |
| 729 | private final IOException exn; |
| 730 | |
| 731 | private ExceptionImpl(IOException exn) { |
| 732 | this.exn = exn; |
| 733 | } |
| 734 | |
| 735 | @Override |
| 736 | FileStatus get() throws IOException { |
| 737 | throw exn; |
| 738 | } |
| 739 | } |
| 740 | |
| 741 | private static class FileStatusImpl extends FileStatusOrException { |
| 742 | |
| 743 | @Nullable |
| 744 | private final FileStatus fileStatus; |
| 745 | |
| 746 | private FileStatusImpl(@Nullable FileStatus fileStatus) { |
| 747 | this.fileStatus = fileStatus; |
| 748 | } |
| 749 | |
| 750 | @Override |
| 751 | @Nullable |
| 752 | FileStatus get() { |
| 753 | return fileStatus; |
| 754 | } |
| 755 | } |
| 756 | } |
| 757 | |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 758 | private final Map<Path, FileStatusOrException> stubbedStats = Maps.newHashMap(); |
| 759 | private final Set<Path> makeUnreadableAfterReaddir = Sets.newHashSet(); |
| 760 | private final Map<Path, IOException> pathsToErrorOnGetInputStream = Maps.newHashMap(); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 761 | |
| 762 | public CustomInMemoryFs(ManualClock manualClock) { |
ccalvarin | c9efd06 | 2018-07-27 12:46:46 -0700 | [diff] [blame] | 763 | super(manualClock); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 764 | } |
| 765 | |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 766 | public void stubStat(Path path, @Nullable FileStatus stubbedResult) { |
Googler | c804c66 | 2016-12-01 16:53:28 +0000 | [diff] [blame] | 767 | stubbedStats.put(path, new FileStatusOrException.FileStatusImpl(stubbedResult)); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 768 | } |
| 769 | |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 770 | public void stubStatError(Path path, IOException stubbedResult) { |
Googler | c804c66 | 2016-12-01 16:53:28 +0000 | [diff] [blame] | 771 | stubbedStats.put(path, new FileStatusOrException.ExceptionImpl(stubbedResult)); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 772 | } |
| 773 | |
| 774 | @Override |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 775 | public FileStatus stat(Path path, boolean followSymlinks) throws IOException { |
Googler | c804c66 | 2016-12-01 16:53:28 +0000 | [diff] [blame] | 776 | if (stubbedStats.containsKey(path)) { |
| 777 | return stubbedStats.get(path).get(); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 778 | } |
Googler | c804c66 | 2016-12-01 16:53:28 +0000 | [diff] [blame] | 779 | return super.stat(path, followSymlinks); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 780 | } |
| 781 | |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 782 | public void scheduleMakeUnreadableAfterReaddir(Path path) { |
Googler | c804c66 | 2016-12-01 16:53:28 +0000 | [diff] [blame] | 783 | makeUnreadableAfterReaddir.add(path); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 784 | } |
| 785 | |
| 786 | @Override |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 787 | public Collection<Dirent> readdir(Path path, boolean followSymlinks) throws IOException { |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 788 | Collection<Dirent> result = super.readdir(path, followSymlinks); |
Googler | c804c66 | 2016-12-01 16:53:28 +0000 | [diff] [blame] | 789 | if (makeUnreadableAfterReaddir.contains(path)) { |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 790 | path.setReadable(false); |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 791 | } |
| 792 | return result; |
| 793 | } |
nharmata | ff688bf | 2017-06-07 17:03:52 -0400 | [diff] [blame] | 794 | |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 795 | public void throwExceptionOnGetInputStream(Path path, IOException exn) { |
nharmata | ff688bf | 2017-06-07 17:03:52 -0400 | [diff] [blame] | 796 | pathsToErrorOnGetInputStream.put(path, exn); |
| 797 | } |
| 798 | |
| 799 | @Override |
aehlig | c801c39 | 2017-12-19 07:12:25 -0800 | [diff] [blame] | 800 | protected InputStream getInputStream(Path path) throws IOException { |
nharmata | ff688bf | 2017-06-07 17:03:52 -0400 | [diff] [blame] | 801 | IOException exnToThrow = pathsToErrorOnGetInputStream.get(path); |
| 802 | if (exnToThrow != null) { |
| 803 | throw exnToThrow; |
| 804 | } |
| 805 | return super.getInputStream(path); |
| 806 | } |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 807 | } |
Kristina Chodorow | 335f067 | 2015-11-16 23:19:13 +0000 | [diff] [blame] | 808 | } |