Compute PPID at ninja time

Using $(shell $$PPID) to compute PPID will return the pid of kati, which
will be the same for multiple sequential runs of make without changing
any makefiles.  Replace it with a bash subshell command to return the pid
of ninja, which will be different for every call to make.

ART_HOST_TEST_DIR now contains $ that need to propagate to the final
bash command, and must be evaluated exactly once.  Escape the $ in
${ART_HOST_TEST_DIR} in define-test-art-run-test so that
${ART_HOST_TEST_DIR} is not substituted in the function call to prevent
evaluating its contents in the $(eval) that wraps it, which would
substitute out the necessary $.

Test: m -j test-art-host
Change-Id: I3303805481cc1c77d1a321674e8c7c003043a7c4
diff --git a/build/Android.common_test.mk b/build/Android.common_test.mk
index 449502c..06485ca 100644
--- a/build/Android.common_test.mk
+++ b/build/Android.common_test.mk
@@ -21,9 +21,9 @@
 
 # Directory used for temporary test files on the host.
 ifneq ($(TMPDIR),)
-ART_HOST_TEST_DIR := $(TMPDIR)/test-art-$(shell echo $$PPID)
+ART_HOST_TEST_DIR := $(TMPDIR)/test-art-$$(echo $$PPID)
 else
-ART_HOST_TEST_DIR := /tmp/$(USER)/test-art-$(shell echo $$PPID)
+ART_HOST_TEST_DIR := /tmp/$(USER)/test-art-$$(echo $$PPID)
 endif
 
 # List of known broken tests that we won't attempt to execute. The test name must be the full
diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk
index 211a69f..33108dd 100644
--- a/test/Android.run-test.mk
+++ b/test/Android.run-test.mk
@@ -1040,7 +1040,7 @@
     endif
   endif
   run_test_rule_name := test-art-$(1)-run-test-$(2)-$(3)-$(4)-$(5)-$(6)-$(7)-$(8)-$(9)-$(10)-$(11)-$(12)$(13)
-  run_test_options := --output-path $(ART_HOST_TEST_DIR)/run-test-output/$$(run_test_rule_name) \
+  run_test_options := --output-path $$(ART_HOST_TEST_DIR)/run-test-output/$$(run_test_rule_name) \
       $$(run_test_options)
   ifneq ($(ART_TEST_ANDROID_ROOT),)
     run_test_options := --android-root $(ART_TEST_ANDROID_ROOT) $$(run_test_options)