aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/rules/cpp
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2017-09-14 13:54:15 +0200
committerGravatar Philipp Wollermann <philwo@google.com>2017-09-14 18:48:00 +0200
commitf26e8694ae78599b3e2004e3360eaf3443fa53a6 (patch)
treedcebef6ed7f4f85293754bbbf6e69c378343fde1 /src/test/java/com/google/devtools/build/lib/rules/cpp
parent2000a0446cdd3f438b788752725f500ce157eb9e (diff)
Introduce -c source_file -o output_file build variables
Prior to this cl CompileCommandLine would (almost) unconditionally emit -c and -o flags. This cl removes this logic and relies on crosstool to emit these flags. This is another small step towards platform independent C++ rules. Memory use is not affected, since the build variables used by this cl are already exposed, this cl just forces crosstools to use it. RELNOTES: None. PiperOrigin-RevId: 168671507
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/rules/cpp')
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java14
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/cpp/CompileCommandLineTest.java5
2 files changed, 9 insertions, 10 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java
index 2ff18b4379..a3ab083ba2 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java
@@ -369,19 +369,19 @@ public class CcCommonTest extends BuildViewTestCase {
" srcs = [ 'library.cc' ],",
" nocopts = '-fPIC')");
- assertThat(getCppCompileAction("//a:pic").getArgv()).contains("-fPIC");
- assertThat(getCppCompileAction("//a:libpic.so").getArgv()).contains("-fPIC");
- assertThat(getCppCompileAction("//a:piclib").getArgv()).contains("-fPIC");
- assertThat(getCppCompileAction("//a:nopic").getArgv()).doesNotContain("-fPIC");
- assertThat(getCppCompileAction("//a:libnopic.so").getArgv()).doesNotContain("-fPIC");
- assertThat(getCppCompileAction("//a:nopiclib").getArgv()).doesNotContain("-fPIC");
+ assertThat(getCppCompileAction("//a:pic").getArguments()).contains("-fPIC");
+ assertThat(getCppCompileAction("//a:libpic.so").getArguments()).contains("-fPIC");
+ assertThat(getCppCompileAction("//a:piclib").getArguments()).contains("-fPIC");
+ assertThat(getCppCompileAction("//a:nopic").getArguments()).doesNotContain("-fPIC");
+ assertThat(getCppCompileAction("//a:libnopic.so").getArguments()).doesNotContain("-fPIC");
+ assertThat(getCppCompileAction("//a:nopiclib").getArguments()).doesNotContain("-fPIC");
}
@Test
public void testPicModeAssembly() throws Exception {
useConfiguration("--cpu=k8");
scratch.file("a/BUILD", "cc_library(name='preprocess', srcs=['preprocess.S'])");
- List<String> argv = getCppCompileAction("//a:preprocess").getArgv();
+ List<String> argv = getCppCompileAction("//a:preprocess").getArguments();
assertThat(argv).contains("-fPIC");
}
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CompileCommandLineTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CompileCommandLineTest.java
index e0fd56322a..93d1c69452 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CompileCommandLineTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CompileCommandLineTest.java
@@ -92,7 +92,7 @@ public class CompileCommandLineTest extends BuildViewTestCase {
" }",
"}"))
.build();
- assertThat(compileCommandLine.getArgv(scratchArtifact("a/FakeOutput").getExecPath(), null))
+ assertThat(compileCommandLine.getArguments(/* overwrittenVariables= */ null))
.contains("-some_foo_flag");
}
@@ -134,13 +134,12 @@ public class CompileCommandLineTest extends BuildViewTestCase {
"}"))
.setCoptsFilter(flag -> !flag.contains("i_am_a_flag"))
.build();
- return compileCommandLine.getArgv(scratchArtifact("a/FakeOutput").getExecPath(), null);
+ return compileCommandLine.getArguments(/* overwrittenVariables= */ null);
}
private Builder makeCompileCommandLineBuilder() throws Exception {
return CompileCommandLine.builder(
scratchArtifact("a/FakeInput"),
- scratchArtifact("a/FakeOutput"),
new Predicate<String>() {
@Override
public boolean apply(String s) {