Move ART_HOST_TEST_DIR to Android.common_test.mk

I'm improving Kati's re-run detection, and this $(shell echo $$PPID) now
now causes us to reparse all of the makefiles every time, since it
really does change on each execution. But if you aren't running the ART
tests, this doesn't actually get used.

So punt this over to only executing when you're including the test
runner -- it's not ideal, since you'll be reparsing the makefiles every
time you want to run the tests. Depending on the desired behavior, this
should be able to be implemented without depending on the PID of Kati,
or the test runner can be moved out of the build system, since most of
the builds here have moved to Soong now.

Bug: 30947985
Test: Compare build.ninja before and after this change, only change is
      the valgrind-test-art-target* targets.
Test: m -j test-art-host
Change-Id: Ibbc0f20e407bf70bce64d3428be5808d78bdaf91
diff --git a/Android.mk b/Android.mk
index a1479e1..3740ed8 100644
--- a/Android.mk
+++ b/Android.mk
@@ -328,8 +328,6 @@
 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
 endif
 
-endif  # art_test_bother
-
 # Valgrind.
 .PHONY: valgrind-test-art-target
 valgrind-test-art-target: valgrind-test-art-target-gtest
@@ -343,6 +341,8 @@
 valgrind-test-art-target64: valgrind-test-art-target-gtest64
 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
 
+endif  # art_test_bother
+
 ########################################################################
 # oat-target and oat-target-sync rules
 
diff --git a/build/Android.common_path.mk b/build/Android.common_path.mk
index 00d29b9..e568ce2 100644
--- a/build/Android.common_path.mk
+++ b/build/Android.common_path.mk
@@ -35,13 +35,6 @@
 ART_TARGET_TEST_DIR := /data/art-test
 ART_TARGET_TEST_OUT := $(TARGET_OUT_DATA)/art-test
 
-# Directory used for temporary test files on the host.
-ifneq ($(TMPDIR),)
-ART_HOST_TEST_DIR := $(TMPDIR)/test-art-$(shell echo $$PPID)
-else
-ART_HOST_TEST_DIR := /tmp/$(USER)/test-art-$(shell echo $$PPID)
-endif
-
 # core.oat location on the device.
 TARGET_CORE_OAT := $(ART_TARGET_TEST_DIR)/$(DEX2OAT_TARGET_ARCH)/core.oat
 ifdef TARGET_2ND_ARCH
diff --git a/build/Android.common_test.mk b/build/Android.common_test.mk
index 6b7dc09..8124ca3 100644
--- a/build/Android.common_test.mk
+++ b/build/Android.common_test.mk
@@ -19,6 +19,13 @@
 
 include art/build/Android.common_path.mk
 
+# Directory used for temporary test files on the host.
+ifneq ($(TMPDIR),)
+ART_HOST_TEST_DIR := $(TMPDIR)/test-art-$(shell echo $$PPID)
+else
+ART_HOST_TEST_DIR := /tmp/$(USER)/test-art-$(shell echo $$PPID)
+endif
+
 # We need to set a define for the nativetest dir so that common_runtime_test will know the right
 # path. (The problem is being a 32b test on 64b device, which is still located in nativetest64).
 ART_TARGET_CFLAGS += -DART_TARGET_NATIVETEST_DIR=${ART_TARGET_NATIVETEST_DIR}
diff --git a/tools/ahat/Android.mk b/tools/ahat/Android.mk
index 60e0cd8e..4003ee0 100644
--- a/tools/ahat/Android.mk
+++ b/tools/ahat/Android.mk
@@ -16,7 +16,7 @@
 
 LOCAL_PATH := $(call my-dir)
 
-include art/build/Android.common_test.mk
+include art/build/Android.common_path.mk
 
 # --- ahat.jar ----------------
 include $(CLEAR_VARS)