diff options
author | nharmata <nharmata@google.com> | 2017-11-28 09:58:02 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2017-11-28 10:00:10 -0800 |
commit | d0f06a6e4b61adc39bf5e1cfbae39501a89dc8e3 (patch) | |
tree | 54d92cd2766eef00cb06a8bf6572426385fedb71 /src/test/java/com | |
parent | 5c7fc5b114b88e4737bf47ac6085789a190f0d45 (diff) |
Automated rollback of commit b64119807b014d9f3b99fb8a02e22daf1a8299b6.
*** Reason for rollback ***
Tickles the shell integration test version of b/35042288
*** Original change description ***
Change BlacklistedPackagesPrefixesFunction to take a pair of a hardcoded set of directories and a file path containing more directories to blacklist. The current usage of PrecomputedValue#BLACKLISTED_PACKAGE_PREFIXES_FILE is overly general and is only meaningfully used by unit tests; in practice, the blacklist file path can never change over the lifetime of the Bazel server. Perform a minor simplifying refactor as a result of this.
RELNOTES: None.
PiperOrigin-RevId: 177176068
Diffstat (limited to 'src/test/java/com')
14 files changed, 35 insertions, 101 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 76a75f6f84..16c991b8ac 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 @@ -169,8 +169,7 @@ public abstract class AnalysisTestCase extends FoundationTestCase { input -> false, analysisMock.getSkyFunctions(directories), ImmutableList.of(), - BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES, - BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE, + PathFragment.EMPTY_FRAGMENT, 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 60facef827..1a5b3dcf11 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 @@ -240,8 +240,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase { Predicates.<PathFragment>alwaysFalse(), analysisMock.getSkyFunctions(directories), ImmutableList.<SkyValueDirtinessChecker>of(), - BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES, - BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE, + PathFragment.EMPTY_FRAGMENT, 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 e7b5611479..57db7b0237 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 @@ -122,8 +122,7 @@ public abstract class ConfigurationTestCase extends FoundationTestCase { Predicates.<PathFragment>alwaysFalse(), analysisMock.getSkyFunctions(directories), ImmutableList.<SkyValueDirtinessChecker>of(), - BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES, - BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE, + PathFragment.EMPTY_FRAGMENT, 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 2bb00a95b8..5a9d3f6ddd 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 @@ -120,8 +120,7 @@ public abstract class PackageLoadingTestCase extends FoundationTestCase { Predicates.<PathFragment>alwaysFalse(), ImmutableMap.<SkyFunctionName, SkyFunction>of(), ImmutableList.<SkyValueDirtinessChecker>of(), - BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES, - BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE, + PathFragment.EMPTY_FRAGMENT, 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 02090b9339..fbdf45e2ac 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 @@ -90,8 +90,7 @@ public class BuildFileModificationTest extends FoundationTestCase { Predicates.<PathFragment>alwaysFalse(), analysisMock.getSkyFunctions(directories), ImmutableList.<SkyValueDirtinessChecker>of(), - BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES, - BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE, + PathFragment.EMPTY_FRAGMENT, 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 85562800ae..2c4b00f2d7 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 @@ -481,8 +481,7 @@ public class IncrementalLoadingTest { Predicates.<PathFragment>alwaysFalse(), ImmutableMap.<SkyFunctionName, SkyFunction>of(), ImmutableList.<SkyValueDirtinessChecker>of(), - BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES, - BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE, + PathFragment.EMPTY_FRAGMENT, 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 7ca9f834e0..53687a7305 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 @@ -629,8 +629,7 @@ public class LoadingPhaseRunnerTest { Predicates.<PathFragment>alwaysFalse(), analysisMock.getSkyFunctions(directories), ImmutableList.<SkyValueDirtinessChecker>of(), - BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES, - BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE, + PathFragment.EMPTY_FRAGMENT, 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 e4ac4c09a0..1d26d0107f 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 @@ -99,8 +99,7 @@ public class PackageCacheTest extends FoundationTestCase { Predicates.<PathFragment>alwaysFalse(), analysisMock.getSkyFunctions(directories), ImmutableList.<SkyValueDirtinessChecker>of(), - BazelSkyframeExecutorConstants.HARDCODED_BLACKLISTED_PACKAGE_PREFIXES, - BazelSkyframeExecutorConstants.ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE, + PathFragment.EMPTY_FRAGMENT, 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 7b929f045e..19b0c95224 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 @@ -100,9 +100,7 @@ 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( - /*hardcodedBlacklistedPackagePrefixes=*/ ImmutableSet.of(), - /*additionalBlacklistedPackagePrefixesFile=*/ PathFragment.EMPTY_FRAGMENT)); + new BlacklistedPackagePrefixesFunction()); skyFunctions.put(SkyFunctions.FILE_STATE, new FileStateFunction( new AtomicReference<TimestampGranularityMonitor>(), externalFilesHelper)); skyFunctions.put(SkyFunctions.FILE, new FileFunction(pkgLocator)); @@ -140,6 +138,8 @@ 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 f82e1ba03e..a9e0fbe762 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 @@ -112,9 +112,7 @@ public final class FilesetEntryFunctionTest extends FoundationTestCase { CrossRepositoryLabelViolationStrategy.ERROR, ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))); skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES, - new BlacklistedPackagePrefixesFunction( - /*hardcodedBlacklistedPackagePrefixes=*/ ImmutableSet.of(), - /*additionalBlacklistedPackagePrefixesFile=*/ PathFragment.EMPTY_FRAGMENT)); + new BlacklistedPackagePrefixesFunction()); skyFunctions.put(SkyFunctions.FILESET_ENTRY, new FilesetEntryFunction()); skyFunctions.put(SkyFunctions.LOCAL_REPOSITORY_LOOKUP, new LocalRepositoryLookupFunction()); @@ -123,6 +121,8 @@ 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 d526c2905d..7724160cec 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 @@ -120,6 +120,8 @@ 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(); @@ -149,9 +151,7 @@ public abstract class GlobFunctionTest { CrossRepositoryLabelViolationStrategy.ERROR, ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))); skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES, - new BlacklistedPackagePrefixesFunction( - /*hardcodedBlacklistedPackagePrefixes=*/ ImmutableSet.of(), - /*additionalBlacklistedPackagePrefixesFile=*/ PathFragment.EMPTY_FRAGMENT)); + new BlacklistedPackagePrefixesFunction()); 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 8692fdf41c..27eef90146 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,8 +79,6 @@ 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(); @@ -119,9 +117,7 @@ public abstract class PackageLookupFunctionTest extends FoundationTestCase { SkyFunctions.DIRECTORY_LISTING_STATE, new DirectoryListingStateFunction(externalFilesHelper)); skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES, - new BlacklistedPackagePrefixesFunction( - /*hardcodedBlacklistedPackagePrefixes=*/ ImmutableSet.of(), - PathFragment.create(ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING))); + new BlacklistedPackagePrefixesFunction()); RuleClassProvider ruleClassProvider = analysisMock.createRuleClassProvider(); skyFunctions.put(SkyFunctions.WORKSPACE_AST, new WorkspaceASTFunction(ruleClassProvider)); skyFunctions.put( @@ -153,6 +149,8 @@ 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( @@ -207,12 +205,14 @@ 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"); - Path blacklist = scratch.overwriteFile( - ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING, "blacklisted"); + PrecomputedValue.BLACKLISTED_PACKAGE_PREFIXES_FILE.set(differencer, + PathFragment.create("config/blacklisted.txt")); + Path blacklist = scratch.file("config/blacklisted.txt", "blacklisted"); ImmutableSet<String> pkgs = ImmutableSet.of("blacklisted/subdir", "blacklisted"); for (String pkg : pkgs) { @@ -222,8 +222,7 @@ public abstract class PackageLookupFunctionTest extends FoundationTestCase { assertThat(packageLookupValue.getErrorMsg()).isNotNull(); } - scratch.overwriteFile( - ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING, "not_blacklisted"); + scratch.overwriteFile("config/blacklisted.txt", "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 cea8acb063..bbf9f945d9 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 @@ -17,43 +17,25 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.devtools.build.skyframe.WalkableGraphUtils.exists; import com.google.common.base.Preconditions; -import com.google.common.base.Predicates; 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.BlazeDirectories; -import com.google.devtools.build.lib.analysis.ServerDirectories; -import com.google.devtools.build.lib.analysis.util.AnalysisMock; +import com.google.devtools.build.lib.analysis.util.BuildViewTestCase; 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 FoundationTestCase { - private SkyframeExecutor skyframeExecutor; - private static final String ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING = - "config/blacklist.txt"; +public class PrepareDepsOfPatternsFunctionSmartNegationTest extends BuildViewTestCase { private static SkyKey getKeyForLabel(Label label) { // Note that these tests used to look for TargetMarker SkyKeys before TargetMarker was @@ -62,47 +44,6 @@ public class PrepareDepsOfPatternsFunctionSmartNegationTest extends FoundationTe 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, - /*workspaceStatusActionFactory=*/ null, - AnalysisMock.get().createRuleClassProvider().getBuildInfoFactories(), - ImmutableList.of(), - Predicates.alwaysFalse(), - 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)), - 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", @@ -148,7 +89,9 @@ public class PrepareDepsOfPatternsFunctionSmartNegationTest extends FoundationTe ImmutableList<String> patternSequence = ImmutableList.of("//foo/..."); // and a blacklist for the malformed package, - scratch.overwriteFile(ADDITIONAL_BLACKLISTED_PACKAGE_PREFIXES_FILE_PATH_STRING, "foo/foo"); + getSkyframeExecutor().setBlacklistedPackagePrefixesFile( + PathFragment.create("config/blacklist.txt")); + scratch.file("config/blacklist.txt", "foo/foo"); assertSkipsFoo(patternSequence); } @@ -197,12 +140,12 @@ public class PrepareDepsOfPatternsFunctionSmartNegationTest extends FoundationTe // When PrepareDepsOfPatternsFunction completes evaluation, EvaluationResult<SkyValue> evaluationResult = - skyframeExecutor + getSkyframeExecutor() .getDriverForTesting() .evaluate( singletonTargetPattern, keepGoing, - /*numThreads=*/ 100, + LOADING_PHASE_THREADS, 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 f18e2b6149..e0d3bdfab7 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 @@ -116,9 +116,7 @@ public final class RecursiveFilesystemTraversalFunctionTest extends FoundationTe CrossRepositoryLabelViolationStrategy.ERROR, ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD))); skyFunctions.put(SkyFunctions.BLACKLISTED_PACKAGE_PREFIXES, - new BlacklistedPackagePrefixesFunction( - /*hardcodedBlacklistedPackagePrefixes=*/ ImmutableSet.of(), - /*additionalBlacklistedPackagePrefixesFile=*/ PathFragment.EMPTY_FRAGMENT)); + new BlacklistedPackagePrefixesFunction()); skyFunctions.put(SkyFunctions.PACKAGE, new PackageFunction(null, null, null, null, null, null, null)); skyFunctions.put(SkyFunctions.WORKSPACE_AST, new WorkspaceASTFunction(ruleClassProvider)); @@ -144,6 +142,8 @@ 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) { |