aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2018-08-14 08:29:29 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-08-14 08:31:03 -0700
commit9a933772e87dfcf684590eb74eee9970e8b66669 (patch)
treee1aa9f9bd258af2415b3659e05f6db7fbac0f9de /src/main
parent4d57f86c3df2c36763cf9cf92b8cfd206a7153b6 (diff)
test-wrapper: add empty impl + Bazel flag
This commit adds: - the skeleton implementation of the Windows native test wrapper - a depenency on the native test wrapper from test rules, through the new $test_wrapper rule attribute - the --windows_native_test_wrapper Bazel flag, which is currently a no-op See https://github.com/bazelbuild/bazel/issues/5508 Change-Id: I8df95c8ce8bab53c51c257698ec95416065a836e Closes #5854. Change-Id: I2ffc78bceec5dd867af775b5878f105fa87c3dba PiperOrigin-RevId: 208650699
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/test/TestConfiguration.java21
3 files changed, 31 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java b/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
index 2bd7daf1b9..d75f64a566 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BaseRuleClasses.java
@@ -166,6 +166,11 @@ public class BaseRuleClasses {
.add(attr("args", STRING_LIST))
// Input files for every test action
.add(
+ attr("$test_wrapper", LABEL)
+ .cfg(HostTransition.INSTANCE)
+ .singleArtifact()
+ .value(env.getToolsLabel("//tools/test:test_wrapper")))
+ .add(
attr("$test_runtime", LABEL_LIST)
.cfg(HostTransition.INSTANCE)
.value(ImmutableList.of(env.getToolsLabel("//tools/test:runtime"))))
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java
index fffbe7a5ea..4a99825d6d 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleClassFunctions.java
@@ -166,6 +166,11 @@ public class SkylarkRuleClassFunctions implements SkylarkRuleFunctionsApi<Artifa
.add(attr("args", STRING_LIST))
// Input files for every test action
.add(
+ attr("$test_wrapper", LABEL)
+ .cfg(HostTransition.INSTANCE)
+ .singleArtifact()
+ .value(labelCache.getUnchecked(toolsRepository + "//tools/test:test_wrapper")))
+ .add(
attr("$test_runtime", LABEL_LIST)
.cfg(HostTransition.INSTANCE)
.value(
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/TestConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/test/TestConfiguration.java
index 0d2f85b1cb..fe60cc1f39 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/test/TestConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/test/TestConfiguration.java
@@ -216,6 +216,23 @@ public class TestConfiguration extends Fragment {
)
public Label coverageReportGenerator;
+ @Option(
+ name = "windows_native_test_wrapper",
+ // Undocumented: this features is under development and not yet ready for production use.
+ // We define the flag to be able to test the feature.
+ // Design:
+ // https://github.com/laszlocsomor/proposals/blob/win-test-runner/designs/2018-07-18-windows-native-test-runner.md
+ documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
+ // Affects loading and analysis: this flag affects which target Bazel loads and creates test
+ // actions with on Windows.
+ effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
+ defaultValue = "false",
+ help =
+ "Do not use yet, this flag's functionality is not yet implemented. "
+ + "(On Windows: if true, uses the C++ test wrapper to run tests, otherwise uses "
+ + "tools/test/test-setup.sh as on other platforms. On other platforms: no-op.)")
+ public boolean windowsNativeTestWrapper;
+
@Override
public Map<String, Set<Label>> getDefaultsLabels() {
return ImmutableMap.<String, Set<Label>>of(
@@ -298,6 +315,10 @@ public class TestConfiguration extends Fragment {
return options.coverageReportGenerator;
}
+ public boolean isUsingWindowsNativeTestWrapper() {
+ return options.windowsNativeTestWrapper;
+ }
+
/**
* @return number of times the given test should run. If the test doesn't match any of the
* filters, runs it once.