Interpreter oat tests.

Add interpreter oat and run-tests as part of test-art-host.

Change-Id: Id44aab9f3f8a6cd88b4cdf853394c043e198f4eb
diff --git a/Android.mk b/Android.mk
index 3a4ff79..0700b6c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -127,11 +127,11 @@
 	@echo test-art-gtest PASSED
 
 .PHONY: test-art-oat
-test-art-oat: test-art-host-oat test-art-target-oat
+test-art-oat: test-art-host-oat test-art-target-oat test-art-host-interpreter-oat
 	@echo test-art-oat PASSED
 
 .PHONY: test-art-run-test
-test-art-run-test: test-art-host-run-test test-art-target-run-test
+test-art-run-test: test-art-host-run-test test-art-target-run-test test-art-host-interpreter-run-test
 	@echo test-art-run-test PASSED
 
 ########################################################################
@@ -139,9 +139,13 @@
 
 # "mm test-art-host" to build and run all host tests
 .PHONY: test-art-host
-test-art-host: test-art-host-gtest test-art-host-oat test-art-host-run-test
+test-art-host: test-art-host-gtest test-art-host-oat test-art-host-run-test test-art-host-interpreter
 	@echo test-art-host PASSED
 
+.PHONY: test-art-host-interpreter
+test-art-host-interpreter: test-art-host-interpreter-oat test-art-host-interpreter-run-test
+	@echo test-art-host-interpreter PASSED
+
 .PHONY: test-art-host-dependencies
 test-art-host-dependencies: $(ART_HOST_TEST_DEPENDENCIES) $(HOST_OUT_SHARED_LIBRARIES)/libarttest$(ART_HOST_SHLIB_EXTENSION)
 
@@ -169,6 +173,10 @@
 test-art-host-oat: $(ART_TEST_HOST_OAT_TARGETS)
 	@echo test-art-host-oat PASSED
 
+.PHONY: test-art-host-interpreter-oat
+test-art-host-interpreter-oat: $(ART_TEST_HOST_INTERPRETER_OAT_TARGETS)
+	@echo test-art-host-interpreter-oat PASSED
+
 define declare-test-art-host-run-test
 .PHONY: test-art-host-run-test-$(1)
 test-art-host-run-test-$(1): test-art-host-dependencies
diff --git a/build/Android.oattest.mk b/build/Android.oattest.mk
index 7fa7bbf..caf0415 100644
--- a/build/Android.oattest.mk
+++ b/build/Android.oattest.mk
@@ -52,6 +52,7 @@
 
 ART_TEST_TARGET_OAT_TARGETS :=
 ART_TEST_HOST_OAT_TARGETS :=
+ART_TEST_HOST_INTERPRETER_OAT_TARGETS :=
 
 # $(1): directory
 # $(2): arguments
@@ -75,9 +76,20 @@
           && echo test-art-host-oat-$(1) PASSED || (echo test-art-host-oat-$(1) FAILED && exit 1)
 	$(hide) rm -r /tmp/android-data/test-art-host-oat-$(1)
 
+.PHONY: test-art-host-interpreter-oat-$(1)
+test-art-host-interpreter-oat-$(1): $(ART_TEST_OUT)/oat-test-dex-$(1).jar test-art-host-dependencies
+	mkdir -p /tmp/android-data/test-art-host-interpreter-oat-$(1)
+	$(DEX2OAT) --runtime-arg -Xms16m --runtime-arg -Xmx16m --boot-image=$(HOST_CORE_IMG_OUT) --dex-file=$(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar --oat-file=$(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar.oat --instruction-set=$(HOST_ARCH) --host-prefix=""
+	ANDROID_DATA=/tmp/android-data/test-art-host-interpreter-oat-$(1) \
+	  ANDROID_ROOT=$(HOST_OUT) \
+	  LD_LIBRARY_PATH=$(HOST_OUT_SHARED_LIBRARIES) \
+	  oatexecd -Ximage:$(shell pwd)/$(HOST_CORE_IMG_OUT) -Xint -classpath $(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar -Djava.library.path=$(HOST_OUT_SHARED_LIBRARIES) $(1) $(2) \
+          && echo test-art-host-interpreter-oat-$(1) PASSED || (echo test-art-host-interpreter-oat-$(1) FAILED && exit 1)
+	$(hide) rm -r /tmp/android-data/test-art-host-interpreter-oat-$(1)
 
 ART_TEST_TARGET_OAT_TARGETS += test-art-target-oat-$(1)
 ART_TEST_HOST_OAT_TARGETS += test-art-host-oat-$(1)
+ART_TEST_HOST_INTERPRETER_OAT_TARGETS += test-art-host-interpreter-oat-$(1)
 endef
 $(foreach dir,$(TEST_OAT_DIRECTORIES), $(eval $(call declare-test-art-oat-targets,$(dir))))