aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2017-08-02 11:15:41 +0200
committerGravatar Dmitry Lomov <dslomov@google.com>2017-08-02 16:34:45 +0200
commit67c2ece9f1fc2608b707d52d53f07eb678da8ddb (patch)
tree0e4f02288692d9a22c60f53777af3897e2485bea /src/test/java
parent51a8ff70ada81a6e4c604d530231a81f60999f28 (diff)
Cleanup mock action_configs in MockCcSupport
RELNOTES: None. PiperOrigin-RevId: 163947365
Diffstat (limited to 'src/test/java')
-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 {",