aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/java/com/google/devtools/build/lib/packages/util/MockCcSupport.java185
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java24
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java4
3 files changed, 46 insertions, 167 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/MockCcSupport.java b/src/test/java/com/google/devtools/build/lib/packages/util/MockCcSupport.java
index f3e368a7bd..a6ebc585be 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/util/MockCcSupport.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/util/MockCcSupport.java
@@ -427,164 +427,43 @@ public abstract class MockCcSupport {
+ " pattern: 'foo%{bad_variable}bar'"
+ "}";
- /** An action_config for 'c++-compile action using DUMMY_TOOL that doesn't imply any features. */
- public static final String INCOMPLETE_COMPILE_ACTION_CONFIG =
- ""
- + "action_config {"
- + " config_name: '"
- + CppCompileAction.CPP_COMPILE
- + "'"
- + " action_name: '"
- + CppCompileAction.CPP_COMPILE
- + "'"
- + " tool {"
- + " tool_path: 'DUMMY_TOOL'"
- + " }"
- + "}";
+ public static final String EMPTY_COMPILE_ACTION_CONFIG =
+ emptyActionConfigFor(CppCompileAction.CPP_COMPILE);
- /**
- * An action_config for 'c++-module-codegen action using DUMMY_TOOL that doesn't imply any
- * features.
- */
- public static final String INCOMPLETE_MODULE_CODEGEN_ACTION_CONFIG =
- ""
- + "action_config {"
- + " config_name: '"
- + CppCompileAction.CPP_MODULE_CODEGEN
- + "'"
- + " action_name: '"
- + CppCompileAction.CPP_MODULE_CODEGEN
- + "'"
- + " tool {"
- + " tool_path: 'DUMMY_TOOL'"
- + " }"
- + "}";
+ public static final String EMPTY_MODULE_CODEGEN_ACTION_CONFIG =
+ emptyActionConfigFor(CppCompileAction.CPP_MODULE_CODEGEN);
- /**
- * An action_config for 'c++-module-compile action using DUMMY_TOOL that doesn't imply any
- * features.
- */
- public static final String INCOMPLETE_MODULE_COMPILE_ACTION_CONFIG =
- ""
- + "action_config {"
- + " config_name: '"
- + CppCompileAction.CPP_MODULE_COMPILE
- + "'"
- + " action_name: '"
- + CppCompileAction.CPP_MODULE_COMPILE
- + "'"
- + " tool {"
- + " tool_path: 'DUMMY_TOOL'"
- + " }"
- + "}";
+ public static final String EMPTY_MODULE_COMPILE_ACTION_CONFIG =
+ emptyActionConfigFor(CppCompileAction.CPP_MODULE_COMPILE);
- public static final String INCOMPLETE_EXECUTABLE_ACTION_CONFIG =
- ""
- + "action_config {"
- + " config_name: '"
- + LinkTargetType.EXECUTABLE.getActionName()
- + "'"
- + " action_name: '"
- + LinkTargetType.EXECUTABLE.getActionName()
- + "'"
- + " tool {"
- + " tool_path: 'DUMMY_TOOL'"
- + " }"
- + "}";
+ public static final String EMPTY_EXECUTABLE_ACTION_CONFIG =
+ emptyActionConfigFor(LinkTargetType.EXECUTABLE.getActionName());
- public static final String INCOMPLETE_DYNAMIC_LIBRARY_ACTION_CONFIG =
- ""
- + "action_config {"
- + " config_name: '"
- + LinkTargetType.DYNAMIC_LIBRARY.getActionName()
- + "'"
- + " action_name: '"
- + LinkTargetType.DYNAMIC_LIBRARY.getActionName()
- + "'"
- + " tool {"
- + " tool_path: 'DUMMY_TOOL'"
- + " }"
- + "}";
- public static final String INCOMPLETE_STATIC_LIBRARY_ACTION_CONFIG =
- ""
- + "action_config {"
- + " config_name: '"
- + LinkTargetType.STATIC_LIBRARY.getActionName()
- + "'"
- + " action_name: '"
- + LinkTargetType.STATIC_LIBRARY.getActionName()
- + "'"
- + " tool {"
- + " tool_path: 'DUMMY_TOOL'"
- + " }"
- + "}";
- public static final String INCOMPLETE_PIC_STATIC_LIBRARY_ACTION_CONFIG =
- ""
- + "action_config {"
- + " config_name: '"
- + LinkTargetType.PIC_STATIC_LIBRARY.getActionName()
- + "'"
- + " action_name: '"
- + LinkTargetType.PIC_STATIC_LIBRARY.getActionName()
- + "'"
- + " tool {"
- + " tool_path: 'DUMMY_TOOL'"
- + " }"
- + "}";
- public static final String INCOMPLETE_ALWAYS_LINK_STATIC_LIBRARY_ACTION_CONFIG =
- ""
- + "action_config {"
- + " config_name: '"
- + LinkTargetType.ALWAYS_LINK_STATIC_LIBRARY.getActionName()
- + "'"
- + " action_name: '"
- + LinkTargetType.ALWAYS_LINK_STATIC_LIBRARY.getActionName()
- + "'"
- + " tool {"
- + " tool_path: 'DUMMY_TOOL'"
- + " }"
- + "}";
- public static final String INCOMPLETE_ALWAYS_LINK_PIC_STATIC_LIBRARY_EXECUTABLE_ACTION_CONFIG =
- ""
- + "action_config {"
- + " config_name: '"
- + LinkTargetType.ALWAYS_LINK_PIC_STATIC_LIBRARY.getActionName()
- + "'"
- + " action_name: '"
- + LinkTargetType.ALWAYS_LINK_PIC_STATIC_LIBRARY.getActionName()
- + "'"
- + " tool {"
- + " tool_path: 'DUMMY_TOOL'"
- + " }"
- + "}";
- public static final String INCOMPLETE_INTERFACE_DYNAMIC_LIBRARY_ACTION_CONFIG =
- ""
- + "action_config {"
- + " config_name: '"
- + LinkTargetType.INTERFACE_DYNAMIC_LIBRARY.getActionName()
- + "'"
- + " action_name: '"
- + LinkTargetType.INTERFACE_DYNAMIC_LIBRARY.getActionName()
- + "'"
- + " tool {"
- + " tool_path: 'DUMMY_TOOL'"
- + " }"
- + "}";
+ public static final String EMPTY_DYNAMIC_LIBRARY_ACTION_CONFIG =
+ emptyActionConfigFor(LinkTargetType.DYNAMIC_LIBRARY.getActionName());
- /** An action_config for clif-match action using DUMMY_TOOL that doesn't imply any features. */
- public static final String INCOMPLETE_CLIF_MATCH_ACTION_CONFIG =
- ""
- + "action_config {"
- + " config_name: '"
- + CppCompileAction.CLIF_MATCH
- + "'"
- + " action_name: '"
- + CppCompileAction.CLIF_MATCH
- + "'"
- + " tool {"
- + " tool_path: 'DUMMY_TOOL'"
- + " }"
- + "}";
+ public static final String EMPTY_STATIC_LIBRARY_ACTION_CONFIG =
+ emptyActionConfigFor(LinkTargetType.STATIC_LIBRARY.getActionName());
+
+ public static final String EMPTY_CLIF_MATCH_ACTION_CONFIG =
+ emptyActionConfigFor(CppCompileAction.CLIF_MATCH);
+
+ /**
+ * Creates action_config for {@code actionName} action using DUMMY_TOOL that doesn't imply any
+ * features.
+ */
+ private static String emptyActionConfigFor(String actionName) {
+ return String.format(
+ ""
+ + "action_config {"
+ + " config_name: '%s'"
+ + " action_name: '%s'"
+ + " tool {"
+ + " tool_path: 'DUMMY_TOOL'"
+ + " }"
+ + "}",
+ actionName, actionName);
+ }
/** Filter to remove implicit dependencies of C/C++ rules. */
private final Predicate<Label> ccLabelFilter =
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java
index 498564c65f..464878197c 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java
@@ -114,7 +114,7 @@ public class CcLibraryConfiguredTargetTest extends BuildViewTestCase {
.setupCrosstool(
mockToolsConfig,
MockCcSupport.NO_LEGACY_FEATURES_FEATURE,
- MockCcSupport.INCOMPLETE_COMPILE_ACTION_CONFIG);
+ MockCcSupport.EMPTY_COMPILE_ACTION_CONFIG);
useConfiguration();
checkError(
@@ -131,7 +131,7 @@ public class CcLibraryConfiguredTargetTest extends BuildViewTestCase {
.setupCrosstool(
mockToolsConfig,
MockCcSupport.NO_LEGACY_FEATURES_FEATURE,
- MockCcSupport.INCOMPLETE_STATIC_LIBRARY_ACTION_CONFIG);
+ MockCcSupport.EMPTY_STATIC_LIBRARY_ACTION_CONFIG);
useConfiguration();
checkError(
@@ -761,8 +761,8 @@ public class CcLibraryConfiguredTargetTest extends BuildViewTestCase {
.ccSupport()
.setupCrosstool(
mockToolsConfig,
- MockCcSupport.INCOMPLETE_STATIC_LIBRARY_ACTION_CONFIG,
- MockCcSupport.INCOMPLETE_COMPILE_ACTION_CONFIG,
+ MockCcSupport.EMPTY_STATIC_LIBRARY_ACTION_CONFIG,
+ MockCcSupport.EMPTY_COMPILE_ACTION_CONFIG,
MockCcSupport.NO_LEGACY_FEATURES_FEATURE);
useConfiguration("--cpu=k8");
writeSimpleCcLibrary();
@@ -778,10 +778,10 @@ public class CcLibraryConfiguredTargetTest extends BuildViewTestCase {
.setupCrosstool(
mockToolsConfig,
"needsPic: false",
- MockCcSupport.INCOMPLETE_COMPILE_ACTION_CONFIG,
- MockCcSupport.INCOMPLETE_EXECUTABLE_ACTION_CONFIG,
- MockCcSupport.INCOMPLETE_DYNAMIC_LIBRARY_ACTION_CONFIG,
- MockCcSupport.INCOMPLETE_STATIC_LIBRARY_ACTION_CONFIG,
+ MockCcSupport.EMPTY_COMPILE_ACTION_CONFIG,
+ MockCcSupport.EMPTY_EXECUTABLE_ACTION_CONFIG,
+ MockCcSupport.EMPTY_DYNAMIC_LIBRARY_ACTION_CONFIG,
+ MockCcSupport.EMPTY_STATIC_LIBRARY_ACTION_CONFIG,
MockCcSupport.NO_LEGACY_FEATURES_FEATURE);
useConfiguration();
scratchConfiguredTarget("a", "a",
@@ -795,10 +795,10 @@ public class CcLibraryConfiguredTargetTest extends BuildViewTestCase {
.ccSupport()
.setupCrosstool(
mockToolsConfig,
- MockCcSupport.INCOMPLETE_COMPILE_ACTION_CONFIG,
- MockCcSupport.INCOMPLETE_EXECUTABLE_ACTION_CONFIG,
- MockCcSupport.INCOMPLETE_STATIC_LIBRARY_ACTION_CONFIG,
- MockCcSupport.INCOMPLETE_DYNAMIC_LIBRARY_ACTION_CONFIG,
+ MockCcSupport.EMPTY_COMPILE_ACTION_CONFIG,
+ MockCcSupport.EMPTY_EXECUTABLE_ACTION_CONFIG,
+ MockCcSupport.EMPTY_STATIC_LIBRARY_ACTION_CONFIG,
+ MockCcSupport.EMPTY_DYNAMIC_LIBRARY_ACTION_CONFIG,
MockCcSupport.NO_LEGACY_FEATURES_FEATURE,
MockCcSupport.PIC_FEATURE);
useConfiguration();
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java
index bf85459dfa..0675d49e33 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java
@@ -106,7 +106,7 @@ public class CppLinkActionTest extends BuildViewTestCase {
public void testToolchainFeatureFlags() throws Exception {
FeatureConfiguration featureConfiguration =
CcToolchainFeaturesTest.buildFeatures(
- MockCcSupport.INCOMPLETE_EXECUTABLE_ACTION_CONFIG,
+ MockCcSupport.EMPTY_EXECUTABLE_ACTION_CONFIG,
"feature {",
" name: 'a'",
" flag_set {",
@@ -228,7 +228,7 @@ public class CppLinkActionTest extends BuildViewTestCase {
public void testToolchainFeatureEnv() throws Exception {
FeatureConfiguration featureConfiguration =
CcToolchainFeaturesTest.buildFeatures(
- MockCcSupport.INCOMPLETE_EXECUTABLE_ACTION_CONFIG,
+ MockCcSupport.EMPTY_EXECUTABLE_ACTION_CONFIG,
"feature {",
" name: 'a'",
" env_set {",