aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google
diff options
context:
space:
mode:
authorGravatar nharmata <nharmata@google.com>2017-12-05 09:27:45 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-12-05 09:29:47 -0800
commite4eb23fe5512760b0e4a80c19a98f43875051fb1 (patch)
tree65bf81551ea6410918c8a88af7ac4cb466b7437a /src/test/java/com/google
parent97facf3aee6332cdb5b6cf51f700f3efe1e6bf45 (diff)
Automated rollback of commit d0f06a6e4b61adc39bf5e1cfbae39501a89dc8e3.
RELNOTES: None PiperOrigin-RevId: 177965330
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java3
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java3
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java3
-rw-r--r--src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java4
-rw-r--r--src/test/java/com/google/devtools/build/lib/pkgcache/BuildFileModificationTest.java4
-rw-r--r--src/test/java/com/google/devtools/build/lib/pkgcache/IncrementalLoadingTest.java3
-rw-r--r--src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java3
-rw-r--r--src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java4
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java6
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java6
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/GlobFunctionTest.java6
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java17
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionSmartNegationTest.java74
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java6
14 files changed, 104 insertions, 38 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java
index 5b81290312..282a3fa7e3 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java
@@ -175,7 +175,8 @@ public abstract class AnalysisTestCase extends FoundationTestCase {
ImmutableList.of(),
analysisMock.getSkyFunctions(directories),
ImmutableList.of(),
- PathFragment.EMPTY_FRAGMENT,
+ BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES,
+ BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE,
BazelSkyframeExecutorConstants.CROSS_REPOSITORY_LABEL_VIOLATION_STRATEGY,
BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY,
BazelSkyframeExecutorConstants.ACTION_ON_IO_EXCEPTION_READING_BUILD_FILE);
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
index efdd13dcd7..764b382f1e 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java
@@ -242,7 +242,8 @@ public abstract class BuildViewTestCase extends FoundationTestCase {
ImmutableList.<DiffAwareness.Factory>of(),
analysisMock.getSkyFunctions(directories),
ImmutableList.<SkyValueDirtinessChecker>of(),
- PathFragment.EMPTY_FRAGMENT,
+ BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES,
+ BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE,
BazelSkyframeExecutorConstants.CROSS_REPOSITORY_LABEL_VIOLATION_STRATEGY,
BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY,
BazelSkyframeExecutorConstants.ACTION_ON_IO_EXCEPTION_READING_BUILD_FILE);
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java
index 0e94a10d2e..c142337717 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/util/ConfigurationTestCase.java
@@ -126,7 +126,8 @@ public abstract class ConfigurationTestCase extends FoundationTestCase {
ImmutableList.<DiffAwareness.Factory>of(),
analysisMock.getSkyFunctions(directories),
ImmutableList.<SkyValueDirtinessChecker>of(),
- PathFragment.EMPTY_FRAGMENT,
+ BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES,
+ BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE,
BazelSkyframeExecutorConstants.CROSS_REPOSITORY_LABEL_VIOLATION_STRATEGY,
BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY,
BazelSkyframeExecutorConstants.ACTION_ON_IO_EXCEPTION_READING_BUILD_FILE);
diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java b/src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java
index 3f199e9fe9..af481f8db7 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/util/PackageLoadingTestCase.java
@@ -46,7 +46,6 @@ import com.google.devtools.build.lib.testutil.TestConstants;
import com.google.devtools.build.lib.testutil.TestRuleClassProvider;
import com.google.devtools.build.lib.util.io.TimestampGranularityMonitor;
import com.google.devtools.build.lib.vfs.ModifiedFileSet;
-import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionName;
import com.google.devtools.common.options.Options;
@@ -121,7 +120,8 @@ public abstract class PackageLoadingTestCase extends FoundationTestCase {
ImmutableList.<DiffAwareness.Factory>of(),
ImmutableMap.<SkyFunctionName, SkyFunction>of(),
ImmutableList.<SkyValueDirtinessChecker>of(),
- PathFragment.EMPTY_FRAGMENT,
+ BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES,
+ BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE,
BazelSkyframeExecutorConstants.CROSS_REPOSITORY_LABEL_VIOLATION_STRATEGY,
BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY,
BazelSkyframeExecutorConstants.ACTION_ON_IO_EXCEPTION_READING_BUILD_FILE);
diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/BuildFileModificationTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/BuildFileModificationTest.java
index 22a55ec1ff..7ebb3c2cb1 100644
--- a/src/test/java/com/google/devtools/build/lib/pkgcache/BuildFileModificationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/pkgcache/BuildFileModificationTest.java
@@ -40,7 +40,6 @@ import com.google.devtools.build.lib.vfs.FileSystem;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.ModifiedFileSet;
import com.google.devtools.build.lib.vfs.Path;
-import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem;
import com.google.devtools.common.options.OptionsParser;
import java.nio.charset.StandardCharsets;
@@ -91,7 +90,8 @@ public class BuildFileModificationTest extends FoundationTestCase {
ImmutableList.<DiffAwareness.Factory>of(),
analysisMock.getSkyFunctions(directories),
ImmutableList.<SkyValueDirtinessChecker>of(),
- PathFragment.EMPTY_FRAGMENT,
+ BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES,
+ BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE,
BazelSkyframeExecutorConstants.CROSS_REPOSITORY_LABEL_VIOLATION_STRATEGY,
BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY,
BazelSkyframeExecutorConstants.ACTION_ON_IO_EXCEPTION_READING_BUILD_FILE);
diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/IncrementalLoadingTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/IncrementalLoadingTest.java
index 49e5be4013..f78e49e3f5 100644
--- a/src/test/java/com/google/devtools/build/lib/pkgcache/IncrementalLoadingTest.java
+++ b/src/test/java/com/google/devtools/build/lib/pkgcache/IncrementalLoadingTest.java
@@ -482,7 +482,8 @@ public class IncrementalLoadingTest {
ImmutableList.of(new ManualDiffAwarenessFactory()),
ImmutableMap.<SkyFunctionName, SkyFunction>of(),
ImmutableList.<SkyValueDirtinessChecker>of(),
- PathFragment.EMPTY_FRAGMENT,
+ BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES,
+ BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE,
BazelSkyframeExecutorConstants.CROSS_REPOSITORY_LABEL_VIOLATION_STRATEGY,
BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY,
BazelSkyframeExecutorConstants.ACTION_ON_IO_EXCEPTION_READING_BUILD_FILE);
diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java
index a368664094..3a4943a8c9 100644
--- a/src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java
@@ -630,7 +630,8 @@ public class LoadingPhaseRunnerTest {
ImmutableList.<DiffAwareness.Factory>of(),
analysisMock.getSkyFunctions(directories),
ImmutableList.<SkyValueDirtinessChecker>of(),
- PathFragment.EMPTY_FRAGMENT,
+ BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES,
+ BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE,
BazelSkyframeExecutorConstants.CROSS_REPOSITORY_LABEL_VIOLATION_STRATEGY,
BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY,
BazelSkyframeExecutorConstants.ACTION_ON_IO_EXCEPTION_READING_BUILD_FILE);
diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java
index 22f71b573b..8fd9d55c8e 100644
--- a/src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java
+++ b/src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java
@@ -48,7 +48,6 @@ import com.google.devtools.build.lib.testutil.TestConstants;
import com.google.devtools.build.lib.util.io.TimestampGranularityMonitor;
import com.google.devtools.build.lib.vfs.ModifiedFileSet;
import com.google.devtools.build.lib.vfs.Path;
-import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.common.options.InvocationPolicyEnforcer;
import com.google.devtools.common.options.OptionsParser;
import com.google.devtools.common.options.OptionsParsingException;
@@ -100,7 +99,8 @@ public class PackageCacheTest extends FoundationTestCase {
ImmutableList.<DiffAwareness.Factory>of(),
analysisMock.getSkyFunctions(directories),
ImmutableList.<SkyValueDirtinessChecker>of(),
- PathFragment.EMPTY_FRAGMENT,
+ BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES,
+ BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE,
BazelSkyframeExecutorConstants.CROSS_REPOSITORY_LABEL_VIOLATION_STRATEGY,
BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY,
BazelSkyframeExecutorConstants.ACTION_ON_IO_EXCEPTION_READING_BUILD_FILE);
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java
index b2a28a0a2f..0728c5425e 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupFunctionTest.java
@@ -103,7 +103,9 @@ public class ContainingPackageLookupFunctionTest extends FoundationTestCase {
skyFunctions.put(
SkyFunctions.PACKAGE, new PackageFunction(null, null, null, null, null, null, null));
skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES,
- new BlacklistedPackagePrefixesFunction());
+ new BlacklistedPackagePrefixesFunction(
+ /*hardcodedBlacklistedPackagePrefixes=*/ ImmutableSet.of(),
+ /*additionalBlacklistedPackagePrefixesFile=*/ PathFragment.EMPTY_FRAGMENT));
skyFunctions.put(SkyFunctions.FILE_STATE, new FileStateFunction(
new AtomicReference<TimestampGranularityMonitor>(), externalFilesHelper));
skyFunctions.put(SkyFunctions.FILE, new FileFunction(pkgLocator));
@@ -141,8 +143,6 @@ public class ContainingPackageLookupFunctionTest extends FoundationTestCase {
evaluator = new InMemoryMemoizingEvaluator(skyFunctions, differencer);
driver = new SequentialBuildDriver(evaluator);
PrecomputedValue.BUILD_ID.set(differencer, UUID.randomUUID());
- PrecomputedValue.BLACKLISTED_PACKAGE_PREFIXES_FILE.set(differencer,
- PathFragment.EMPTY_FRAGMENT);
PrecomputedValue.PATH_PACKAGE_LOCATOR.set(differencer, pkgLocator.get());
PrecomputedValue.SKYLARK_SEMANTICS.set(differencer, SkylarkSemantics.DEFAULT_SEMANTICS);
RepositoryDelegatorFunction.REPOSITORY_OVERRIDES.set(
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java
index 301fa746c0..90ed181ad2 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/FilesetEntryFunctionTest.java
@@ -115,7 +115,9 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
CrossRepositoryLabelViolationStrategy.ERROR,
BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY));
skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES,
- new BlacklistedPackagePrefixesFunction());
+ new BlacklistedPackagePrefixesFunction(
+ /*hardcodedBlacklistedPackagePrefixes=*/ ImmutableSet.of(),
+ /*additionalBlacklistedPackagePrefixesFile=*/ PathFragment.EMPTY_FRAGMENT));
skyFunctions.put(SkyFunctions.FILESET_ENTRY, new FilesetEntryFunction());
skyFunctions.put(SkyFunctions.LOCAL_REPOSITORY_LOOKUP, new LocalRepositoryLookupFunction());
@@ -124,8 +126,6 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase {
driver = new SequentialBuildDriver(evaluator);
PrecomputedValue.BUILD_ID.set(differencer, UUID.randomUUID());
PrecomputedValue.PATH_PACKAGE_LOCATOR.set(differencer, pkgLocator.get());
- PrecomputedValue.BLACKLISTED_PACKAGE_PREFIXES_FILE.set(differencer,
- PathFragment.EMPTY_FRAGMENT);
}
private Artifact getSourceArtifact(String path) throws Exception {
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 660d89595f..13acf704e9 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
@@ -122,8 +122,6 @@ public abstract class GlobFunctionTest {
driver = new SequentialBuildDriver(evaluator);
PrecomputedValue.BUILD_ID.set(differencer, UUID.randomUUID());
PrecomputedValue.PATH_PACKAGE_LOCATOR.set(differencer, pkgLocator.get());
- PrecomputedValue.BLACKLISTED_PACKAGE_PREFIXES_FILE.set(
- differencer, PathFragment.EMPTY_FRAGMENT);
PrecomputedValue.SKYLARK_SEMANTICS.set(differencer, SkylarkSemantics.DEFAULT_SEMANTICS);
createTestFiles();
@@ -153,7 +151,9 @@ public abstract class GlobFunctionTest {
CrossRepositoryLabelViolationStrategy.ERROR,
BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY));
skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES,
- new BlacklistedPackagePrefixesFunction());
+ new BlacklistedPackagePrefixesFunction(
+ /*hardcodedBlacklistedPackagePrefixes=*/ ImmutableSet.of(),
+ /*additionalBlacklistedPackagePrefixesFile=*/ PathFragment.EMPTY_FRAGMENT));
skyFunctions.put(
SkyFunctions.FILE_STATE,
new FileStateFunction(
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java
index a90119ce5a..d9a3f5a701 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/PackageLookupFunctionTest.java
@@ -79,6 +79,8 @@ public abstract class PackageLookupFunctionTest extends FoundationTestCase {
private SequentialBuildDriver driver;
private RecordingDifferencer differencer;
private Path emptyPackagePath;
+ private static final String ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING =
+ "config/blacklisted.txt";
protected abstract CrossRepositoryLabelViolationStrategy crossRepositoryLabelViolationStrategy();
@@ -121,7 +123,9 @@ public abstract class PackageLookupFunctionTest extends FoundationTestCase {
SkyFunctions.DIRECTORY_LISTING_STATE,
new DirectoryListingStateFunction(externalFilesHelper));
skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES,
- new BlacklistedPackagePrefixesFunction());
+ new BlacklistedPackagePrefixesFunction(
+ /*hardcodedBlacklistedPackagePrefixes=*/ ImmutableSet.of(),
+ PathFragment.create(ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING)));
RuleClassProvider ruleClassProvider = analysisMock.createRuleClassProvider();
skyFunctions.put(SkyFunctions.WORKSPACE_AST, new WorkspaceASTFunction(ruleClassProvider));
skyFunctions.put(
@@ -153,8 +157,6 @@ public abstract class PackageLookupFunctionTest extends FoundationTestCase {
evaluator = new InMemoryMemoizingEvaluator(skyFunctions, differencer);
driver = new SequentialBuildDriver(evaluator);
PrecomputedValue.BUILD_ID.set(differencer, UUID.randomUUID());
- PrecomputedValue.BLACKLISTED_PACKAGE_PREFIXES_FILE.set(
- differencer, PathFragment.EMPTY_FRAGMENT);
PrecomputedValue.PATH_PACKAGE_LOCATOR.set(differencer, pkgLocator.get());
PrecomputedValue.SKYLARK_SEMANTICS.set(differencer, SkylarkSemantics.DEFAULT_SEMANTICS);
RepositoryDelegatorFunction.REPOSITORY_OVERRIDES.set(
@@ -209,14 +211,12 @@ public abstract class PackageLookupFunctionTest extends FoundationTestCase {
assertThat(packageLookupValue.getErrorMsg()).isNotNull();
}
-
@Test
public void testBlacklistedPackage() throws Exception {
scratch.file("blacklisted/subdir/BUILD");
scratch.file("blacklisted/BUILD");
- PrecomputedValue.BLACKLISTED_PACKAGE_PREFIXES_FILE.set(differencer,
- PathFragment.create("config/blacklisted.txt"));
- Path blacklist = scratch.file("config/blacklisted.txt", "blacklisted");
+ Path blacklist = scratch.overwriteFile(
+ ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING, "blacklisted");
ImmutableSet<String> pkgs = ImmutableSet.of("blacklisted/subdir", "blacklisted");
for (String pkg : pkgs) {
@@ -226,7 +226,8 @@ public abstract class PackageLookupFunctionTest extends FoundationTestCase {
assertThat(packageLookupValue.getErrorMsg()).isNotNull();
}
- scratch.overwriteFile("config/blacklisted.txt", "not_blacklisted");
+ scratch.overwriteFile(
+ ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING, "not_blacklisted");
RootedPath rootedBlacklist = RootedPath.toRootedPath(
blacklist.getParentDirectory().getParentDirectory(),
PathFragment.create("config/blacklisted.txt"));
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionSmartNegationTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionSmartNegationTest.java
index bbf9f945d9..2f43b7c083 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionSmartNegationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsFunctionSmartNegationTest.java
@@ -18,24 +18,42 @@ import static com.google.devtools.build.skyframe.WalkableGraphUtils.exists;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
import com.google.common.eventbus.EventBus;
-import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
+import com.google.devtools.build.lib.actions.ActionKeyContext;
+import com.google.devtools.build.lib.analysis.BlazeDirectories;
+import com.google.devtools.build.lib.analysis.ServerDirectories;
+import com.google.devtools.build.lib.analysis.util.AnalysisMock;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
+import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.events.Reporter;
+import com.google.devtools.build.lib.packages.SkylarkSemanticsOptions;
+import com.google.devtools.build.lib.pkgcache.PackageCacheOptions;
+import com.google.devtools.build.lib.pkgcache.PathPackageLocator;
+import com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction;
+import com.google.devtools.build.lib.testutil.FoundationTestCase;
+import com.google.devtools.build.lib.testutil.TestConstants;
+import com.google.devtools.build.lib.util.io.TimestampGranularityMonitor;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.EvaluationResult;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import com.google.devtools.build.skyframe.WalkableGraph;
+import com.google.devtools.common.options.Options;
import java.io.IOException;
+import java.util.UUID;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/** Tests for {@link PrepareDepsOfPatternsFunction}. */
@RunWith(JUnit4.class)
-public class PrepareDepsOfPatternsFunctionSmartNegationTest extends BuildViewTestCase {
+public class PrepareDepsOfPatternsFunctionSmartNegationTest extends FoundationTestCase {
+ private SkyframeExecutor skyframeExecutor;
+ private static final String ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING =
+ "config/blacklist.txt";
private static SkyKey getKeyForLabel(Label label) {
// Note that these tests used to look for TargetMarker SkyKeys before TargetMarker was
@@ -44,6 +62,50 @@ public class PrepareDepsOfPatternsFunctionSmartNegationTest extends BuildViewTes
return TransitiveTraversalValue.key(label);
}
+ @Before
+ public void setUp() throws Exception {
+ BlazeDirectories directories =
+ new BlazeDirectories(
+ new ServerDirectories(getScratch().dir("/install"), getScratch().dir("/output")),
+ rootDirectory,
+ AnalysisMock.get().getProductName());
+ skyframeExecutor =
+ SequencedSkyframeExecutor.create(
+ AnalysisMock.get()
+ .getPackageFactoryBuilderForTesting(directories)
+ .build(AnalysisMock.get().createRuleClassProvider(), fileSystem),
+ fileSystem,
+ directories,
+ new ActionKeyContext(),
+ /*workspaceStatusActionFactory=*/ null,
+ AnalysisMock.get().createRuleClassProvider().getBuildInfoFactories(),
+ ImmutableList.of(),
+ AnalysisMock.get().getSkyFunctions(directories),
+ ImmutableList.of(),
+ BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES,
+ PathFragment.create(ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING),
+ BazelSkyframeExecutorConstants.CROSS_REPOSITORY_LABEL_VIOLATION_STRATEGY,
+ BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY,
+ BazelSkyframeExecutorConstants.ACTION_ON_IO_EXCEPTION_READING_BUILD_FILE);
+ TestConstants.processSkyframeExecutorForTesting(skyframeExecutor);
+ skyframeExecutor.preparePackageLoading(
+ new PathPackageLocator(
+ outputBase,
+ ImmutableList.of(rootDirectory),
+ BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY),
+ Options.getDefaults(PackageCacheOptions.class),
+ Options.getDefaults(SkylarkSemanticsOptions.class),
+ AnalysisMock.get().getDefaultsPackageContent(),
+ UUID.randomUUID(),
+ ImmutableMap.<String, String>of(),
+ ImmutableMap.<String, String>of(),
+ new TimestampGranularityMonitor(null));
+ skyframeExecutor.injectExtraPrecomputedValues(ImmutableList.of(PrecomputedValue.injected(
+ RepositoryDelegatorFunction.REPOSITORY_OVERRIDES,
+ ImmutableMap.<RepositoryName, PathFragment>of())));
+ scratch.file(ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING);
+ }
+
@Test
public void testRecursiveEvaluationFailsOnBadBuildFile() throws Exception {
// Given a well-formed package "@//foo" and a malformed package "@//foo/foo",
@@ -89,9 +151,7 @@ public class PrepareDepsOfPatternsFunctionSmartNegationTest extends BuildViewTes
ImmutableList<String> patternSequence = ImmutableList.of("//foo/...");
// and a blacklist for the malformed package,
- getSkyframeExecutor().setBlacklistedPackagePrefixesFile(
- PathFragment.create("config/blacklist.txt"));
- scratch.file("config/blacklist.txt", "foo/foo");
+ scratch.overwriteFile(ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING, "foo/foo");
assertSkipsFoo(patternSequence);
}
@@ -140,12 +200,12 @@ public class PrepareDepsOfPatternsFunctionSmartNegationTest extends BuildViewTes
// When PrepareDepsOfPatternsFunction completes evaluation,
EvaluationResult<SkyValue> evaluationResult =
- getSkyframeExecutor()
+ skyframeExecutor
.getDriverForTesting()
.evaluate(
singletonTargetPattern,
keepGoing,
- LOADING_PHASE_THREADS,
+ /*numThreads=*/ 100,
new Reporter(new EventBus(), eventCollector));
// The evaluation has no errors if success was expected.
assertThat(evaluationResult.hasError()).isNotEqualTo(successExpected);
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java
index c6b946f4a3..bb54b99d19 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunctionTest.java
@@ -119,7 +119,9 @@ public final class RecursiveFilesystemTraversalFunctionTest extends FoundationTe
CrossRepositoryLabelViolationStrategy.ERROR,
BazelSkyframeExecutorConstants.BUILD_FILES_BY_PRIORITY));
skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES,
- new BlacklistedPackagePrefixesFunction());
+ new BlacklistedPackagePrefixesFunction(
+ /*hardcodedBlacklistedPackagePrefixes=*/ ImmutableSet.of(),
+ /*additionalBlacklistedPackagePrefixesFile=*/ PathFragment.EMPTY_FRAGMENT));
skyFunctions.put(SkyFunctions.PACKAGE,
new PackageFunction(null, null, null, null, null, null, null));
skyFunctions.put(SkyFunctions.WORKSPACE_AST, new WorkspaceASTFunction(ruleClassProvider));
@@ -145,8 +147,6 @@ public final class RecursiveFilesystemTraversalFunctionTest extends FoundationTe
driver = new SequentialBuildDriver(evaluator);
PrecomputedValue.BUILD_ID.set(differencer, UUID.randomUUID());
PrecomputedValue.PATH_PACKAGE_LOCATOR.set(differencer, pkgLocator.get());
- PrecomputedValue.BLACKLISTED_PACKAGE_PREFIXES_FILE.set(
- differencer, PathFragment.EMPTY_FRAGMENT);
}
private Artifact sourceArtifact(String path) {