diff --git a/src/main/java/com/google/devtools/build/docgen/templates/attributes/common/tags.html b/src/main/java/com/google/devtools/build/docgen/templates/attributes/common/tags.html index 82115800985afe..f7a1fde401baab 100644 --- a/src/main/java/com/google/devtools/build/docgen/templates/attributes/common/tags.html +++ b/src/main/java/com/google/devtools/build/docgen/templates/attributes/common/tags.html @@ -46,7 +46,7 @@ or cached remotely. This is equivalent to using both no-remote-cache and no-remote-exec. -
  • local keyword precludes the action or test from being remotely cached, +
  • local keyword precludes the action or test from being remotely cached, remotely executed, or run inside the sandbox. For genrules and tests, marking the rule with the local = True attribute has the same effect. diff --git a/src/main/java/com/google/devtools/build/lib/actions/ExecutionRequirements.java b/src/main/java/com/google/devtools/build/lib/actions/ExecutionRequirements.java index 0a55056e9dc681..457c26a26c2b6b 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ExecutionRequirements.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ExecutionRequirements.java @@ -195,6 +195,9 @@ public enum WorkerProtocolFormat { /** Disables remote execution of a spawn. Note: does not disable remote caching */ public static final String NO_REMOTE_EXEC = "no-remote-exec"; + /** Tag for Google internal use. Requires local execution with correct permissions. */ + public static final String NO_TESTLOASD = "no-testloasd"; + /** * Disables both remote execution and remote caching of a spawn. This is the equivalent of using * no-remote-cache and no-remote-exec together. diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/TestTargetProperties.java b/src/main/java/com/google/devtools/build/lib/analysis/test/TestTargetProperties.java index 0456ef040326fe..0c97167cfc8390 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/test/TestTargetProperties.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/test/TestTargetProperties.java @@ -114,6 +114,11 @@ private static ResourceSet getResourceSetFromSize(TestSize size) { } } + if (TargetUtils.isNoTestloasdTestRule(rule)) { + executionInfo.put(ExecutionRequirements.LOCAL, ""); + executionInfo.put(ExecutionRequirements.NO_TESTLOASD, ""); + } + if (executionRequirements != null) { // This will overwrite whatever TargetUtils put there, which might be confusing. executionInfo.putAll(executionRequirements.getExecutionInfo()); diff --git a/src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java b/src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java index 42a3fdedb63557..5221315c43476a 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java +++ b/src/main/java/com/google/devtools/build/lib/packages/TargetUtils.java @@ -146,6 +146,16 @@ public static boolean isExternalTestRule(Rule rule) { return hasConstraint(rule, "external"); } + /** + * Returns true if test marked as "no-testloasd" by the appropriate keyword in the tags attribute. + * + *

    Method assumes that passed target is a test rule, so usually it should be used only after + * isTestRule() or isTestOrTestSuiteRule(). Behavior is undefined otherwise. + */ + public static boolean isNoTestloasdTestRule(Rule rule) { + return hasConstraint(rule, "no-testloasd"); + } + public static List getStringListAttr(Target target, String attrName) { Preconditions.checkArgument(target instanceof Rule); return NonconfigurableAttributeMapper.of((Rule) target).get(attrName, Type.STRING_LIST);