ojtests: Split out public/boot tests and add device targets
* Enable tests to be run from CTS (without changing bootclasspath)
* Fix host test script to pass higher heap maximum
* Include test source code as part of the core-ojtests-public.jar
Bug: 27521545
Bug: 27797922
Change-Id: Ibd5ac74c939d1252e17dab2dc22d2a00de837bfd
(cherry picked from commit ce0115e08189fcb96f990f0b93a6c2aeae59250e)
diff --git a/JavaLibrary.mk b/JavaLibrary.mk
index 18ca800..6114ad2 100644
--- a/JavaLibrary.mk
+++ b/JavaLibrary.mk
@@ -325,7 +325,7 @@
include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
endif
-# Make the core-ojtests library.
+# Make the core-ojtests-hostdex library.
ifeq ($(LIBCORE_SKIP_TESTS),)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(ojtest_src_files)
@@ -340,6 +340,43 @@
include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
endif
+# Make the core-ojtests library.
+ifeq ($(LIBCORE_SKIP_TESTS),)
+ include $(CLEAR_VARS)
+ LOCAL_NO_STANDARD_LIBRARIES := true
+ LOCAL_JAVA_LIBRARIES := core-oj core-libart core-lambda-stubs okhttp bouncycastle
+ LOCAL_STATIC_JAVA_LIBRARIES := testng
+ LOCAL_JAVACFLAGS := $(local_javac_flags)
+ LOCAL_MODULE_TAGS := optional
+ LOCAL_JAVA_LANGUAGE_VERSION := 1.8
+ LOCAL_MODULE := core-ojtests
+ LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/JavaLibrary.mk
+ # jack bug workaround: int[] java.util.stream.StatefulTestOp.-getjava-util-stream-StreamShapeSwitchesValues() is a private synthetic method in an interface which causes a hard verifier error
+ LOCAL_DEX_PREOPT := false # disable AOT preverification which breaks the build. it will still throw VerifyError at runtime.
+ include $(BUILD_JAVA_LIBRARY)
+endif
+
+
+# Make the core-ojtests-public library. Excludes any private API tests.
+ifeq ($(LIBCORE_SKIP_TESTS),)
+ include $(CLEAR_VARS)
+ # Filter out SerializedLambdaTest because it depends on stub classes and won't actually run.
+ LOCAL_SRC_FILES := $(filter-out %/DeserializeMethodTest.java %/SerializedLambdaTest.java ojluni/src/test/java/util/stream/boot%,$(ojtest_src_files)) # Do not include anything from the boot* directories. Those directories need a custom bootclasspath to run.
+ # Include source code as part of JAR
+ LOCAL_JAVA_RESOURCE_DIRS := ojluni/src/test/dist
+ LOCAL_NO_STANDARD_LIBRARIES := true
+ LOCAL_JAVA_LIBRARIES := core-oj core-libart core-lambda-stubs okhttp bouncycastle testng
+ LOCAL_JAVACFLAGS := $(local_javac_flags)
+ LOCAL_MODULE_TAGS := optional
+ LOCAL_JAVA_LANGUAGE_VERSION := 1.8
+ LOCAL_MODULE := core-ojtests-public
+ LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/JavaLibrary.mk
+ # jack bug workaround: int[] java.util.stream.StatefulTestOp.-getjava-util-stream-StreamShapeSwitchesValues() is a private synthetic method in an interface which causes a hard verifier error
+ LOCAL_DEX_PREOPT := false # disable AOT preverification which breaks the build. it will still throw VerifyError at runtime.
+ include $(BUILD_JAVA_LIBRARY)
+endif
+
+
endif # HOST_OS == linux
#