From cef82b35d7a73d2a35ffde4dfcd9c67d950b7d99 Mon Sep 17 00:00:00 2001 From: jcater Date: Thu, 28 Jan 2021 11:20:46 -0800 Subject: [PATCH] AndroidInstrumentationTestTest checks artifacts by name, not by name and configuration. Future changes to Android rules will result in dependencies not being in the top-level target configuration, this change is to future-proof the tests. PiperOrigin-RevId: 354352930 --- .../android/AndroidInstrumentationTestTest.java | 14 +++++++++----- .../google/devtools/build/lib/rules/android/BUILD | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestTest.java b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestTest.java index 0607a515563e5f..88ac3287cbce92 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestTest.java @@ -13,6 +13,7 @@ // limitations under the License. package com.google.devtools.build.lib.rules.android; +import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.truth.Truth.assertThat; import static com.google.devtools.build.lib.actions.util.ActionsTestUtil.getFirstArtifactEndingWith; @@ -175,15 +176,18 @@ public void testTestExecutableRunfiles() throws Exception { .getDefaultRunfiles() .getAllArtifacts() .toList()); - assertThat(runfiles) + assertThat(runfiles.stream().map(Artifact::toString).collect(toImmutableList())) .containsAtLeast( - getDeviceFixtureScript(getConfiguredTarget("//javatests/com/app:device_fixture")), - getInstrumentationApk(getConfiguredTarget("//javatests/com/app:instrumentation_app")), - getTargetApk(getConfiguredTarget("//javatests/com/app:instrumentation_app")), + getDeviceFixtureScript(getConfiguredTarget("//javatests/com/app:device_fixture")) + .toString(), + getInstrumentationApk(getConfiguredTarget("//javatests/com/app:instrumentation_app")) + .toString(), + getTargetApk(getConfiguredTarget("//javatests/com/app:instrumentation_app")).toString(), getConfiguredTarget("//javatests/com/app/ait:foo.txt") .getProvider(FileProvider.class) .getFilesToBuild() - .getSingleton()); + .getSingleton() + .toString()); } @Test diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/BUILD b/src/test/java/com/google/devtools/build/lib/rules/android/BUILD index fd6bb19a867a0a..fd1115a9c85179 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/android/BUILD +++ b/src/test/java/com/google/devtools/build/lib/rules/android/BUILD @@ -266,6 +266,7 @@ java_test( "//src/main/java/com/google/devtools/build/lib/rules/android", "//src/main/java/com/google/devtools/build/lib/skyframe:configured_target_and_data", "//src/test/java/com/google/devtools/build/lib/actions/util", + "//third_party:guava", "//third_party:junit4", "//third_party:truth", ],