Fix linkstamping tests broken on bazel ci
Fixes second part of failures.
RELNOTES: None.
@@ -190,12 +190,12 @@ public class CppLinkstampCompileHelperTest extends BuildViewTestCase {
"x/BUILD",
"cc_binary(",
" name = 'foo',",
- " deps = ['a'],",
+ " deps = ['bar'],",
" srcs = [ 'main.cc' ],",
")",
"cc_library(",
- " name = 'a',",
- " srcs = [ 'a.cc' ],",
+ " name = 'bar',",
+ " srcs = [ 'bar.cc' ],",
" linkstamp = 'ls.cc',",
")");
@@ -217,11 +217,14 @@ public class CppLinkstampCompileHelperTest extends BuildViewTestCase {
Artifact mainObject =
ActionsTestUtil.getFirstArtifactEndingWith(
generatingAction.getInputs(), usePic ? "main.pic.o" : "main.o");
- Artifact aObject =
- ActionsTestUtil.getFirstArtifactEndingWith(
- generatingAction.getInputs(), usePic ? "a.pic.o" : "a.o");
+ Artifact bar =
+ ImmutableList.copyOf(generatingAction.getInputs())
+ .stream()
+ .filter(a -> a.getExecPath().getBaseName().contains("bar"))
+ .findFirst()
+ .get();
ImmutableList<Artifact> linkstampInputs =
ImmutableList.copyOf(linkstampCompileAction.getInputs());
- assertThat(linkstampInputs).containsAllOf(mainObject, aObject);
+ assertThat(linkstampInputs).containsAllOf(mainObject, bar);
}
}
