aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2018-04-26 08:31:52 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-26 08:34:42 -0700
commite28711b351c9f413281e638c5ea171128dd99f82 (patch)
tree37d951a1acb64d5a18dfdc65b08fa0e38879db2e /src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java
parent8ca66458a42266f11aba77732b05ab06b96e95fb (diff)
Abstract away the param file write action from tests.
Rule authors frequently wants to make assertions on the parameter files their rule implementations have created. However, if they do not explicitly create parameter file write actions, or if indeed _there aren't_ any parameter file write actions inserted into the action graph, the tests will fail. This CL puts an abstraction between the tests and obtaining their parameter files, allowing us to change the implementation without updating hundreds of lines of test code in the same CL. Note that we can no longer sanely assert that the parameter file argument is inserted into the main command line, because the parameter file system controls both whether it is inserted and the name used. Those assertions have been removed where found. RELNOTES: None PiperOrigin-RevId: 194400303
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java
index 061eac34e4..abecb86aa7 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java
@@ -44,7 +44,6 @@ import com.google.devtools.build.lib.actions.CommandAction;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.RunfilesProvider;
-import com.google.devtools.build.lib.analysis.actions.ParameterFileWriteAction;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.analysis.config.CompilationMode;
import com.google.devtools.build.lib.analysis.util.ScratchAttributeWriter;
@@ -1226,9 +1225,9 @@ public class ObjcLibraryTest extends ObjcRuleTestCase {
scratch.file("lib/b.m");
scratch.file("lib/BUILD", "objc_library(name = 'lib1', srcs = ['a.m', 'b.m'])");
ConfiguredTarget target = getConfiguredTarget("//lib:lib1");
- Artifact objlist = getBinArtifact("lib1-archive.objlist", target);
- ParameterFileWriteAction action = (ParameterFileWriteAction) getGeneratingAction(objlist);
- assertThat(action.getContents())
+ Artifact lib = getBinArtifact("liblib1.a", target);
+ Action action = getGeneratingAction(lib);
+ assertThat(paramFileArgsForAction(action))
.containsExactlyElementsIn(
Artifact.toExecPaths(inputsEndingWith(archiveAction("//lib:lib1"), ".o")));
}