Fix RUNTIME_TARGET_GTEST_MAKE_TARGETS
There are a few modules that are `test_per_src: false`, so the guess of
the module name does not work.
Bug: 126890843
Test: see fewer warnings about missing modules on internal master
Change-Id: Ib7d85b80b0629c1ddd17feb3b0477062bae6c179
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 2a88d85..960a51e 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -609,9 +609,16 @@
# Used outside the art project to get a list of the current tests
RUNTIME_TARGET_GTEST_MAKE_TARGETS :=
art_target_gtest_files := $(foreach m,$(ART_TEST_MODULES),$(ART_TEST_LIST_device_$(TARGET_ARCH)_$(m)))
+# If testdir == testfile, assume this is not a test_per_src module
$(foreach file,$(art_target_gtest_files),\
- $(eval RUNTIME_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(patsubst %/,%,$$(dir $$(file))))_$$(notdir $$(basename $$(file))))\
+ $(eval testdir := $$(notdir $$(patsubst %/,%,$$(dir $$(file)))))\
+ $(eval testfile := $$(notdir $$(basename $$(file))))\
+ $(if $(call streq,$(testdir),$(testfile)),,\
+ $(eval testfile := $(testdir)_$(testfile)))\
+ $(eval RUNTIME_TARGET_GTEST_MAKE_TARGETS += $(testfile))\
)
+testdir :=
+testfile :=
art_target_gtest_files :=
# Define all the combinations of host/target and suffix such as: