diff options
author | Brian Carlstrom <bdc@google.com> | 2011-08-28 22:41:38 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2011-08-29 09:50:10 -0700 |
commit | 9f30b38d74990286ce27c3a45368f73dbe3638f0 (patch) | |
tree | 81bddd7b70e4b58aadce258cc25bba64de030deb | |
parent | 4417536522fd2a9d8215d8672331984769c9520b (diff) | |
download | android_art-9f30b38d74990286ce27c3a45368f73dbe3638f0.tar.gz android_art-9f30b38d74990286ce27c3a45368f73dbe3638f0.tar.bz2 android_art-9f30b38d74990286ce27c3a45368f73dbe3638f0.zip |
Externalize test code
Change-Id: Iab19397c7a72fb9a3ca63bfd0bc4eaf1a98138ba
33 files changed, 1161 insertions, 1531 deletions
diff --git a/Android.mk b/Android.mk index 27b4a72f4e..d23b75ed8d 100644 --- a/Android.mk +++ b/Android.mk @@ -42,24 +42,27 @@ define run-host-tests-with $(foreach file,$(sort $(ART_HOST_TEST_EXECUTABLES)),$(1) $(file) &&) true endef +ART_HOST_TEST_DEPENDENCIES := $(ART_HOST_TEST_EXECUTABLES) $(ANDROID_HOST_OUT)/framework/core-hostdex.jar $(ART_TEST_DEX_FILES) +ART_TARGET_TEST_DEPENDENCIES := $(ART_TARGET_TEST_EXECUTABLES) $(ANDROID_PRODUCT_OUT)/system/framework/core.jar $(ART_TEST_DEX_FILES) + # "mm test-art-host" to build and run all host tests .PHONY: test-art-host -test-art-host: $(ART_HOST_TEST_EXECUTABLES) $(ANDROID_HOST_OUT)/framework/core-hostdex.jar +test-art-host: $(ART_HOST_TEST_DEPENDENCIES) $(call run-host-tests-with,) # "mm valgrind-art-host" to build and run all host tests under valgrind. .PHONY: valgrind-art-host -valgrind-art-host: $(ART_HOST_TEST_EXECUTABLES) $(ANDROID_HOST_OUT)/framework/core-hostdex.jar +valgrind-art-host: $(ART_HOST_TEST_DEPENDENCIES) $(call run-host-tests-with,"valgrind") # "mm tsan-art-host" to build and run all host tests under tsan. .PHONY: tsan-art-host -tsan-art-host: $(ART_HOST_TEST_EXECUTABLES) $(ANDROID_HOST_OUT)/framework/core-hostdex.jar +tsan-art-host: $(ART_HOST_TEST_DEPENDENCIES) $(call run-host-tests-with,"tsan") # "mm test-art-device" to build and run all target tests .PHONY: test-art-target -test-art-target: $(ART_TARGET_TEST_EXECUTABLES) $(ANDROID_PRODUCT_OUT)/system/framework/core.jar +test-art-target: $(ART_TARGET_TEST_DEPENDENCIES) adb remount adb sync adb shell touch /sdcard/test-art-target diff --git a/build/Android.common.mk b/build/Android.common.mk index cab1572a9d..a801889731 100644 --- a/build/Android.common.mk +++ b/build/Android.common.mk @@ -141,3 +141,20 @@ TEST_HOST_SRC_FILES := \ $(TEST_COMMON_SRC_FILES) \ src/assembler_x86_test.cc \ src/managed_register_x86_test.cc + +# subdirectories of test/ +TEST_DEX_DIRECTORIES := \ + AllFields \ + CreateMethodDescriptor \ + Fibonacci \ + IntMath \ + Interfaces \ + Main \ + MyClass \ + MyClassNatives \ + Nested \ + ProtoCompare \ + ProtoCompare2 \ + StaticLeafMethods \ + Statics \ + XandY diff --git a/build/Android.test.mk b/build/Android.test.mk index 22209ec72e..d940a1ded9 100644 --- a/build/Android.test.mk +++ b/build/Android.test.mk @@ -47,7 +47,6 @@ define build-art-test ART_TARGET_TEST_EXECUTABLES += $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE) else ART_HOST_TEST_EXECUTABLES += $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE) - LOCAL_LDFLAGS += -ldl -lpthread endif endef @@ -55,3 +54,18 @@ $(foreach file,$(TEST_TARGET_SRC_FILES), $(eval $(call build-art-test,target,$(f ifeq ($(WITH_HOST_DALVIK),true) $(foreach file,$(TEST_HOST_SRC_FILES), $(eval $(call build-art-test,host,$(file)))) endif + +ART_TEST_DEX_FILES := + +# $(1): directory +define build-art-test-dex + include $(CLEAR_VARS) + LOCAL_MODULE := art-test-dex-$(1) + LOCAL_MODULE_TAGS := optional + LOCAL_SRC_FILES := $(call all-java-files-under, test/$(1)) + # TODO: remove --core-library when separate compilation works + LOCAL_DX_FLAGS := --core-library + include $(BUILD_JAVA_LIBRARY) + ART_TEST_DEX_FILES += $(TARGET_OUT_JAVA_LIBRARIES)/$$(LOCAL_MODULE).jar +endef +$(foreach dir,$(TEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,$(dir)))) diff --git a/src/class_linker_test.cc b/src/class_linker_test.cc index 8de8ba17e5..201db45b30 100644 --- a/src/class_linker_test.cc +++ b/src/class_linker_test.cc @@ -273,7 +273,7 @@ TEST_F(ClassLinkerTest, FindClassNonexistent) { } TEST_F(ClassLinkerTest, FindClassNested) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kNestedDex, "kNestedDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("Nested")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); Class* outer = class_linker_->FindClass("LNested;", class_loader); @@ -328,7 +328,7 @@ TEST_F(ClassLinkerTest, FindClass) { EXPECT_EQ(0U, JavaLangObject->NumStaticFields()); EXPECT_EQ(0U, JavaLangObject->NumInterfaces()); - scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassDex, "kMyClassDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("MyClass")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); AssertNonExistentClass("LMyClass;"); Class* MyClass = class_linker_->FindClass("LMyClass;", class_loader); @@ -451,8 +451,8 @@ TEST_F(ClassLinkerTest, ValidatePrimitiveArrayElementsOffset) { } TEST_F(ClassLinkerTest, TwoClassLoadersOneClass) { - scoped_ptr<DexFile> dex_1(OpenDexFileBase64(kMyClassDex, "kMyClassDex")); - scoped_ptr<DexFile> dex_2(OpenDexFileBase64(kMyClassDex, "kMyClassDex")); + scoped_ptr<const DexFile> dex_1(OpenTestDexFile("MyClass")); + scoped_ptr<const DexFile> dex_2(OpenTestDexFile("MyClass")); PathClassLoader* class_loader_1 = AllocPathClassLoader(dex_1.get()); PathClassLoader* class_loader_2 = AllocPathClassLoader(dex_2.get()); Class* MyClass_1 = class_linker_->FindClass("LMyClass;", class_loader_1); @@ -464,7 +464,7 @@ TEST_F(ClassLinkerTest, TwoClassLoadersOneClass) { TEST_F(ClassLinkerTest, StaticFields) { // TODO: uncomment expectations of initial values when InitializeClass works - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStatics, "kStatics")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("Statics")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); Class* statics = class_linker_->FindClass("LStatics;", class_loader); class_linker_->EnsureInitialized(statics); @@ -534,7 +534,7 @@ TEST_F(ClassLinkerTest, StaticFields) { } TEST_F(ClassLinkerTest, Interfaces) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kInterfacesDex, "kInterfacesDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("Interfaces")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); Class* I = class_linker_->FindClass("LInterfaces$I;", class_loader); Class* J = class_linker_->FindClass("LInterfaces$J;", class_loader); diff --git a/src/common_test.h b/src/common_test.h index e56a3a01c5..aa9229ecde 100644 --- a/src/common_test.h +++ b/src/common_test.h @@ -19,407 +19,13 @@ namespace art { -// package java.lang; -// public class Object {} -// -// class MyClass {} -static const char kMyClassDex[] = - "ZGV4CjAzNQA5Nm9IrCVm91COwepff7LhIE23GZIxGjgIAgAAcAAAAHhWNBIAAAAAAAAAAIABAAAG" - "AAAAcAAAAAMAAACIAAAAAQAAAJQAAAAAAAAAAAAAAAIAAACgAAAAAgAAALAAAAAYAQAA8AAAABwB" - "AAAkAQAALwEAAEMBAABRAQAAXgEAAAEAAAACAAAABQAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAQAA" - "AAAAAAABAAAAAQAAAP////8AAAAABAAAAAAAAABrAQAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAA" - "AAAAAHUBAAAAAAAAAQABAAAAAABhAQAAAQAAAA4AAAABAAEAAQAAAGYBAAAEAAAAcBABAAAADgAG" - "PGluaXQ+AAlMTXlDbGFzczsAEkxqYXZhL2xhbmcvT2JqZWN0OwAMTXlDbGFzcy5qYXZhAAtPYmpl" - "Y3QuamF2YQABVgACAAcOAAUABw4AAAABAAGBgATwAQAAAQAAgIAEhAIACwAAAAAAAAABAAAAAAAA" - "AAEAAAAGAAAAcAAAAAIAAAADAAAAiAAAAAMAAAABAAAAlAAAAAUAAAACAAAAoAAAAAYAAAACAAAA" - "sAAAAAEgAAACAAAA8AAAAAIgAAAGAAAAHAEAAAMgAAACAAAAYQEAAAAgAAACAAAAawEAAAAQAAAB" - "AAAAgAEAAA=="; - -// class Nested { -// class Inner { -// } -// } -static const char kNestedDex[] = - "ZGV4CjAzNQAQedgAe7gM1B/WHsWJ6L7lGAISGC7yjD2IAwAAcAAAAHhWNBIAAAAAAAAAAMQCAAAP" - "AAAAcAAAAAcAAACsAAAAAgAAAMgAAAABAAAA4AAAAAMAAADoAAAAAgAAAAABAABIAgAAQAEAAK4B" - "AAC2AQAAvQEAAM0BAADXAQAA+wEAABsCAAA+AgAAUgIAAF8CAABiAgAAZgIAAHMCAAB5AgAAgQIA" - "AAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAkAAAAJAAAABgAAAAAAAAAKAAAABgAAAKgBAAAAAAEA" - "DQAAAAAAAQAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAIAAAAiAEAAKsCAAAA" - "AAAAAQAAAAAAAAAFAAAAAAAAAAgAAACYAQAAuAIAAAAAAAACAAAAlAIAAJoCAAABAAAAowIAAAIA" - "AgABAAAAiAIAAAYAAABbAQAAcBACAAAADgABAAEAAQAAAI4CAAAEAAAAcBACAAAADgBAAQAAAAAA" - "AAAAAAAAAAAATAEAAAAAAAAAAAAAAAAAAAEAAAABAAY8aW5pdD4ABUlubmVyAA5MTmVzdGVkJElu" - "bmVyOwAITE5lc3RlZDsAIkxkYWx2aWsvYW5ub3RhdGlvbi9FbmNsb3NpbmdDbGFzczsAHkxkYWx2" - "aWsvYW5ub3RhdGlvbi9Jbm5lckNsYXNzOwAhTGRhbHZpay9hbm5vdGF0aW9uL01lbWJlckNsYXNz" - "ZXM7ABJMamF2YS9sYW5nL09iamVjdDsAC05lc3RlZC5qYXZhAAFWAAJWTAALYWNjZXNzRmxhZ3MA" - "BG5hbWUABnRoaXMkMAAFdmFsdWUAAgEABw4AAQAHDjwAAgIBDhgBAgMCCwQADBcBAgQBDhwBGAAA" - "AQEAAJAgAICABNQCAAABAAGAgATwAgAAEAAAAAAAAAABAAAAAAAAAAEAAAAPAAAAcAAAAAIAAAAH" - "AAAArAAAAAMAAAACAAAAyAAAAAQAAAABAAAA4AAAAAUAAAADAAAA6AAAAAYAAAACAAAAAAEAAAMQ" - "AAACAAAAQAEAAAEgAAACAAAAVAEAAAYgAAACAAAAiAEAAAEQAAABAAAAqAEAAAIgAAAPAAAArgEA" - "AAMgAAACAAAAiAIAAAQgAAADAAAAlAIAAAAgAAACAAAAqwIAAAAQAAABAAAAxAIAAA=="; - -// class ProtoCompare { -// int m1(short x, int y, long z) { return x + y + (int)z; } -// int m2(short x, int y, long z) { return x + y + (int)z; } -// int m3(long x, int y, short z) { return (int)x + y + z; } -// long m4(long x, int y, short z) { return x + y + z; } -// } -static const char kProtoCompareDex[] = - "ZGV4CjAzNQBLUetu+TVZ8gsYsCOFoij7ecsHaGSEGA8gAwAAcAAAAHhWNBIAAAAAAAAAAIwCAAAP" - "AAAAcAAAAAYAAACsAAAABAAAAMQAAAAAAAAAAAAAAAYAAAD0AAAAAQAAACQBAADcAQAARAEAAN4B" - "AADmAQAA6QEAAO8BAAD1AQAA+AEAAP4BAAAOAgAAIgIAADUCAAA4AgAAOwIAAD8CAABDAgAARwIA" - "AAEAAAAEAAAABgAAAAcAAAAJAAAACgAAAAIAAAAAAAAAyAEAAAMAAAAAAAAA1AEAAAUAAAABAAAA" - "yAEAAAoAAAAFAAAAAAAAAAIAAwAAAAAAAgABAAsAAAACAAEADAAAAAIAAAANAAAAAgACAA4AAAAD" - "AAMAAAAAAAIAAAAAAAAAAwAAAAAAAAAIAAAAAAAAAHACAAAAAAAAAQABAAEAAABLAgAABAAAAHAQ" - "BQAAAA4ABwAFAAAAAABQAgAABQAAAJAAAwSEUbAQDwAAAAcABQAAAAAAWAIAAAUAAACQAAMEhFGw" - "EA8AAAAGAAUAAAAAAGACAAAEAAAAhCCwQLBQDwAJAAUAAAAAAGgCAAAFAAAAgXC7UIGCuyAQAAAA" - "AwAAAAEAAAAEAAAAAwAAAAQAAAABAAY8aW5pdD4AAUkABElKSVMABElTSUoAAUoABEpKSVMADkxQ" - "cm90b0NvbXBhcmU7ABJMamF2YS9sYW5nL09iamVjdDsAEVByb3RvQ29tcGFyZS5qYXZhAAFTAAFW" - "AAJtMQACbTIAAm0zAAJtNAABAAcOAAIDAAAABw4AAwMAAAAHDgAEAwAAAAcOAAUDAAAABw4AAAAB" - "BACAgATEAgEA3AIBAPgCAQCUAwEArAMAAAwAAAAAAAAAAQAAAAAAAAABAAAADwAAAHAAAAACAAAA" - "BgAAAKwAAAADAAAABAAAAMQAAAAFAAAABgAAAPQAAAAGAAAAAQAAACQBAAABIAAABQAAAEQBAAAB" - "EAAAAgAAAMgBAAACIAAADwAAAN4BAAADIAAABQAAAEsCAAAAIAAAAQAAAHACAAAAEAAAAQAAAIwC" - "AAA="; - -// class ProtoCompare2 { -// int m1(short x, int y, long z) { return x + y + (int)z; } -// int m2(short x, int y, long z) { return x + y + (int)z; } -// int m3(long x, int y, short z) { return (int)x + y + z; } -// long m4(long x, int y, short z) { return x + y + z; } -// } -static const char kProtoCompare2Dex[] = - "ZGV4CjAzNQDVUXj687EpyTTDJZEZPA8dEYnDlm0Ir6YgAwAAcAAAAHhWNBIAAAAAAAAAAIwCAAAP" - "AAAAcAAAAAYAAACsAAAABAAAAMQAAAAAAAAAAAAAAAYAAAD0AAAAAQAAACQBAADcAQAARAEAAN4B" - "AADmAQAA6QEAAO8BAAD1AQAA+AEAAP4BAAAPAgAAIwIAADcCAAA6AgAAPQIAAEECAABFAgAASQIA" - "AAEAAAAEAAAABgAAAAcAAAAJAAAACgAAAAIAAAAAAAAAyAEAAAMAAAAAAAAA1AEAAAUAAAABAAAA" - "yAEAAAoAAAAFAAAAAAAAAAIAAwAAAAAAAgABAAsAAAACAAEADAAAAAIAAAANAAAAAgACAA4AAAAD" - "AAMAAAAAAAIAAAAAAAAAAwAAAAAAAAAIAAAAAAAAAHICAAAAAAAAAQABAAEAAABNAgAABAAAAHAQ" - "BQAAAA4ABwAFAAAAAABSAgAABQAAAJAAAwSEUbAQDwAAAAcABQAAAAAAWgIAAAUAAACQAAMEhFGw" - "EA8AAAAGAAUAAAAAAGICAAAEAAAAhCCwQLBQDwAJAAUAAAAAAGoCAAAFAAAAgXC7UIGCuyAQAAAA" - "AwAAAAEAAAAEAAAAAwAAAAQAAAABAAY8aW5pdD4AAUkABElKSVMABElTSUoAAUoABEpKSVMAD0xQ" - "cm90b0NvbXBhcmUyOwASTGphdmEvbGFuZy9PYmplY3Q7ABJQcm90b0NvbXBhcmUyLmphdmEAAVMA" - "AVYAAm0xAAJtMgACbTMAAm00AAEABw4AAgMAAAAHDgADAwAAAAcOAAQDAAAABw4ABQMAAAAHDgAA" - "AAEEAICABMQCAQDcAgEA+AIBAJQDAQCsAwwAAAAAAAAAAQAAAAAAAAABAAAADwAAAHAAAAACAAAA" - "BgAAAKwAAAADAAAABAAAAMQAAAAFAAAABgAAAPQAAAAGAAAAAQAAACQBAAABIAAABQAAAEQBAAAB" - "EAAAAgAAAMgBAAACIAAADwAAAN4BAAADIAAABQAAAE0CAAAAIAAAAQAAAHICAAAAEAAAAQAAAIwC" - "AAA="; - -// javac MyClass.java && dx --dex --output=MyClass.dex -// --core-library MyClass.class java/lang/Object.class && base64 MyClass.dex -// package java.lang; -// public class Object {} -// class MyClass { -// native void foo(); -// native int fooI(int x); -// native int fooII(int x, int y); -// native double fooDD(double x, double y); -// native Object fooIOO(int x, Object y, Object z); -// static native Object fooSIOO(int x, Object y, Object z); -// static synchronized native Object fooSSIOO(int x, Object y, Object z); -// } -static const char kMyClassNativesDex[] = - "ZGV4CjAzNQA4WWrpXgdlkoTHR8Yubx4LJO4HbGsX1p1EAwAAcAAAAHhWNBIAAAAAAAAAALACAAAT" - "AAAAcAAAAAUAAAC8AAAABQAAANAAAAAAAAAAAAAAAAkAAAAMAQAAAgAAAFQBAACwAQAAlAEAAOIB" - "AADqAQAA7QEAAPIBAAD1AQAA+QEAAP4BAAAEAgAADwIAACMCAAAxAgAAPgIAAEECAABGAgAATQIA" - "AFMCAABaAgAAYgIAAGsCAAABAAAAAwAAAAcAAAAIAAAACwAAAAIAAAAAAAAAwAEAAAQAAAABAAAA" - "yAEAAAUAAAABAAAA0AEAAAYAAAADAAAA2AEAAAsAAAAEAAAAAAAAAAIABAAAAAAAAgAEAAwAAAAC" - "AAAADQAAAAIAAQAOAAAAAgACAA8AAAACAAMAEAAAAAIAAwARAAAAAgADABIAAAADAAQAAAAAAAMA" - "AAABAAAA/////wAAAAAKAAAAAAAAAH8CAAAAAAAAAgAAAAAAAAADAAAAAAAAAAkAAAAAAAAAiQIA" - "AAAAAAABAAEAAAAAAHUCAAABAAAADgAAAAEAAQABAAAAegIAAAQAAABwEAgAAAAOAAIAAAAAAAAA" - "AQAAAAEAAAACAAAAAQABAAMAAAABAAMAAwAGPGluaXQ+AAFEAANEREQAAUkAAklJAANJSUkABExJ" - "TEwACUxNeUNsYXNzOwASTGphdmEvbGFuZy9PYmplY3Q7AAxNeUNsYXNzLmphdmEAC09iamVjdC5q" - "YXZhAAFWAANmb28ABWZvb0REAARmb29JAAVmb29JSQAGZm9vSU9PAAdmb29TSU9PAAhmb29TU0lP" - "TwADAAcOAAEABw4AAAABAAiBgASUAwAAAwUAgIAEqAMGiAIAAaiCCAABgAIAAYACAAGAAgABgAIA" - "AYACAAwAAAAAAAAAAQAAAAAAAAABAAAAEwAAAHAAAAACAAAABQAAALwAAAADAAAABQAAANAAAAAF" - "AAAACQAAAAwBAAAGAAAAAgAAAFQBAAABIAAAAgAAAJQBAAABEAAABAAAAMABAAACIAAAEwAAAOIB" - "AAADIAAAAgAAAHUCAAAAIAAAAgAAAH8CAAAAEAAAAQAAALACAAA="; - -// class CreateMethodDescriptor { -// Float m1(int a, double b, long c, Object d) { return null; } -// CreateMethodDescriptor m2(boolean x, short y, char z) { return null; } -// } -static const char kCreateMethodDescriptorDex[] = - "ZGV4CjAzNQBSU7aKdNXwH+uOpti/mvZ4/Dk8wM8VtNbgAgAAcAAAAHhWNBIAAAAAAAAAAEwCAAAQ" - "AAAAcAAAAAoAAACwAAAAAwAAANgAAAAAAAAAAAAAAAQAAAD8AAAAAQAAABwBAACkAQAAPAEAAJQB" - "AACcAQAAnwEAALwBAAC/AQAAwgEAAMUBAADfAQAA5gEAAOwBAAD/AQAAEwIAABYCAAAZAgAAHAIA" - "ACACAAABAAAAAwAAAAQAAAAFAAAABgAAAAkAAAAKAAAACwAAAAwAAAANAAAACAAAAAQAAAB8AQAA" - "BwAAAAUAAACIAQAADAAAAAgAAAAAAAAABAACAAAAAAAEAAEADgAAAAQAAAAPAAAABgACAAAAAAAE" - "AAAAAAAAAAYAAAAAAAAAAgAAAAAAAAA6AgAAAAAAAAEAAQABAAAAJAIAAAQAAABwEAMAAAAOAAgA" - "BwAAAAAAKQIAAAIAAAASABEABQAEAAAAAAAyAgAAAgAAABIAEQADAAAACQAHAAAAAAAEAAAAAgAB" - "AAMABgAGPGluaXQ+AAFDABtDcmVhdGVNZXRob2REZXNjcmlwdG9yLmphdmEAAUQAAUkAAUoAGExD" - "cmVhdGVNZXRob2REZXNjcmlwdG9yOwAFTElESkwABExaU0MAEUxqYXZhL2xhbmcvRmxvYXQ7ABJM" - "amF2YS9sYW5nL09iamVjdDsAAVMAAVYAAVoAAm0xAAJtMgABAAcOAAIEAAAAAAcOAAMDAAAABw4A" - "AAABAgCAgAS8AgEA1AIBAOgCDAAAAAAAAAABAAAAAAAAAAEAAAAQAAAAcAAAAAIAAAAKAAAAsAAA" - "AAMAAAADAAAA2AAAAAUAAAAEAAAA/AAAAAYAAAABAAAAHAEAAAEgAAADAAAAPAEAAAEQAAACAAAA" - "fAEAAAIgAAAQAAAAlAEAAAMgAAADAAAAJAIAAAAgAAABAAAAOgIAAAAQAAABAAAATAIAAA=="; - -// class X {} -// class Y extends X {} -static const char kXandY[] = - "ZGV4CjAzNQAlLMqyB72TxJW4zl5w75F072u4Ig6KvCMEAgAAcAAAAHhWNBIAAAAAAAAAAHwBAAAG" - "AAAAcAAAAAQAAACIAAAAAQAAAJgAAAAAAAAAAAAAAAMAAACkAAAAAgAAALwAAAAIAQAA/AAAACwB" - "AAA0AQAAOQEAAD4BAABSAQAAVQEAAAEAAAACAAAAAwAAAAQAAAAEAAAAAwAAAAAAAAAAAAAAAAAA" - "AAEAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAIAAAAAAAAABQAAAAAAAABnAQAAAAAAAAEAAAAAAAAA" - "AAAAAAAAAAAFAAAAAAAAAHEBAAAAAAAAAQABAAEAAABdAQAABAAAAHAQAgAAAA4AAQABAAEAAABi" - "AQAABAAAAHAQAAAAAA4ABjxpbml0PgADTFg7AANMWTsAEkxqYXZhL2xhbmcvT2JqZWN0OwABVgAG" - "WC5qYXZhAAIABw4AAwAHDgAAAAEAAICABPwBAAABAAGAgASUAgALAAAAAAAAAAEAAAAAAAAAAQAA" - "AAYAAABwAAAAAgAAAAQAAACIAAAAAwAAAAEAAACYAAAABQAAAAMAAACkAAAABgAAAAIAAAC8AAAA" - "ASAAAAIAAAD8AAAAAiAAAAYAAAAsAQAAAyAAAAIAAABdAQAAACAAAAIAAABnAQAAABAAAAEAAAB8" - "AQAA"; - -// class Statics { -// static boolean s0 = true; -// static byte s1 = 5; -// static char s2 = 'a'; -// static short s3 = (short) 65000; -// static int s4 = 2000000000; -// static long s5 = 0x123456789abcdefL; -// static float s6 = 0.5f; -// static double s7 = 16777217; -// static Object s8 = "android"; -// static Object[] s9 = { "a", "b" }; -// } -static const char kStatics[] = - "ZGV4CjAzNQAYalInXcX4y0OBgb2yCw2/jGzZBSe34zmwAwAAcAAAAHhWNBIAAAAAAAAAABwDAAAc" - "AAAAcAAAAAwAAADgAAAAAQAAABABAAAKAAAAHAEAAAMAAABsAQAAAQAAAIQBAAAMAgAApAEAADwC" - "AABGAgAATgIAAFECAABUAgAAVwIAAFoCAABdAgAAYAIAAGsCAAB/AgAAggIAAJACAACTAgAAlgIA" - "AKsCAACuAgAAtwIAALoCAAC+AgAAwgIAAMYCAADKAgAAzgIAANICAADWAgAA2gIAAN4CAAACAAAA" - "AwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACQAAAAoAAAAMAAAADQAAAA4AAAAMAAAACQAAAAAAAAAG" - "AAoAEgAAAAYAAAATAAAABgABABQAAAAGAAgAFQAAAAYABAAWAAAABgAFABcAAAAGAAMAGAAAAAYA" - "AgAZAAAABgAHABoAAAAGAAsAGwAAAAYAAAAAAAAABgAAAAEAAAAHAAAAAQAAAAYAAAAAAAAABwAA" - "AAAAAAALAAAAAAAAAPUCAAAAAAAABAAAAAAAAADiAgAAOAAAABITagMAABJQawABABMAYQBsAAIA" - "EwDo/W0AAwAUAACUNXdnAAQAGADvzauJZ0UjAWgABQAVAAA/ZwAGABgAAAAAEAAAcEFoAAcAGgAQ" - "AGkACAASICMACwASARoCDwBNAgABGgERAE0BAANpAAkADgABAAEAAQAAAPACAAAEAAAAcBACAAAA" - "DgAIPGNsaW5pdD4ABjxpbml0PgABQgABQwABRAABRgABSQABSgAJTFN0YXRpY3M7ABJMamF2YS9s" - "YW5nL09iamVjdDsAAVMADFN0YXRpY3MuamF2YQABVgABWgATW0xqYXZhL2xhbmcvT2JqZWN0OwAB" - "YQAHYW5kcm9pZAABYgACczAAAnMxAAJzMgACczMAAnM0AAJzNQACczYAAnM3AAJzOAACczkAAgAH" - "HS08S0taeEt4SwABAAcOAAoAAgAACAEIAQgBCAEIAQgBCAEIAQgBCACIgASkAwGAgASkBAAAAAwA" - "AAAAAAAAAQAAAAAAAAABAAAAHAAAAHAAAAACAAAADAAAAOAAAAADAAAAAQAAABABAAAEAAAACgAA" - "ABwBAAAFAAAAAwAAAGwBAAAGAAAAAQAAAIQBAAABIAAAAgAAAKQBAAACIAAAHAAAADwCAAADIAAA" - "AgAAAOICAAAAIAAAAQAAAPUCAAAAEAAAAQAAABwDAAA="; - -// class AllFields { -// static boolean sZ; -// static byte sB; -// static char sC; -// static double sD; -// static float sF; -// static int sI; -// static long sJ; -// static short sS; -// static Object sObject; -// static Object[] sObjectArray; -// -// boolean iZ; -// byte iB; -// char iC; -// double iD; -// float iF; -// int iI; -// long iJ; -// short iS; -// Object iObject; -// Object[] iObjectArray; -// } -static const char kAllFields[] = - "ZGV4CjAzNQCdaMDlt1s2Pw65nbVCJcCcZcmroYXvMF/AAwAAcAAAAHhWNBIAAAAAAAAAACwDAAAi" - "AAAAcAAAAAwAAAD4AAAAAQAAACgBAAAUAAAANAEAAAIAAADUAQAAAQAAAOQBAAC8AQAABAIAABwC" - "AAAkAgAANAIAADcCAAA6AgAAPQIAAEACAABDAgAARgIAAFMCAABnAgAAagIAAG0CAABwAgAAhQIA" - "AIkCAACNAgAAkQIAAJUCAACZAgAAnQIAAKYCAAC0AgAAuAIAALwCAADAAgAAxAIAAMgCAADMAgAA" - "0AIAANQCAADdAgAA6wIAAO8CAAACAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACQAAAAoAAAAL" - "AAAADAAAAA0AAAALAAAACQAAAAAAAAAGAAAADgAAAAYAAQAPAAAABgACABAAAAAGAAMAEQAAAAYA" - "BAASAAAABgAFABMAAAAGAAcAFAAAAAYACwAVAAAABgAIABYAAAAGAAoAFwAAAAYAAAAYAAAABgAB" - "ABkAAAAGAAIAGgAAAAYAAwAbAAAABgAEABwAAAAGAAUAHQAAAAYABwAeAAAABgALAB8AAAAGAAgA" - "IAAAAAYACgAhAAAABgAAAAAAAAAHAAAAAAAAAAYAAAAAAAAABwAAAAAAAAABAAAAAAAAAPgCAAAA" - "AAAAAQABAAEAAADzAgAABAAAAHAQAQAAAA4ABjxpbml0PgAOQWxsRmllbGRzLmphdmEAAUIAAUMA" - "AUQAAUYAAUkAAUoAC0xBbGxGaWVsZHM7ABJMamF2YS9sYW5nL09iamVjdDsAAVMAAVYAAVoAE1tM" - "amF2YS9sYW5nL09iamVjdDsAAmlCAAJpQwACaUQAAmlGAAJpSQACaUoAB2lPYmplY3QADGlPYmpl" - "Y3RBcnJheQACaVMAAmlaAAJzQgACc0MAAnNEAAJzRgACc0kAAnNKAAdzT2JqZWN0AAxzT2JqZWN0" - "QXJyYXkAAnNTAAJzWgADAAcOAAoKAQAKCAEIAQgBCAEIAQgBCAEIAQgBCAAAAQABAAEAAQABAAEA" - "AQABAAEAAICABIQEAAAMAAAAAAAAAAEAAAAAAAAAAQAAACIAAABwAAAAAgAAAAwAAAD4AAAAAwAA" - "AAEAAAAoAQAABAAAABQAAAA0AQAABQAAAAIAAADUAQAABgAAAAEAAADkAQAAASAAAAEAAAAEAgAA" - "AiAAACIAAAAcAgAAAyAAAAEAAADzAgAAACAAAAEAAAD4AgAAABAAAAEAAAAsAwAA"; - - -// class Main { -// public static void main(String args[]) { -// } -// } -static const char kMainDex[] = - "ZGV4CjAzNQAPNypTL1TulODHFdpEa2pP98I7InUu7uQgAgAAcAAAAHhWNBIAAAAAAAAAAIwBAAAI" - "AAAAcAAAAAQAAACQAAAAAgAAAKAAAAAAAAAAAAAAAAMAAAC4AAAAAQAAANAAAAAwAQAA8AAAACIB" - "AAAqAQAAMgEAAEYBAABRAQAAVAEAAFgBAABtAQAAAQAAAAIAAAAEAAAABgAAAAQAAAACAAAAAAAA" - "AAUAAAACAAAAHAEAAAAAAAAAAAAAAAABAAcAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAA" - "AAAAAH4BAAAAAAAAAQABAAEAAABzAQAABAAAAHAQAgAAAA4AAQABAAAAAAB4AQAAAQAAAA4AAAAB" - "AAAAAwAGPGluaXQ+AAZMTWFpbjsAEkxqYXZhL2xhbmcvT2JqZWN0OwAJTWFpbi5qYXZhAAFWAAJW" - "TAATW0xqYXZhL2xhbmcvU3RyaW5nOwAEbWFpbgABAAcOAAMBAAcOAAAAAgAAgIAE8AEBCYgCDAAA" - "AAAAAAABAAAAAAAAAAEAAAAIAAAAcAAAAAIAAAAEAAAAkAAAAAMAAAACAAAAoAAAAAUAAAADAAAA" - "uAAAAAYAAAABAAAA0AAAAAEgAAACAAAA8AAAAAEQAAABAAAAHAEAAAIgAAAIAAAAIgEAAAMgAAAC" - "AAAAcwEAAAAgAAABAAAAfgEAAAAQAAABAAAAjAEAAA=="; - -// class StaticLeafMethods { -// static void nop() { -// } -// static byte identity(byte x) { -// return x; -// } -// static int identity(int x) { -// return x; -// } -// static int sum(int a, int b) { -// return a + b; -// } -// static int sum(int a, int b, int c) { -// return a + b + c; -// } -// static int sum(int a, int b, int c, int d) { -// return a + b + c + d; -// } -// static int sum(int a, int b, int c, int d, int e) { -// return a + b + c + d + e; -// } -// static double identity(double x) { -// return x; -// } -// static double sum(double a, double b) { -// return a + b; -// } -// static double sum(double a, double b, double c) { -// return a + b + c; -// } -// static double sum(double a, double b, double c, double d) { -// return a + b + c + d; -// } -// static double sum(double a, double b, double c, double d, double e) { -// return a + b + c + d + e; -// } -// } -static const char kStaticLeafMethodsDex[] = - "ZGV4CjAzNQD8gEpaFD0w5dM8dsPaCQ3wIh0xaUjfni+IBQAAcAAAAHhWNBIAAAAAAAAAAPQEAAAW" - "AAAAcAAAAAYAAADIAAAADAAAAOAAAAAAAAAAAAAAAA4AAABwAQAAAQAAAOABAACIAwAAAAIAAK4D" - "AAC2AwAAuQMAAL0DAADAAwAAxAMAAMkDAADPAwAA1gMAAN4DAADhAwAA5QMAAOoDAADwAwAA9wMA" - "AP8DAAAUBAAAKAQAAEAEAABDBAAATQQAAFIEAAABAAAAAwAAAAkAAAAPAAAAEAAAABIAAAACAAAA" - "AAAAADgDAAAEAAAAAQAAAEADAAAFAAAAAQAAAEgDAAAGAAAAAQAAAFADAAAHAAAAAQAAAFwDAAAI" - "AAAAAQAAAGgDAAAKAAAAAgAAAHgDAAALAAAAAgAAAIADAAAMAAAAAgAAAIgDAAANAAAAAgAAAJQD" - "AAAOAAAAAgAAAKADAAASAAAABQAAAAAAAAADAAsAAAAAAAMAAAATAAAAAwABABMAAAADAAYAEwAA" - "AAMACwAUAAAAAwACABUAAAADAAMAFQAAAAMABAAVAAAAAwAFABUAAAADAAcAFQAAAAMACAAVAAAA" - "AwAJABUAAAADAAoAFQAAAAQACwAAAAAAAwAAAAAAAAAEAAAAAAAAABEAAAAAAAAAtwQAAAAAAAAB" - "AAEAAQAAAFcEAAAEAAAAcBANAAAADgABAAEAAAAAAFwEAAABAAAADwAAAAIAAgAAAAAAYgQAAAEA" - "AAAQAAAAAQABAAAAAABoBAAAAQAAAA8AAAAAAAAAAAAAAG4EAAABAAAADgAAAAYABAAAAAAAcwQA" - "AAMAAACrAAIEEAAAAAgABgAAAAAAegQAAAQAAACrAAIEy2AQAAoACAAAAAAAggQAAAUAAACrAAIE" - "y2DLgBAAAAAMAAoAAAAAAIsEAAAGAAAAqwACBMtgy4DLoBAAAwACAAAAAACVBAAAAwAAAJAAAQIP" - "AAAABAADAAAAAACcBAAABAAAAJAAAQKwMA8ABQAEAAAAAACkBAAABQAAAJAAAQKwMLBADwAAAAYA" - "BQAAAAAArQQAAAYAAACQAAECsDCwQLBQDwABAAAAAAAAAAEAAAABAAAAAgAAAAEAAQADAAAAAQAB" - "AAEAAAAEAAAAAQABAAEAAQAFAAAAAQABAAEAAQABAAAAAQAAAAIAAAACAAAAAgACAAMAAAACAAIA" - "AgAAAAQAAAACAAIAAgACAAUAAAACAAIAAgACAAIABjxpbml0PgABQgACQkIAAUQAAkREAANEREQA" - "BEREREQABUREREREAAZEREREREQAAUkAAklJAANJSUkABElJSUkABUlJSUlJAAZJSUlJSUkAE0xT" - "dGF0aWNMZWFmTWV0aG9kczsAEkxqYXZhL2xhbmcvT2JqZWN0OwAWU3RhdGljTGVhZk1ldGhvZHMu" - "amF2YQABVgAIaWRlbnRpdHkAA25vcAADc3VtAAEABw4ABQEABw4AFwEABw4ACAEABw4AAwAHDgAa" - "AgAABw4AHQMAAAAHDgAgBAAAAAAHDgAjBQAAAAAABw4ACwIAAAcOAA4DAAAABw4AEQQAAAAABw4A" - "FAUAAAAAAAcOAAAADQAAgIAEgAQBCJgEAQisBAEIwAQBCNQEAQjoBAEIgAUBCJgFAQi0BQEI0AUB" - "COgFAQiABgEInAYAAAAMAAAAAAAAAAEAAAAAAAAAAQAAABYAAABwAAAAAgAAAAYAAADIAAAAAwAA" - "AAwAAADgAAAABQAAAA4AAABwAQAABgAAAAEAAADgAQAAASAAAA0AAAAAAgAAARAAAAsAAAA4AwAA" - "AiAAABYAAACuAwAAAyAAAA0AAABXBAAAACAAAAEAAAC3BAAAABAAAAEAAAD0BAAA"; - -//class Fibonacci { -// -// static int fibonacci(int n) { -// if (n == 0) { -// return 0; -// } -// int x = 1; -// int y = 1; -// for (int i = 3; i <= n; i++) { -// int z = x + y; -// x = y; -// y = z; -// } -// return y; -// } -// -// public static void main(String[] args) { -// try { -// if (args.length == 1) { -// int x = Integer.parseInt(args[0]); -// int y = fibonacci(x); /* to warm up cache */ -// System.out.printf("fibonacci(%d)=%d\n", x, y); -// y = fibonacci(x +1); -// System.out.printf("fibonacci(%d)=%d\n", x, y); -// } -// } catch (NumberFormatException ex) {} -// } -//} -static const char kFibonacciDex[] = - "ZGV4CjAzNQBaslnMUQxaXYgC3gD9FGHjVb8cHZ60G8ckBQAAcAAAAHhWNBIAAAAAAAAAAIQEAAAa" - "AAAAcAAAAAsAAADYAAAABgAAAAQBAAABAAAATAEAAAcAAABUAQAAAgAAAIwBAABYAwAAzAEAAPoC" - "AAACAwAAEgMAABUDAAAZAwAAHQMAACoDAAAuAwAAMwMAAEoDAABfAwAAggMAAJYDAACqAwAAvgMA" - "AMsDAADOAwAA0gMAAOcDAAD8AwAABwQAABoEAAAgBAAAJQQAAC8EAAA3BAAAAgAAAAUAAAAIAAAA" - "CQAAAAoAAAALAAAADAAAAA0AAAAPAAAAEQAAABIAAAADAAAAAAAAANwCAAAEAAAAAAAAAOQCAAAH" - "AAAAAgAAAOwCAAAGAAAAAwAAANwCAAAPAAAACAAAAAAAAAAQAAAACAAAAPQCAAAHAAIAFgAAAAEA" - "BAAAAAAAAQAAABMAAAABAAUAFQAAAAIAAgAYAAAAAwABABcAAAADAAMAGQAAAAUABAAAAAAABQAA" - "AAEAAAD/////AAAAAA4AAAAAAAAAaAQAAAAAAAABAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAByBAAA" - "AAAAAAEAAQAAAAAAQAQAAAEAAAAOAAAAAQABAAEAAABFBAAABAAAAHAQBgAAAA4ABQABAAAAAABK" - "BAAAEwAAABIROQQEABIADwASMAESARMBAQEwNkH6/7AC2AEBAQEjAQIBMCj4AAAIAAEAAwABAFcE" - "AABIAAAAEhEhcDMQQwASAEYABwBxEAQAAAAKAHEQAQAAAAoBYgIAABoDFAASJCNECQASBXEQBQAA" - "AAwGTQYEBRIVcRAFAAEADAFNAQQFbjADADIE2AEAAXEQAQABAAoBYgIAABoDFAASJCNECQASBXEQ" - "BQAAAAwATQAEBRIQcRAFAAEADAFNAQQAbjADADIEDgANACj+AQAAAEQAAQABAQRGAQAAAAAAAAAB" - "AAAABgAAAAIAAAAGAAkAAQAAAAoABjxpbml0PgAORmlib25hY2NpLmphdmEAAUkAAklJAAJJTAAL" - "TEZpYm9uYWNjaTsAAkxJAANMTEwAFUxqYXZhL2lvL1ByaW50U3RyZWFtOwATTGphdmEvbGFuZy9J" - "bnRlZ2VyOwAhTGphdmEvbGFuZy9OdW1iZXJGb3JtYXRFeGNlcHRpb247ABJMamF2YS9sYW5nL09i" - "amVjdDsAEkxqYXZhL2xhbmcvU3RyaW5nOwASTGphdmEvbGFuZy9TeXN0ZW07AAtPYmplY3QuamF2" - "YQABVgACVkwAE1tMamF2YS9sYW5nL09iamVjdDsAE1tMamF2YS9sYW5nL1N0cmluZzsACWZpYm9u" - "YWNjaQARZmlib25hY2NpKCVkKT0lZAoABG1haW4AA291dAAIcGFyc2VJbnQABnByaW50ZgAHdmFs" - "dWVPZgADAAcOAAEABw4ADwEABx0tJgJ7HXgcAB4BAAcdPHhLARgPaQEYERwAAAABAAaBgATMAwAA" - "AwAAgIAE4AMBCPgDAQmwBA0AAAAAAAAAAQAAAAAAAAABAAAAGgAAAHAAAAACAAAACwAAANgAAAAD" - "AAAABgAAAAQBAAAEAAAAAQAAAEwBAAAFAAAABwAAAFQBAAAGAAAAAgAAAIwBAAABIAAABAAAAMwB" - "AAABEAAABAAAANwCAAACIAAAGgAAAPoCAAADIAAABAAAAEAEAAAAIAAAAgAAAGgEAAAAEAAAAQAA" - "AIQEAAA="; - -// class Interfaces { -// interface I { -// public void i(); -// } -// interface J { -// public void j1(); -// public void j2(); -// } -// class A implements I, J { -// public void i() {}; -// public void j1() {}; -// public void j2() {}; -// } -// } -static const char kInterfacesDex[] = - "ZGV4CjAzNQCRmX4RyqEIAGU0Pzgm7w3FvyUvYlel/coUBQAAcAAAAHhWNBIAAAAAAAAAAFAEAAAW" - "AAAAcAAAAAkAAADIAAAAAgAAAOwAAAABAAAABAEAAAkAAAAMAQAABAAAAFQBAABAAwAA1AEAAL4C" - "AADGAgAAyQIAAMwCAADdAgAA4AIAAPACAAAAAwAAEAMAAB4DAABCAwAAYgMAAIUDAACZAwAAnAMA" - "AKADAACtAwAAsAMAALQDAAC4AwAAvgMAAMYDAAAFAAAABgAAAAcAAAAIAAAACQAAAAoAAAALAAAA" - "DAAAAA0AAAANAAAACAAAAAAAAAAOAAAACAAAALgCAAAAAAMAFAAAAAAAAQAAAAAAAAAAABAAAAAA" - "AAAAEQAAAAAAAAASAAAAAQAAABAAAAACAAAAEQAAAAIAAAASAAAAAwAAAAAAAAAHAAAAAAAAAAEA" - "AAAABgAABwA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AAIAAAAJAAAA" - "yAAAAAMAAAACAAAA7AAAAAQAAAABAAAABAEAAAUAAAAJAAAADAEAAAYAAAAEAAAAVAEAAAMQAAAE" - "AAAA1AEAAAEgAAAFAAAAAAIAAAYgAAAEAAAAcAIAAAEQAAACAAAAsAIAAAIgAAAWAAAAvgIAAAMg" - "AAAFAAAAzQMAAAQgAAAFAAAA6AMAAAAgAAAEAAAAFwQAAAAQAAABAAAAUAQAAA=="; - -static inline DexFile* OpenDexFileBase64(const char* base64, - const std::string& location) { +static inline const DexFile* OpenDexFileBase64(const char* base64, + const std::string& location) { CHECK(base64 != NULL); size_t length; byte* dex_bytes = DecodeBase64(base64, &length); CHECK(dex_bytes != NULL); - DexFile* dex_file = DexFile::OpenPtr(dex_bytes, length, location); + const DexFile* dex_file = DexFile::OpenPtr(dex_bytes, length, location); CHECK(dex_file != NULL); return dex_file; } @@ -537,7 +143,7 @@ class CommonTest : public testing::Test { return std::string("/system/framework/core.jar"); } - DexFile* GetLibCoreDex() { + const DexFile* GetLibCoreDex() { std::string libcore_dex_file_name = GetLibCoreDexFileName(); return DexFile::OpenZip(libcore_dex_file_name); } @@ -550,6 +156,21 @@ class CommonTest : public testing::Test { return PathClassLoader::Alloc(dex_files); } + const DexFile* OpenTestDexFile(const char* name) { + CHECK(name != NULL); + std::string filename; + if (is_host_) { + // on the host, just read target dex file + filename += getenv("ANDROID_PRODUCT_OUT"); + } + filename += "/system/framework/art-test-dex-"; + filename += name; + filename += ".jar"; + const DexFile* dex_file = DexFile::OpenZip(filename); + CHECK(dex_file != NULL) << "Could not open " << filename; + return dex_file; + } + bool is_host_; scoped_ptr_malloc<char> android_data_; std::string art_cache_; diff --git a/src/compiler_test.cc b/src/compiler_test.cc index ca357f27ab..124668e38d 100644 --- a/src/compiler_test.cc +++ b/src/compiler_test.cc @@ -3,7 +3,6 @@ #include "class_linker.h" #include "common_test.h" #include "compiler.h" -#include "compiler_test.h" #include "dex_cache.h" #include "dex_file.h" #include "heap.h" @@ -17,8 +16,8 @@ namespace art { class CompilerTest : public CommonTest { protected: - void CompileDex(const char* base64_dex, const char* base64_name) { - dex_file_.reset(OpenDexFileBase64(base64_dex, base64_name)); + void CompileDex(const char* name) { + dex_file_.reset(OpenTestDexFile(name)); class_linker_->RegisterDexFile(*dex_file_.get()); std::vector<const DexFile*> class_path; class_path.push_back(dex_file_.get()); @@ -60,7 +59,7 @@ class CompilerTest : public CommonTest { #endif // __arm__ } private: - scoped_ptr<DexFile> dex_file_; + scoped_ptr<const DexFile> dex_file_; }; TEST_F(CompilerTest, CompileDexLibCore) { @@ -109,131 +108,131 @@ TEST_F(CompilerTest, CompileDexLibCore) { } TEST_F(CompilerTest, BasicCodegen) { - CompileDex(kFibonacciDex, "kFibonacciDex"); + CompileDex("Fibonacci"); AssertStaticIntMethod("Fibonacci", "fibonacci", "(I)I", 55, 10); } TEST_F(CompilerTest, StaticFieldTest) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "staticFieldTest", "(I)I", 1404, 404); } TEST_F(CompilerTest, UnopTest) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "unopTest", "(I)I", 37, 38); } TEST_F(CompilerTest, ShiftTest1) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "shiftTest1", "()I", 0); } TEST_F(CompilerTest, ShiftTest2) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "shiftTest2", "()I", 0); } TEST_F(CompilerTest, UnsignedShiftTest) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "unsignedShiftTest", "()I", 0); } TEST_F(CompilerTest, ConvTest) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "convTest", "()I", 0); } TEST_F(CompilerTest, CharSubTest) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "charSubTest", "()I", 0); } TEST_F(CompilerTest, IntOperTest) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "intOperTest", "(II)I", 0, 70000, -3); } TEST_F(CompilerTest, Lit16Test) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "lit16Test", "(I)I", 0, 77777); } TEST_F(CompilerTest, Lit8Test) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "lit8Test", "(I)I", 0, -55555); } TEST_F(CompilerTest, IntShiftTest) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "intShiftTest", "(II)I", 0, 0xff00aa01, 8); } TEST_F(CompilerTest, LongOperTest) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "longOperTest", "(JJ)I", 0, 70000000000LL, -3LL); } TEST_F(CompilerTest, LongShiftTest) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticLongMethod("IntMath", "longShiftTest", "(JI)J", 0x96deff00aa010000LL, 0xd5aa96deff00aa01LL, 16); } TEST_F(CompilerTest, SwitchTest1) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "switchTest", "(I)I", 1234, 1); } TEST_F(CompilerTest, IntCompare) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "testIntCompare", "(IIII)I", 1111, -5, 4, 4, 0); } TEST_F(CompilerTest, LongCompare) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "testLongCompare", "(JJJJ)I", 2222, -5LL, -4294967287LL, 4LL, 8LL); } TEST_F(CompilerTest, FloatCompare) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "testFloatCompare", "(FFFF)I", 3333, -5.0f, 4.0f, 4.0f, (1.0f/0.0f) / (1.0f/0.0f)); } TEST_F(CompilerTest, DoubleCompare) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "testDoubleCompare", "(DDDD)I", 4444, -5.0, 4.0, 4.0, (1.0/0.0) / (1.0/0.0)); } TEST_F(CompilerTest, RecursiveFibonacci) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "fibonacci", "(I)I", 55, 10); } #if 0 // Need to complete try/catch block handling TEST_F(CompilerTest, ThrowAndCatch) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "throwAndCatch", "()I", 4); } #endif TEST_F(CompilerTest, ManyArgs) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "manyArgs", "(IJIJIJIIDFDSICIIBZIIJJIIIII)I", -1, 0, 1LL, 2, 3LL, 4, 5LL, 6, 7, 8.0, 9.0f, 10.0, @@ -242,13 +241,13 @@ TEST_F(CompilerTest, ManyArgs) { } TEST_F(CompilerTest, VirtualCall) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "staticCall", "(I)I", 6, 3); } TEST_F(CompilerTest, TestIGetPut) { - CompileDex(kIntMathDex, "kIntMathDex"); + CompileDex("IntMath"); AssertStaticIntMethod("IntMath", "testIGetPut", "(I)I", 333, 111); } diff --git a/src/compiler_test.h b/src/compiler_test.h deleted file mode 100644 index 9df88a0c01..0000000000 --- a/src/compiler_test.h +++ /dev/null @@ -1,1041 +0,0 @@ -// Copyright 2011 Google Inc. All Rights Reserved. - -#include <dirent.h> -#include <dlfcn.h> -#include <sys/stat.h> -#include <sys/types.h> - -#include "base64.h" -#include "heap.h" -#include "thread.h" -#include "stringprintf.h" -#include "class_linker.h" -#include "dex_file.h" - -#include "unicode/uclean.h" -#include "unicode/uvernum.h" - -#include "gtest/gtest.h" - -namespace art { - -//class IntMath { -// -// public static boolean mBoolean1, mBoolean2; -// public static byte mByte1, mByte2; -// public static char mChar1, mChar2; -// public static short mShort1, mShort2; -// public static int mInt1, mInt2; -// public static float mFloat1, mFloat2; -// public static long mLong1, mLong2; -// public static double mDouble1, mDouble2; -// public static volatile long mVolatileLong1, mVolatileLong2; -// -// -// private int foo_; -// -// public IntMath(int stuff) { -// foo_ = stuff; -// } -// -// public IntMath() { -// foo_ = 123; -// } -// -// static int staticFieldTest(int x) { -// mBoolean1 = true; -// mBoolean2 = false; -// mByte1 = 127; -// mByte2 = -128; -// mChar1 = 32767; -// mChar2 = 65535; -// mShort1 = 32767; -// mShort2 = -32768; -// mInt1 = 65537; -// mInt2 = -65537; -// mFloat1 = 3.1415f; -// mFloat2 = -1.0f / 0.0f; // -inf -// mLong1 = 1234605616436508552L; // 0x1122334455667788 -// mLong2 = -1234605616436508552L; -// mDouble1 = 3.1415926535; -// mDouble2 = 1.0 / 0.0; // +inf -// mVolatileLong1 = mLong1 - 1; -// mVolatileLong2 = mLong2 + 1; -// -// if (!mBoolean1) { return 10; } -// if (mBoolean2) { return 11; } -// if (mByte1 != 127) { return 12; } -// if (mByte2 != -128) { return 13; } -// if (mChar1 != 32767) { return 14; } -// if (mChar2 != 65535) { return 15; } -// if (mShort1 != 32767) { return 16; } -// if (mShort2 != -32768) { return 17; } -// if (mInt1 != 65537) { return 18; } -// if (mInt2 != -65537) { return 19; } -// if (!(mFloat1 > 3.141f && mFloat1 < 3.142f)) { return 20; } -// if (mFloat2 >= mFloat1) { return 21; } -// if (mLong1 != 1234605616436508552L) { return 22; } -// if (mLong2 != -1234605616436508552L) { return 23; } -// if (!(mDouble1 > 3.141592653 && mDouble1 < 3.141592654)) { return 24; } -// if (mDouble2 <= mDouble1) { return 25; } -// if (mVolatileLong1 != 1234605616436508551L) { return 26; } -// if (mVolatileLong2 != -1234605616436508551L) { return 27; } -// -// return 1000 + x; -// } -// -// /* -// * Try to cause some unary operations. -// */ -// static int unopTest(int x) { -// x = -x; -// x ^= 0xffffffff; -// return x; -// } -// -// static int shiftTest1() { -// final int[] mBytes = { -// 0x11, 0x22, 0x33, 0x44, 0x88, 0x99, 0xaa, 0xbb -// }; -// long l; -// int i1, i2; -// -// if (mBytes[0] != 0x11) return 20; -// if (mBytes[1] != 0x22) return 21; -// if (mBytes[2] != 0x33) return 22; -// if (mBytes[3] != 0x44) return 23; -// if (mBytes[4] != 0x88) return 24; -// if (mBytes[5] != 0x99) return 25; -// if (mBytes[6] != 0xaa) return 26; -// if (mBytes[7] != 0xbb) return 27; -// -// i1 = mBytes[0] | mBytes[1] << 8 | mBytes[2] << 16 | mBytes[3] << 24; -// i2 = mBytes[4] | mBytes[5] << 8 | mBytes[6] << 16 | mBytes[7] << 24; -// l = i1 | ((long)i2 << 32); -// -// if (i1 != 0x44332211) { return 0x80000000 | i1; } -// if (i2 != 0xbbaa9988) { return 2; } -// if (l != 0xbbaa998844332211L) { return 3; } -// -// l = (long)mBytes[0] -// | (long)mBytes[1] << 8 -// | (long)mBytes[2] << 16 -// | (long)mBytes[3] << 24 -// | (long)mBytes[4] << 32 -// | (long)mBytes[5] << 40 -// | (long)mBytes[6] << 48 -// | (long)mBytes[7] << 56; -// -// if (l != 0xbbaa998844332211L) { return 4; } -// return 0; -// } -// -// static int shiftTest2() { -// -// long a = 0x11; -// long b = 0x22; -// long c = 0x33; -// long d = 0x44; -// long e = 0x55; -// long f = 0x66; -// long g = 0x77; -// long h = 0x88; -// -// long result = ((a << 56) | (b << 48) | (c << 40) | (d << 32) | -// (e << 24) | (f << 16) | (g << 8) | h); -// -// if (result != 0x1122334455667788L) { return 1; } -// return 0; -// } -// -// static int unsignedShiftTest() { -// byte b = -4; -// short s = -4; -// char c = 0xfffc; -// int i = -4; -// -// b >>>= 4; -// s >>>= 4; -// c >>>= 4; -// i >>>= 4; -// -// if ((int) b != -1) { return 1; } -// if ((int) s != -1) { return 2; } -// if ((int) c != 0x0fff) { return 3; } -// if (i != 268435455) { return 4; } -// return 0; -// } -// -// static int convTest() { -// -// float f; -// double d; -// int i; -// long l; -// -// /* int --> long */ -// i = 7654; -// l = (long) i; -// if (l != 7654L) { return 1; } -// -// i = -7654; -// l = (long) i; -// if (l != -7654L) { return 2; } -// -// /* long --> int (with truncation) */ -// l = 5678956789L; -// i = (int) l; -// if (i != 1383989493) { return 3; } -// -// l = -5678956789L; -// i = (int) l; -// if (i != -1383989493) { return 4; } -// return 0; -// } -// -// static int charSubTest() { -// -// char char1 = 0x00e9; -// char char2 = 0xffff; -// int i; -// -// /* chars are unsigned-expanded to ints before subtraction */ -// i = char1 - char2; -// if (i != 0xffff00ea) { return 1; } -// return 0; -// } -// -// /* -// * We pass in the arguments and return the results so the compiler -// * doesn't do the math for us. (x=70000, y=-3) -// */ -// static int intOperTest(int x, int y) { -// int[] results = new int[10]; -// -// /* this seems to generate "op-int" instructions */ -// results[0] = x + y; -// results[1] = x - y; -// results[2] = x * y; -// results[3] = x * x; -// results[4] = x / y; -// results[5] = x % -y; -// results[6] = x & y; -// results[7] = x | y; -// results[8] = x ^ y; -// -// /* this seems to generate "op-int/2addr" instructions */ -// results[9] = x + ((((((((x + y) - y) * y) / y) % y) & y) | y) ^ y); -// -// /* check this edge case while we're here (div-int/2addr) */ -// int minInt = -2147483648; -// int negOne = -results[5]; -// int plusOne = 1; -// int result = (((minInt + plusOne) - plusOne) / negOne) / negOne; -// -// if (result != minInt) { return 1;}; -// if (results[0] != 69997) { return 2;}; -// if (results[1] != 70003) { return 3;}; -// if (results[2] != -210000) { return 4;}; -// if (results[3] != 605032704) { return 5;}; -// if (results[4] != -23333) { return 6;}; -// if (results[5] != 1) { return 7;}; -// if (results[6] != 70000) { return 8;}; -// if (results[7] != -3) { return 9;}; -// if (results[8] != -70003) { return 10;}; -// if (results[9] != 70000) { return 11;}; -// -// return 0; -// } -// -// /* -// * More operations, this time with 16-bit constants. (x=77777) -// */ -// static int lit16Test(int x) { -// -// int[] results = new int[8]; -// -// /* try to generate op-int/lit16" instructions */ -// results[0] = x + 1000; -// results[1] = 1000 - x; -// results[2] = x * 1000; -// results[3] = x / 1000; -// results[4] = x % 1000; -// results[5] = x & 1000; -// results[6] = x | -1000; -// results[7] = x ^ -1000; -// -// if (results[0] != 78777) { return 1; } -// if (results[1] != -76777) { return 2; } -// if (results[2] != 77777000) { return 3; } -// if (results[3] != 77) { return 4; } -// if (results[4] != 777) { return 5; } -// if (results[5] != 960) { return 6; } -// if (results[6] != -39) { return 7; } -// if (results[7] != -76855) { return 8; } -// return 0; -// } -// -// /* -// * More operations, this time with 8-bit constants. (x=-55555) -// */ -// static int lit8Test(int x) { -// -// int[] results = new int[8]; -// -// /* try to generate op-int/lit8" instructions */ -// results[0] = x + 10; -// results[1] = 10 - x; -// results[2] = x * 10; -// results[3] = x / 10; -// results[4] = x % 10; -// results[5] = x & 10; -// results[6] = x | -10; -// results[7] = x ^ -10; -// int minInt = -2147483648; -// int result = minInt / -1; -// if (result != minInt) {return 1; } -// if (results[0] != -55545) {return 2; } -// if (results[1] != 55565) {return 3; } -// if (results[2] != -555550) {return 4; } -// if (results[3] != -5555) {return 5; } -// if (results[4] != -5) {return 6; } -// if (results[5] != 8) {return 7; } -// if (results[6] != -1) {return 8; } -// if (results[7] != 55563) {return 9; } -// return 0; -// } -// -// -// /* -// * Shift some data. (value=0xff00aa01, dist=8) -// */ -// static int intShiftTest(int value, int dist) { -// int results[] = new int[4]; -// results[0] = value << dist; -// results[1] = value >> dist; -// results[2] = value >>> dist; -// results[3] = (((value << dist) >> dist) >>> dist) << dist; -// if (results[0] != 0x00aa0100) {return 1; } -// if (results[1] != 0xffff00aa) {return 2; } -// if (results[2] != 0x00ff00aa) {return 3; } -// if (results[3] != 0xaa00) {return 4; } -// return 0; -// } -// -// /* -// * We pass in the arguments and return the results so the compiler -// * doesn't do the math for us. (x=70000000000, y=-3) -// */ -// static int longOperTest(long x, long y) { -// long[] results = new long[10]; -// -// /* this seems to generate "op-long" instructions */ -// results[0] = x + y; -// results[1] = x - y; -// results[2] = x * y; -// results[3] = x * x; -// results[4] = x / y; -// results[5] = x % -y; -// results[6] = x & y; -// results[7] = x | y; -// results[8] = x ^ y; -// /* this seems to generate "op-long/2addr" instructions */ -// results[9] = x + ((((((((x + y) - y) * y) / y) % y) & y) | y) ^ y); -// /* check this edge case while we're here (div-long/2addr) */ -// long minLong = -9223372036854775808L; -// long negOne = -results[5]; -// long plusOne = 1; -// long result = (((minLong + plusOne) - plusOne) / negOne) / negOne; -// if (result != minLong) { return 1; } -// if (results[0] != 69999999997L) { return 2; } -// if (results[1] != 70000000003L) { return 3; } -// if (results[2] != -210000000000L) { return 4; } -// if (results[3] != -6833923606740729856L) { return 5; } // overflow -// if (results[4] != -23333333333L) { return 6; } -// if (results[5] != 1) { return 7; } -// if (results[6] != 70000000000L) { return 8; } -// if (results[7] != -3) { return 9; } -// if (results[8] != -70000000003L) { return 10; } -// if (results[9] != 70000000000L) { return 11; } -// if (results.length != 10) { return 12; } -// return 0; -// } -// -// /* -// * Shift some data. (value=0xd5aa96deff00aa01, dist=16) -// */ -// static long longShiftTest(long value, int dist) { -// long results[] = new long[4]; -// results[0] = value << dist; -// results[1] = value >> dist; -// results[2] = value >>> dist; -// results[3] = (((value << dist) >> dist) >>> dist) << dist; -// if (results[0] != 0x96deff00aa010000L) { return results[0]; } -// if (results[1] != 0xffffd5aa96deff00L) { return results[1]; } -// if (results[2] != 0x0000d5aa96deff00L) { return results[2]; } -// if (results[3] != 0xffff96deff000000L) { return results[3]; } -// if (results.length != 4) { return 5; } -// -// return results[0]; // test return-long -// } -// -// static int switchTest(int a) { -// int res = 1234; -// -// switch (a) { -// case -1: res = 1; return res; -// case 0: res = 2; return res; -// case 1: /*correct*/ break; -// case 2: res = 3; return res; -// case 3: res = 4; return res; -// case 4: res = 5; return res; -// default: res = 6; return res; -// } -// switch (a) { -// case 3: res = 7; return res; -// case 4: res = 8; return res; -// default: /*correct*/ break; -// } -// -// a = 0x12345678; -// -// switch (a) { -// case 0x12345678: /*correct*/ break; -// case 0x12345679: res = 9; return res; -// default: res = 1; return res; -// } -// switch (a) { -// case 57: res = 10; return res; -// case -6: res = 11; return res; -// case 0x12345678: /*correct*/ break; -// case 22: res = 12; return res; -// case 3: res = 13; return res; -// default: res = 14; return res; -// } -// switch (a) { -// case -6: res = 15; return res; -// case 3: res = 16; return res; -// default: /*correct*/ break; -// } -// -// a = -5; -// switch (a) { -// case 12: res = 17; return res; -// case -5: /*correct*/ break; -// case 0: res = 18; return res; -// default: res = 19; return res; -// } -// -// switch (a) { -// default: /*correct*/ break; -// } -// return res; -// } -// /* -// * Test the integer comparisons in various ways. -// */ -// static int testIntCompare(int minus, int plus, int plus2, int zero) { -// int res = 1111; -// -// if (minus > plus) -// return 1; -// if (minus >= plus) -// return 2; -// if (plus < minus) -// return 3; -// if (plus <= minus) -// return 4; -// if (plus == minus) -// return 5; -// if (plus != plus2) -// return 6; -// -// /* try a branch-taken */ -// if (plus != minus) { -// res = res; -// } else { -// return 7; -// } -// -// if (minus > 0) -// return 8; -// if (minus >= 0) -// return 9; -// if (plus < 0) -// return 10; -// if (plus <= 0) -// return 11; -// if (plus == 0) -// return 12; -// if (zero != 0) -// return 13; -// -// if (zero == 0) { -// res = res; -// } else { -// return 14; -// } -// return res; -// } -// -// /* -// * Test cmp-long. -// * -// * minus=-5, alsoMinus=0xFFFFFFFF00000009, plus=4, alsoPlus=8 -// */ -// static int testLongCompare(long minus, long alsoMinus, long plus, -// long alsoPlus) { -// int res = 2222; -// -// if (minus > plus) -// return 2; -// if (plus < minus) -// return 3; -// if (plus == minus) -// return 4; -// -// if (plus >= plus+1) -// return 5; -// if (minus >= minus+1) -// return 6; -// -// /* try a branch-taken */ -// if (plus != minus) { -// res = res; -// } else { -// return 7; -// } -// -// /* compare when high words are equal but low words differ */ -// if (plus > alsoPlus) -// return 8; -// if (alsoPlus < plus) -// return 9; -// if (alsoPlus == plus) -// return 10; -// -// /* high words are equal, low words have apparently different signs */ -// if (minus < alsoMinus) // bug! -// return 11; -// if (alsoMinus > minus) -// return 12; -// if (alsoMinus == minus) -// return 13; -// -// return res; -// } -// -// /* -// * Test cmpl-float and cmpg-float. -// */ -// static int testFloatCompare(float minus, float plus, float plus2, -// float nan) { -// -// int res = 3333; -// if (minus > plus) -// res = 1; -// if (plus < minus) -// res = 2; -// if (plus == minus) -// res = 3; -// if (plus != plus2) -// res = 4; -// -// if (plus <= nan) -// res = 5; -// if (plus >= nan) -// res = 6; -// if (minus <= nan) -// res = 7; -// if (minus >= nan) -// res = 8; -// if (nan >= plus) -// res = 9; -// if (nan <= plus) -// res = 10; -// -// if (nan == nan) -// res = 1212; -// -// return res; -// } -// -// static int testDoubleCompare(double minus, double plus, double plus2, -// double nan) { -// -// int res = 4444; -// -// if (minus > plus) -// return 1; -// if (plus < minus) -// return 2; -// if (plus == minus) -// return 3; -// if (plus != plus2) -// return 4; -// -// if (plus <= nan) -// return 5; -// if (plus >= nan) -// return 6; -// if (minus <= nan) -// return 7; -// if (minus >= nan) -// return 8; -// if (nan >= plus) -// return 9; -// if (nan <= plus) -// return 10; -// -// if (nan == nan) -// return 11; -// return res; -// } -// -// static int fibonacci(int n) { -// if (n == 0) { -// return 0; -// } else if (n == 1) { -// return 1; -// } else { -// return fibonacci(n - 1) + fibonacci(n - 2); -// } -// } -// -///* -// static void throwNullPointerException() { -// throw new NullPointerException("first throw"); -// } -// -// static int throwAndCatch() { -// try { -// throwNullPointerException(); -// return 1; -// } catch (NullPointerException npe) { -// return 0; -// } -// } -//*/ -// -// static int manyArgs(int a0, long a1, int a2, long a3, int a4, long a5, -// int a6, int a7, double a8, float a9, double a10, short a11, int a12, -// char a13, int a14, int a15, byte a16, boolean a17, int a18, int a19, -// long a20, long a21, int a22, int a23, int a24, int a25, int a26) -// { -// if (a0 != 0) return 0; -// if (a1 != 1L) return 1; -// if (a2 != 2) return 2; -// if (a3 != 3L) return 3; -// if (a4 != 4) return 4; -// if (a5 != 5L) return 5; -// if (a6 != 6) return 6; -// if (a7 != 7) return 7; -// if (a8 != 8.0) return 8; -// if (a9 != 9.0f) return 9; -// if (a10 != 10.0) return 10; -// if (a11 != (short)11) return 11; -// if (a12 != 12) return 12; -// if (a13 != (char)13) return 13; -// if (a14 != 14) return 14; -// if (a15 != 15) return 15; -// if (a16 != (byte)-16) return 16; -// if (a17 != true) return 17; -// if (a18 != 18) return 18; -// if (a19 != 19) return 19; -// if (a20 != 20L) return 20; -// if (a21 != 21L) return 21; -// if (a22 != 22) return 22; -// if (a23 != 23) return 23; -// if (a24 != 24) return 24; -// if (a25 != 25) return 25; -// if (a26 != 26) return 26; -// return -1; -// } -// -// int virtualCall(int a) -// { -// return a * 2; -// } -// -// void setFoo(int a) -// { -// foo_ = a; -// } -// -// int getFoo() -// { -// return foo_; -// } -// -// static int staticCall(int a) -// { -// IntMath foo = new IntMath(); -// return foo.virtualCall(a); -// } -// -// static int testIGetPut(int a) -// { -// IntMath foo = new IntMath(99); -// IntMath foo123 = new IntMath(); -// int z = foo.getFoo(); -// z += a; -// z += foo123.getFoo(); -// foo.setFoo(z); -// return foo.getFoo(); -// } -// -// public static void main(String[] args) { -// int res = unopTest(38); -// if (res == 37) { -// System.out.printf("unopTest PASSED\n"); -// } else { -// System.out.printf("unopTest FAILED: %d\n", res); -// } -// res = shiftTest1(); -// if (res == 0) { -// System.out.printf("shiftTest1 PASSED\n"); -// } else { -// System.out.printf("shiftTest1 FAILED: %d\n", res); -// } -// res = shiftTest2(); -// if (res == 0) { -// System.out.printf("shiftTest2 PASSED\n"); -// } else { -// System.out.printf("shiftTest2 FAILED: %d\n", res); -// } -// res = unsignedShiftTest(); -// if (res == 0) { -// System.out.printf("unsignedShiftTest PASSED\n"); -// } else { -// System.out.printf("unsignedShiftTest FAILED: %d\n", res); -// } -// res = convTest(); -// if (res == 0) { -// System.out.printf("convTest PASSED\n"); -// } else { -// System.out.printf("convTest FAILED: %d\n", res); -// } -// res = charSubTest(); -// if (res == 0) { -// System.out.printf("charSubTest PASSED\n"); -// } else { -// System.out.printf("charSubTest FAILED: %d\n", res); -// } -// res = intOperTest(70000, -3); -// if (res == 0) { -// System.out.printf("intOperTest PASSED\n"); -// } else { -// System.out.printf("intOperTest FAILED: %d\n", res); -// } -// res = longOperTest(70000000000L, -3L); -// if (res == 0) { -// System.out.printf("longOperTest PASSED\n"); -// } else { -// System.out.printf("longOperTest FAILED: %d\n", res); -// } -// long lres = longShiftTest(0xd5aa96deff00aa01L, 16); -// if (lres == 0x96deff00aa010000L) { -// System.out.printf("longShiftTest PASSED\n"); -// } else { -// System.out.printf("longShiftTest FAILED: %d\n", res); -// } -// -// res = switchTest(1); -// if (res == 1234) { -// System.out.printf("switchTest PASSED\n"); -// } else { -// System.out.printf("switchTest FAILED: %d\n", res); -// } -// -// res = testIntCompare(-5, 4, 4, 0); -// if (res == 1111) { -// System.out.printf("testIntCompare PASSED\n"); -// } else { -// System.out.printf("testIntCompare FAILED: %d\n", res); -// } -// -// res = testLongCompare(-5L, -4294967287L, 4L, 8L); -// if (res == 2222) { -// System.out.printf("testLongCompare PASSED\n"); -// } else { -// System.out.printf("testLongCompare FAILED: %d\n", res); -// } -// -// res = testFloatCompare(-5.0f, 4.0f, 4.0f, (1.0f/0.0f) / (1.0f/0.0f)); -// if (res == 3333) { -// System.out.printf("testFloatCompare PASSED\n"); -// } else { -// System.out.printf("testFloatCompare FAILED: %d\n", res); -// } -// -// res = testDoubleCompare(-5.0, 4.0, 4.0, (1.0/0.0) / (1.0/0.0)); -// if (res == 4444) { -// System.out.printf("testDoubleCompare PASSED\n"); -// } else { -// System.out.printf("testDoubleCompare FAILED: %d\n", res); -// } -// -// res = fibonacci(10); -// if (res == 55) { -// System.out.printf("fibonacci PASSED\n"); -// } else { -// System.out.printf("fibonacci FAILED: %d\n", res); -// } -// -///* -// res = throwAndCatch(); -// if (res == 0) { -// System.out.printf("throwAndCatch PASSED\n"); -// } else { -// System.out.printf("throwAndCatch FAILED: %d\n", res); -// } -//*/ -// -// res = manyArgs(0, 1L, 2, 3L, 4, 5L, 6, 7, 8.0, 9.0f, 10.0, -// (short)11, 12, (char)13, 14, 15, (byte)-16, true, 18, -// 19, 20L, 21L, 22, 23, 24, 25, 26); -// if (res == -1) { -// System.out.printf("manyArgs PASSED\n"); -// } else { -// System.out.printf("manyArgs FAILED: %d\n", res); -// } -// -// res = staticCall(3); -// if (res == 6) { -// System.out.printf("virtualCall PASSED\n"); -// } else { -// System.out.printf("virtualCall FAILED: %d\n", res); -// } -// -// res = testIGetPut(111); -// if (res == 333) { -// System.out.printf("testGetPut PASSED\n"); -// } else { -// System.out.printf("testGetPut FAILED: %d\n", res); -// } -// -// res = staticFieldTest(404); -// if (res == 1404) { -// System.out.printf("staticFieldTest PASSED\n"); -// } else { -// System.out.printf("staticFieldTest FAILED: %d\n", res); -// } -// } -//} -static const char kIntMathDex[] = -"ZGV4CjAzNQDNfScpnt+aCE7GCvHI7Jifma1Cw1Zt40LcLwAAcAAAAHhWNBIAAAAAAAAAADwvAAC+" -"AAAAcAAAABMAAABoAwAADwAAALQDAAAUAAAAaAQAAB8AAAAIBQAAAgAAAAAGAACcKQAAQAYAAEYh" -"AABOIQAAUSEAAFQhAABXIQAAWiEAAF0hAABkIQAAayEAAG8hAAB0IQAAeyEAAJkhAACeIQAApSEA" -"ALMhAAC2IQAAuyEAAL8hAADKIQAAzyEAAOYhAAD7IQAADyIAACMiAAA3IgAARCIAAEciAABKIgAA" -"TiIAAFIiAABVIgAAWSIAAF0iAAByIgAAhyIAAIoiAACOIgAAkiIAAJciAACcIgAAoSIAAKYiAACr" -"IgAAsCIAALUiAAC6IgAAvyIAAMQiAADIIgAAzSIAANIiAADXIgAA3CIAAOEiAADmIgAA6y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YCAQASJBYFAwASRxYIBQASahJ7GQwgQBUOEEEZDyRA" -"ExELABMSDAATEw0AExQOABMVDwATFvD/ExcBABMYEgATGRMAFhoUABYcFQATHhYAEx8XABMgGAAT" -"IRkAEyIaAHciDQABAAolEvECACUAMxBqAWIBEwAaAoAAEgMjMxEAbjAcACEDEjFxEBEAAQAKJRJh" -"AgAlADMQaQFiARMAGgK5ABIDIzMRAG4wHAAhAxMBbwBxEBYAAQAKJRMBTQECACUAMxBmAWIBEwAa" -"AqYAEgMjMxEAbjAcACEDEwGUAXEQEgABAAolEwF8BQIAJQAzEGMBYgETABoCmgASAyMzEQBuMBwA" -"IQMOAGIBEwAaArAAEhMjMxEAEgR3AR0AJQAMBU0FAwRuMBwAIQMpADf+YgETABoCkgASEyMzEQAS" -"BHcBHQAlAAwFTQUDBG4wHAAhAykANP5iARMAGgKVABITIzMRABIEdwEdACUADAVNBQMEbjAcACED" -"KQAx/mIBEwAaArMAEhMjMxEAEgR3AR0AJQAMBU0FAwRuMBwAIQMpAC7+YgETABoCSgASEyMzEQAS" -"BHcBHQAlAAwFTQUDBG4wHAAhAykAK/5iARMAGgJHABITIzMRABIEdwEdACUADAVNBQMEbjAcACED" -"KQAo/mIBEwAaAl0AEhMjMxEAEgR3AR0AJQAMBU0FAwRuMBwAIQMpACn+YgETABoCZAASEyMzEQAS" -"BHcBHQAlAAwFTQUDBG4wHAAhAykALf5iARMAGgJnABITIzMRABIEdwEdACUADAVNBQMEbjAcACED" -"KQA4/mIBEwAaAp0AEhMjMxEAEgR3AR0AJQAMBU0FAwRuMBwAIQMpADr+YgETABoCqQASEyMzEQAS" -"BHcBHQAlAAwFTQUDBG4wHAAhAykAP/5iARMAGgKsABITIzMRABIEdwEdACUADAVNBQMEbjAcACED" -"KQBL/mIBEwAaAqMAEhMjMxEAEgR3AR0AJQAMBU0FAwRuMBwAIQMpAFT+YgETABoCoAASEyMzEQAS" -"BHcBHQAlAAwFTQUDBG4wHAAhAykAXf5iARMAGgJRABIT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ALACj5ZAADADKABQATAAwAKPJkAAQAMnAFABMA" -"DQAo62UABQAyQAUAEwAOACjkZQAGABQB//8AADIQBQATAA8AKNpmAA8AMkAFABMAEAAo02YAEAAy" -"YAUAEwARACjMYAALABQBAQABADIQBQATABIAKMJgAAwAMlAFABMAEwAou2AACQAUASUGSUAtAAAB" -"PQALAGAACQAUAYcWSUAuAAABOgAFABMAFAAopmAACgBgAQkALQAAAToABQATABUAKJthAA0AGAKI" -"d2ZVRDMiETEAAAI4AAUAEwAWACiNYQAOABgCeIiZqrvM3e4xAAACOAAGABMAFwApAH//YQAHABgC" -"OOkvVPshCUAvAAACPQANAGEABwAYAlBFUlT7IQlAMAAAAjoABgATABgAKQBl/2EACABhAgcAMAAA" -"AjwABgATABkAKQBZ/2EAEQAYAod3ZlVEMyIRMQAAAjgABgATABoAKQBK/2EAEgAYAnmImaq7zN3u" -"MQAAAjgABgATABsAKQA7/9CQ6AMpADf/AwABAAAAAABkLAAAsAAAABMA0gQrAmAAAAASYAEBDwES" -"EAEBKP0SIAEBKPoSMAEBKPcSQAEBKPQSUAEBKPErAlsAAAAUAnhWNBIrAl0AAAASEAEBKOUScAEB" -"KOITAAgAAQEo3hMACQABASjaLAJUAAAAEwAOAAEBKNMTAAoAAQEozxMACwABASjLEwAMAAEBKMcT" -"AA0AAQEowywCUwAAABKyLAJZAAAAEwATAAEBKLgTAA8AAQEotBMAEAABASiwEwARAAEBKKwTABIA" -"AQEoqAEBKKYAAQYA/////wYAAAAJAAAAFQAAAAwAAAAPAAAAEgAAAAABAgADAAAADAAAAA8AAAAA" -"AQIAeFY0EhEAAAANAAAAAAIFAPr///8DAAAAFgAAADkAAAB4VjQSCwAAABMAAAAPAAAABwAAABcA" -"AAAAAgIA+v///wMAAAALAAAADwAAAAACAwD7////AAAAAAwAAAAXAAAAEwAAAA8AAAAKAAgAAAAA" -"AHMtAABIAAAAEwBcES8BAgQ9AQQAEhAPADABBAI7AQQAEiAo+i8BBAI5AQQAEjAo9C8BB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NKQAAACAAAAIAAACRLgAAABAAAAEAAAA8LwAA"; -} // namespace art diff --git a/src/dex_file.cc b/src/dex_file.cc index 01eb099561..231b4be082 100644 --- a/src/dex_file.cc +++ b/src/dex_file.cc @@ -54,7 +54,7 @@ DexFile::MmapCloser::~MmapCloser() { DexFile::PtrCloser::PtrCloser(byte* addr) : addr_(addr) {} DexFile::PtrCloser::~PtrCloser() { delete[] addr_; } -DexFile* DexFile::OpenFile(const std::string& filename) { +const DexFile* DexFile::OpenFile(const std::string& filename) { int fd = open(filename.c_str(), O_RDONLY); // TODO: scoped_fd if (fd == -1) { PLOG(ERROR) << "open(\"" << filename << "\", O_RDONLY) failed"; @@ -137,7 +137,7 @@ class TmpFile { }; // Open classes.dex from within a .zip, .jar, .apk, ... -DexFile* DexFile::OpenZip(const std::string& filename) { +const DexFile* DexFile::OpenZip(const std::string& filename) { // First, look for a ".dex" alongside the jar file. It will have // the same name/path except for the extension. @@ -153,7 +153,7 @@ DexFile* DexFile::OpenZip(const std::string& filename) { ".dex"); // Example adjacent_dex_filename = dir/foo.dex if (OS::FileExists(adjacent_dex_filename.c_str())) { - DexFile* adjacent_dex_file = DexFile::OpenFile(adjacent_dex_filename); + const DexFile* adjacent_dex_file = DexFile::OpenFile(adjacent_dex_filename); if (adjacent_dex_file != NULL) { // We don't verify anything in this case, because we aren't in // the cache and typically the file is in the readonly /system @@ -200,7 +200,7 @@ DexFile* DexFile::OpenZip(const std::string& filename) { while (true) { if (OS::FileExists(cache_path.c_str())) { - DexFile* cached_dex_file = DexFile::OpenFile(cache_path); + const DexFile* cached_dex_file = DexFile::OpenFile(cache_path); if (cached_dex_file != NULL) { return cached_dex_file; } @@ -294,14 +294,14 @@ DexFile* DexFile::OpenZip(const std::string& filename) { // NOTREACHED } -DexFile* DexFile::OpenPtr(byte* ptr, size_t length, const std::string& location) { +const DexFile* DexFile::OpenPtr(byte* ptr, size_t length, const std::string& location) { CHECK(ptr != NULL); DexFile::Closer* closer = new PtrCloser(ptr); return Open(ptr, length, location, closer); } -DexFile* DexFile::Open(const byte* dex_bytes, size_t length, - const std::string& location, Closer* closer) { +const DexFile* DexFile::Open(const byte* dex_bytes, size_t length, + const std::string& location, Closer* closer) { scoped_ptr<DexFile> dex_file(new DexFile(dex_bytes, length, location, closer)); if (!dex_file->Init()) { return NULL; diff --git a/src/dex_file.h b/src/dex_file.h index 4fb1442fd9..bbc3f81adf 100644 --- a/src/dex_file.h +++ b/src/dex_file.h @@ -317,17 +317,17 @@ class DexFile { const ClassPath& class_path); // Opens a .dex file from the file system. - static DexFile* OpenFile(const std::string& filename); + static const DexFile* OpenFile(const std::string& filename); // Opens a .jar, .zip, or .apk file from the file system. - static DexFile* OpenZip(const std::string& filename); + static const DexFile* OpenZip(const std::string& filename); // Opens a .dex file from a new allocated pointer. location is used // to identify the source, for example "/system/framework/core.jar" // or "contrived-test-42". When initializing a ClassLinker from an // image, the location is used to match DexCaches the image to their // corresponding DexFiles.N - static DexFile* OpenPtr(byte* ptr, size_t length, const std::string& location); + static const DexFile* OpenPtr(byte* ptr, size_t length, const std::string& location); // Closes a .dex file. virtual ~DexFile(); @@ -830,8 +830,11 @@ class DexFile { byte* addr_; }; - // Opens a .dex file at a the given address. - static DexFile* Open(const byte* dex_file, size_t length, const std::string& location, Closer* closer); + // Opens a .dex file at the given address. + static const DexFile* Open(const byte* dex_file, + size_t length, + const std::string& location, + Closer* closer); DexFile(const byte* addr, size_t length, const std::string& location, Closer* closer) : base_(addr), diff --git a/src/dex_file_test.cc b/src/dex_file_test.cc index 37c601cf36..96d0477707 100644 --- a/src/dex_file_test.cc +++ b/src/dex_file_test.cc @@ -5,17 +5,44 @@ #include "scoped_ptr.h" #include <stdio.h> -#include "gtest/gtest.h" namespace art { -TEST(DexFileTest, Open) { - scoped_ptr<const DexFile> dex(OpenDexFileBase64(kNestedDex, "kNestedDex")); +class DexFileTest : public CommonTest {}; + +TEST_F(DexFileTest, Open) { + scoped_ptr<const DexFile> dex(OpenTestDexFile("Nested")); ASSERT_TRUE(dex != NULL); } -TEST(DexFileTest, Header) { - scoped_ptr<const DexFile> raw(OpenDexFileBase64(kNestedDex, "kNestedDex")); +// Although this is the same content logically as the Nested test dex, +// the DexFileHeader test is sensitive to subtle changes in the +// contents due to the checksum etc, so we embed the exact input here. +// +// class Nested { +// class Inner { +// } +// } +static const char kRawDex[] = + "ZGV4CjAzNQAQedgAe7gM1B/WHsWJ6L7lGAISGC7yjD2IAwAAcAAAAHhWNBIAAAAAAAAAAMQCAAAP" + "AAAAcAAAAAcAAACsAAAAAgAAAMgAAAABAAAA4AAAAAMAAADoAAAAAgAAAAABAABIAgAAQAEAAK4B" + "AAC2AQAAvQEAAM0BAADXAQAA+wEAABsCAAA+AgAAUgIAAF8CAABiAgAAZgIAAHMCAAB5AgAAgQIA" + "AAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAkAAAAJAAAABgAAAAAAAAAKAAAABgAAAKgBAAAAAAEA" + "DQAAAAAAAQAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAIAAAAiAEAAKsCAAAA" + "AAAAAQAAAAAAAAAFAAAAAAAAAAgAAACYAQAAuAIAAAAAAAACAAAAlAIAAJoCAAABAAAAowIAAAIA" + "AgABAAAAiAIAAAYAAABbAQAAcBACAAAADgABAAEAAQAAAI4CAAAEAAAAcBACAAAADgBAAQAAAAAA" + "AAAAAAAAAAAATAEAAAAAAAAAAAAAAAAAAAEAAAABAAY8aW5pdD4ABUlubmVyAA5MTmVzdGVkJElu" + "bmVyOwAITE5lc3RlZDsAIkxkYWx2aWsvYW5ub3RhdGlvbi9FbmNsb3NpbmdDbGFzczsAHkxkYWx2" + "aWsvYW5ub3RhdGlvbi9Jbm5lckNsYXNzOwAhTGRhbHZpay9hbm5vdGF0aW9uL01lbWJlckNsYXNz" + "ZXM7ABJMamF2YS9sYW5nL09iamVjdDsAC05lc3RlZC5qYXZhAAFWAAJWTAALYWNjZXNzRmxhZ3MA" + "BG5hbWUABnRoaXMkMAAFdmFsdWUAAgEABw4AAQAHDjwAAgIBDhgBAgMCCwQADBcBAgQBDhwBGAAA" + "AQEAAJAgAICABNQCAAABAAGAgATwAgAAEAAAAAAAAAABAAAAAAAAAAEAAAAPAAAAcAAAAAIAAAAH" + "AAAArAAAAAMAAAACAAAAyAAAAAQAAAABAAAA4AAAAAUAAAADAAAA6AAAAAYAAAACAAAAAAEAAAMQ" + "AAACAAAAQAEAAAEgAAACAAAAVAEAAAYgAAACAAAAiAEAAAEQAAABAAAAqAEAAAIgAAAPAAAArgEA" + "AAMgAAACAAAAiAIAAAQgAAADAAAAlAIAAAAgAAACAAAAqwIAAAAQAAABAAAAxAIAAA=="; + +TEST_F(DexFileTest, Header) { + scoped_ptr<const DexFile> raw(OpenDexFileBase64(kRawDex, "kRawDex")); ASSERT_TRUE(raw != NULL); const DexFile::Header& header = raw->GetHeader(); @@ -42,8 +69,8 @@ TEST(DexFileTest, Header) { EXPECT_EQ(320U, header.data_off_); } -TEST(DexFileTest, ClassDefs) { - scoped_ptr<const DexFile> raw(OpenDexFileBase64(kNestedDex, "kNestedDex")); +TEST_F(DexFileTest, ClassDefs) { + scoped_ptr<const DexFile> raw(OpenTestDexFile("Nested")); ASSERT_TRUE(raw != NULL); EXPECT_EQ(2U, raw->NumClassDefs()); @@ -54,8 +81,8 @@ TEST(DexFileTest, ClassDefs) { EXPECT_STREQ("LNested;", raw->GetClassDescriptor(c1)); } -TEST(DexFileTest, CreateMethodDescriptor) { - scoped_ptr<const DexFile> raw(OpenDexFileBase64(kCreateMethodDescriptorDex, "kCreateMethodDescriptorDex")); +TEST_F(DexFileTest, CreateMethodDescriptor) { + scoped_ptr<const DexFile> raw(OpenTestDexFile("CreateMethodDescriptor")); ASSERT_TRUE(raw != NULL); EXPECT_EQ(1U, raw->NumClassDefs()); diff --git a/src/dex_verifier_test.cc b/src/dex_verifier_test.cc index f1d99e689b..a9da38fe5a 100644 --- a/src/dex_verifier_test.cc +++ b/src/dex_verifier_test.cc @@ -2,13 +2,11 @@ #include "class_linker.h" #include "common_test.h" -#include "compiler_test.h" #include "dex_file.h" #include "dex_verifier.h" #include "scoped_ptr.h" #include <stdio.h> -#include "gtest/gtest.h" namespace art { @@ -40,8 +38,8 @@ TEST_F(DexVerifierTest, LibCore) { } TEST_F(DexVerifierTest, IntMath) { - const DexFile* dex = OpenDexFileBase64(kIntMathDex, "kIntMathDex"); - PathClassLoader* class_loader = AllocPathClassLoader(dex); + scoped_ptr<const DexFile> dex(OpenTestDexFile("IntMath")); + PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); Class* klass = class_linker_->FindClass("LIntMath;", class_loader); ASSERT_TRUE(DexVerify::VerifyClass(klass)); } diff --git a/src/exception_test.cc b/src/exception_test.cc index a1a101da78..f2701dd94d 100644 --- a/src/exception_test.cc +++ b/src/exception_test.cc @@ -94,7 +94,7 @@ class ExceptionTest : public CommonTest { return DexFile::CatchHandlerItem(); } - scoped_ptr<DexFile> dex_; + scoped_ptr<const DexFile> dex_; Method* method_f_; Method* method_g_; diff --git a/src/image_test.cc b/src/image_test.cc index 54c2c75ca6..bd30e71816 100644 --- a/src/image_test.cc +++ b/src/image_test.cc @@ -51,7 +51,7 @@ TEST_F(ImageTest, WriteRead) { // lucky by pointers that happen to work referencing the earlier // dex. delete java_lang_dex_file_.release(); - scoped_ptr<DexFile> dex(GetLibCoreDex()); + scoped_ptr<const DexFile> dex(GetLibCoreDex()); ASSERT_TRUE(dex != NULL); std::vector<const DexFile*> boot_class_path; diff --git a/src/jni_compiler_test.cc b/src/jni_compiler_test.cc index 4611b3cd8e..ce0bb51621 100644 --- a/src/jni_compiler_test.cc +++ b/src/jni_compiler_test.cc @@ -21,7 +21,7 @@ class JniCompilerTest : public CommonTest { protected: virtual void SetUp() { CommonTest::SetUp(); - dex_.reset(OpenDexFileBase64(kMyClassNativesDex, "kMyClassNativesDex")); + dex_.reset(OpenTestDexFile("MyClassNatives")); class_loader_ = AllocPathClassLoader(dex_.get()); Thread::Current()->SetClassLoaderOverride(class_loader_); } @@ -65,7 +65,7 @@ class JniCompilerTest : public CommonTest { static jclass jklass_; static jobject jobj_; protected: - scoped_ptr<DexFile> dex_; + scoped_ptr<const DexFile> dex_; PathClassLoader* class_loader_; Assembler jni_asm; JniCompiler jni_compiler; diff --git a/src/jni_internal_test.cc b/src/jni_internal_test.cc index fc51db032f..c66bb42ae1 100644 --- a/src/jni_internal_test.cc +++ b/src/jni_internal_test.cc @@ -621,7 +621,7 @@ TEST_F(JniInternalTest, GetObjectArrayElement_SetObjectArrayElement) { TEST_F(JniInternalTest, GetPrimitiveField_SetPrimitiveField) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kAllFields, "kAllFields")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("AllFields")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); Thread::Current()->SetClassLoaderOverride(class_loader); @@ -650,7 +650,7 @@ TEST_F(JniInternalTest, GetPrimitiveField_SetPrimitiveField) { } TEST_F(JniInternalTest, GetObjectField_SetObjectField) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kAllFields, "kAllFields")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("AllFields")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); Thread::Current()->SetClassLoaderOverride(class_loader); @@ -806,7 +806,7 @@ Method::InvokeStub* AllocateStub(Method* method, #if defined(__arm__) TEST_F(JniInternalTest, StaticMainMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kMainDex, "kMainDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("Main")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); @@ -832,7 +832,7 @@ TEST_F(JniInternalTest, StaticMainMethod) { } TEST_F(JniInternalTest, StaticNopMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStaticLeafMethodsDex, "kStaticLeafMethodsDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("StaticLeafMethods")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); @@ -857,7 +857,7 @@ TEST_F(JniInternalTest, StaticNopMethod) { } TEST_F(JniInternalTest, StaticIdentityByteMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStaticLeafMethodsDex, "kStaticLeafMethodsDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("StaticLeafMethods")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); @@ -903,7 +903,7 @@ TEST_F(JniInternalTest, StaticIdentityByteMethod) { } TEST_F(JniInternalTest, StaticIdentityIntMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStaticLeafMethodsDex, "kStaticLeafMethodsDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("StaticLeafMethods")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); @@ -949,7 +949,7 @@ TEST_F(JniInternalTest, StaticIdentityIntMethod) { } TEST_F(JniInternalTest, StaticIdentityDoubleMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStaticLeafMethodsDex, "kStaticLeafMethodsDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("StaticLeafMethods")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); @@ -996,7 +996,7 @@ TEST_F(JniInternalTest, StaticIdentityDoubleMethod) { } TEST_F(JniInternalTest, StaticSumIntIntMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStaticLeafMethodsDex, "kStaticLeafMethodsDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("StaticLeafMethods")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); @@ -1054,7 +1054,7 @@ TEST_F(JniInternalTest, StaticSumIntIntMethod) { } TEST_F(JniInternalTest, StaticSumIntIntIntMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStaticLeafMethodsDex, "kStaticLeafMethodsDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("StaticLeafMethods")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); @@ -1119,7 +1119,7 @@ TEST_F(JniInternalTest, StaticSumIntIntIntMethod) { } TEST_F(JniInternalTest, StaticSumIntIntIntIntMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStaticLeafMethodsDex, "kStaticLeafMethodsDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("StaticLeafMethods")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); @@ -1190,7 +1190,7 @@ TEST_F(JniInternalTest, StaticSumIntIntIntIntMethod) { } TEST_F(JniInternalTest, StaticSumIntIntIntIntIntMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStaticLeafMethodsDex, "kStaticLeafMethodsDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("StaticLeafMethods")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); @@ -1268,7 +1268,7 @@ TEST_F(JniInternalTest, StaticSumIntIntIntIntIntMethod) { } TEST_F(JniInternalTest, StaticSumDoubleDoubleMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStaticLeafMethodsDex, "kStaticLeafMethodsDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("StaticLeafMethods")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); @@ -1327,7 +1327,7 @@ TEST_F(JniInternalTest, StaticSumDoubleDoubleMethod) { } TEST_F(JniInternalTest, StaticSumDoubleDoubleDoubleMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStaticLeafMethodsDex, "kStaticLeafMethodsDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("StaticLeafMethods")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); @@ -1379,7 +1379,7 @@ TEST_F(JniInternalTest, StaticSumDoubleDoubleDoubleMethod) { } TEST_F(JniInternalTest, StaticSumDoubleDoubleDoubleDoubleMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStaticLeafMethodsDex, "kStaticLeafMethodsDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("StaticLeafMethods")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); @@ -1436,7 +1436,7 @@ TEST_F(JniInternalTest, StaticSumDoubleDoubleDoubleDoubleMethod) { } TEST_F(JniInternalTest, StaticSumDoubleDoubleDoubleDoubleDoubleMethod) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kStaticLeafMethodsDex, "kStaticLeafMethodsDex")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("StaticLeafMethods")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); ASSERT_TRUE(class_loader != NULL); diff --git a/src/object_test.cc b/src/object_test.cc index 8979e8dcf9..a862f71824 100644 --- a/src/object_test.cc +++ b/src/object_test.cc @@ -201,7 +201,7 @@ TEST_F(ObjectTest, AllocArrayFromCode) { } TEST_F(ObjectTest, StaticFieldFromCode) { - // pretend we are trying to call 'new String' from Object.toString + // pretend we are trying to access 'String.ASCII' from String.<clinit> Class* java_lang_String = class_linker_->FindSystemClass("Ljava/lang/String;"); Method* clinit = java_lang_String->FindDirectMethod("<clinit>", "()V"); uint32_t field_idx = FindFieldIdxByDescriptorAndName(*java_lang_dex_file_.get(), @@ -215,8 +215,9 @@ TEST_F(ObjectTest, StaticFieldFromCode) { Field::SetObjStaticFromCode(field_idx, clinit, NULL); EXPECT_EQ(NULL, Field::GetObjStaticFromCode(field_idx, clinit)); - + // TODO: more exhaustive tests of all 6 cases of Field::*FromCode + // TODO: test should not assume private internals such as String.ASCII field. } TEST_F(ObjectTest, String) { @@ -273,9 +274,9 @@ TEST_F(ObjectTest, StringEquals) { TEST_F(ObjectTest, DescriptorCompare) { ClassLinker* linker = class_linker_; - scoped_ptr<DexFile> proto1_dex_file(OpenDexFileBase64(kProtoCompareDex, "kProtoCompareDex")); + scoped_ptr<const DexFile> proto1_dex_file(OpenTestDexFile("ProtoCompare")); PathClassLoader* class_loader_1 = AllocPathClassLoader(proto1_dex_file.get()); - scoped_ptr<DexFile> proto2_dex_file(OpenDexFileBase64(kProtoCompare2Dex, "kProtoCompare2Dex")); + scoped_ptr<const DexFile> proto2_dex_file(OpenTestDexFile("ProtoCompare2")); PathClassLoader* class_loader_2 = AllocPathClassLoader(proto2_dex_file.get()); Class* klass1 = linker->FindClass("LProtoCompare;", class_loader_1); @@ -322,7 +323,7 @@ TEST_F(ObjectTest, StringHashCode) { } TEST_F(ObjectTest, InstanceOf) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kXandY, "kXandY")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("XandY")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); Class* X = class_linker_->FindClass("LX;", class_loader); Class* Y = class_linker_->FindClass("LY;", class_loader); @@ -349,7 +350,7 @@ TEST_F(ObjectTest, InstanceOf) { } TEST_F(ObjectTest, IsAssignableFrom) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kXandY, "kXandY")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("XandY")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); Class* X = class_linker_->FindClass("LX;", class_loader); Class* Y = class_linker_->FindClass("LY;", class_loader); @@ -361,7 +362,7 @@ TEST_F(ObjectTest, IsAssignableFrom) { } TEST_F(ObjectTest, IsAssignableFromArray) { - scoped_ptr<DexFile> dex(OpenDexFileBase64(kXandY, "kXandY")); + scoped_ptr<const DexFile> dex(OpenTestDexFile("XandY")); PathClassLoader* class_loader = AllocPathClassLoader(dex.get()); Class* X = class_linker_->FindClass("LX;", class_loader); Class* Y = class_linker_->FindClass("LY;", class_loader); diff --git a/src/runtime.cc b/src/runtime.cc index 2443cc6ba9..33b372b0c6 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -165,7 +165,7 @@ void LoadJniLibrary(JavaVMExt* vm, const char* name) { } } -DexFile* Open(const std::string& filename) { +const DexFile* Open(const std::string& filename) { if (filename.size() < 4) { LOG(WARNING) << "Ignoring short classpath entry '" << filename << "'"; return NULL; @@ -184,7 +184,7 @@ void CreateBootClassPath(const char* boot_class_path_cstr, std::vector<std::string> parsed; ParseClassPath(boot_class_path_cstr, parsed); for (size_t i = 0; i < parsed.size(); ++i) { - DexFile* dex_file = Open(parsed[i]); + const DexFile* dex_file = Open(parsed[i]); if (dex_file != NULL) { boot_class_path_vector.push_back(dex_file); } diff --git a/test/AllFields/AllFields.java b/test/AllFields/AllFields.java new file mode 100644 index 0000000000..86b884119d --- /dev/null +++ b/test/AllFields/AllFields.java @@ -0,0 +1,25 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class AllFields { + static boolean sZ; + static byte sB; + static char sC; + static double sD; + static float sF; + static int sI; + static long sJ; + static short sS; + static Object sObject; + static Object[] sObjectArray; + + boolean iZ; + byte iB; + char iC; + double iD; + float iF; + int iI; + long iJ; + short iS; + Object iObject; + Object[] iObjectArray; +} diff --git a/test/CreateMethodDescriptor/CreateMethodDescriptor.java b/test/CreateMethodDescriptor/CreateMethodDescriptor.java new file mode 100644 index 0000000000..aa1f3de309 --- /dev/null +++ b/test/CreateMethodDescriptor/CreateMethodDescriptor.java @@ -0,0 +1,6 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class CreateMethodDescriptor { + Float m1(int a, double b, long c, Object d) { return null; } + CreateMethodDescriptor m2(boolean x, short y, char z) { return null; } +} diff --git a/test/Fibonacci/Fibonacci.java b/test/Fibonacci/Fibonacci.java new file mode 100644 index 0000000000..5137205cd7 --- /dev/null +++ b/test/Fibonacci/Fibonacci.java @@ -0,0 +1,30 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class Fibonacci { + + static int fibonacci(int n) { + if (n == 0) { + return 0; + } + int x = 1; + int y = 1; + for (int i = 3; i <= n; i++) { + int z = x + y; + x = y; + y = z; + } + return y; + } + + public static void main(String[] args) { + try { + if (args.length == 1) { + int x = Integer.parseInt(args[0]); + int y = fibonacci(x); /* to warm up cache */ + System.out.printf("fibonacci(%d)=%d\n", x, y); + y = fibonacci(x +1); + System.out.printf("fibonacci(%d)=%d\n", x, y); + } + } catch (NumberFormatException ex) {} + } +} diff --git a/test/IntMath/IntMath.java b/test/IntMath/IntMath.java new file mode 100644 index 0000000000..c13a79a903 --- /dev/null +++ b/test/IntMath/IntMath.java @@ -0,0 +1,805 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class IntMath { + + public static boolean mBoolean1, mBoolean2; + public static byte mByte1, mByte2; + public static char mChar1, mChar2; + public static short mShort1, mShort2; + public static int mInt1, mInt2; + public static float mFloat1, mFloat2; + public static long mLong1, mLong2; + public static double mDouble1, mDouble2; + public static volatile long mVolatileLong1, mVolatileLong2; + + + private int foo_; + + public IntMath(int stuff) { + foo_ = stuff; + } + + public IntMath() { + foo_ = 123; + } + + static int staticFieldTest(int x) { + mBoolean1 = true; + mBoolean2 = false; + mByte1 = 127; + mByte2 = -128; + mChar1 = 32767; + mChar2 = 65535; + mShort1 = 32767; + mShort2 = -32768; + mInt1 = 65537; + mInt2 = -65537; + mFloat1 = 3.1415f; + mFloat2 = -1.0f / 0.0f; // -inf + mLong1 = 1234605616436508552L; // 0x1122334455667788 + mLong2 = -1234605616436508552L; + mDouble1 = 3.1415926535; + mDouble2 = 1.0 / 0.0; // +inf + mVolatileLong1 = mLong1 - 1; + mVolatileLong2 = mLong2 + 1; + + if (!mBoolean1) { return 10; } + if (mBoolean2) { return 11; } + if (mByte1 != 127) { return 12; } + if (mByte2 != -128) { return 13; } + if (mChar1 != 32767) { return 14; } + if (mChar2 != 65535) { return 15; } + if (mShort1 != 32767) { return 16; } + if (mShort2 != -32768) { return 17; } + if (mInt1 != 65537) { return 18; } + if (mInt2 != -65537) { return 19; } + if (!(mFloat1 > 3.141f && mFloat1 < 3.142f)) { return 20; } + if (mFloat2 >= mFloat1) { return 21; } + if (mLong1 != 1234605616436508552L) { return 22; } + if (mLong2 != -1234605616436508552L) { return 23; } + if (!(mDouble1 > 3.141592653 && mDouble1 < 3.141592654)) { return 24; } + if (mDouble2 <= mDouble1) { return 25; } + if (mVolatileLong1 != 1234605616436508551L) { return 26; } + if (mVolatileLong2 != -1234605616436508551L) { return 27; } + + return 1000 + x; + } + + /* + * Try to cause some unary operations. + */ + static int unopTest(int x) { + x = -x; + x ^= 0xffffffff; + return x; + } + + static int shiftTest1() { + final int[] mBytes = { + 0x11, 0x22, 0x33, 0x44, 0x88, 0x99, 0xaa, 0xbb + }; + long l; + int i1, i2; + + if (mBytes[0] != 0x11) return 20; + if (mBytes[1] != 0x22) return 21; + if (mBytes[2] != 0x33) return 22; + if (mBytes[3] != 0x44) return 23; + if (mBytes[4] != 0x88) return 24; + if (mBytes[5] != 0x99) return 25; + if (mBytes[6] != 0xaa) return 26; + if (mBytes[7] != 0xbb) return 27; + + i1 = mBytes[0] | mBytes[1] << 8 | mBytes[2] << 16 | mBytes[3] << 24; + i2 = mBytes[4] | mBytes[5] << 8 | mBytes[6] << 16 | mBytes[7] << 24; + l = i1 | ((long)i2 << 32); + + if (i1 != 0x44332211) { return 0x80000000 | i1; } + if (i2 != 0xbbaa9988) { return 2; } + if (l != 0xbbaa998844332211L) { return 3; } + + l = (long)mBytes[0] + | (long)mBytes[1] << 8 + | (long)mBytes[2] << 16 + | (long)mBytes[3] << 24 + | (long)mBytes[4] << 32 + | (long)mBytes[5] << 40 + | (long)mBytes[6] << 48 + | (long)mBytes[7] << 56; + + if (l != 0xbbaa998844332211L) { return 4; } + return 0; + } + + static int shiftTest2() { + + long a = 0x11; + long b = 0x22; + long c = 0x33; + long d = 0x44; + long e = 0x55; + long f = 0x66; + long g = 0x77; + long h = 0x88; + + long result = ((a << 56) | (b << 48) | (c << 40) | (d << 32) | + (e << 24) | (f << 16) | (g << 8) | h); + + if (result != 0x1122334455667788L) { return 1; } + return 0; + } + + static int unsignedShiftTest() { + byte b = -4; + short s = -4; + char c = 0xfffc; + int i = -4; + + b >>>= 4; + s >>>= 4; + c >>>= 4; + i >>>= 4; + + if ((int) b != -1) { return 1; } + if ((int) s != -1) { return 2; } + if ((int) c != 0x0fff) { return 3; } + if (i != 268435455) { return 4; } + return 0; + } + + static int convTest() { + + float f; + double d; + int i; + long l; + + /* int --> long */ + i = 7654; + l = (long) i; + if (l != 7654L) { return 1; } + + i = -7654; + l = (long) i; + if (l != -7654L) { return 2; } + + /* long --> int (with truncation) */ + l = 5678956789L; + i = (int) l; + if (i != 1383989493) { return 3; } + + l = -5678956789L; + i = (int) l; + if (i != -1383989493) { return 4; } + return 0; + } + + static int charSubTest() { + + char char1 = 0x00e9; + char char2 = 0xffff; + int i; + + /* chars are unsigned-expanded to ints before subtraction */ + i = char1 - char2; + if (i != 0xffff00ea) { return 1; } + return 0; + } + + /* + * We pass in the arguments and return the results so the compiler + * doesn't do the math for us. (x=70000, y=-3) + */ + static int intOperTest(int x, int y) { + int[] results = new int[10]; + + /* this seems to generate "op-int" instructions */ + results[0] = x + y; + results[1] = x - y; + results[2] = x * y; + results[3] = x * x; + results[4] = x / y; + results[5] = x % -y; + results[6] = x & y; + results[7] = x | y; + results[8] = x ^ y; + + /* this seems to generate "op-int/2addr" instructions */ + results[9] = x + ((((((((x + y) - y) * y) / y) % y) & y) | y) ^ y); + + /* check this edge case while we're here (div-int/2addr) */ + int minInt = -2147483648; + int negOne = -results[5]; + int plusOne = 1; + int result = (((minInt + plusOne) - plusOne) / negOne) / negOne; + + if (result != minInt) { return 1;}; + if (results[0] != 69997) { return 2;}; + if (results[1] != 70003) { return 3;}; + if (results[2] != -210000) { return 4;}; + if (results[3] != 605032704) { return 5;}; + if (results[4] != -23333) { return 6;}; + if (results[5] != 1) { return 7;}; + if (results[6] != 70000) { return 8;}; + if (results[7] != -3) { return 9;}; + if (results[8] != -70003) { return 10;}; + if (results[9] != 70000) { return 11;}; + + return 0; + } + + /* + * More operations, this time with 16-bit constants. (x=77777) + */ + static int lit16Test(int x) { + + int[] results = new int[8]; + + /* try to generate op-int/lit16" instructions */ + results[0] = x + 1000; + results[1] = 1000 - x; + results[2] = x * 1000; + results[3] = x / 1000; + results[4] = x % 1000; + results[5] = x & 1000; + results[6] = x | -1000; + results[7] = x ^ -1000; + + if (results[0] != 78777) { return 1; } + if (results[1] != -76777) { return 2; } + if (results[2] != 77777000) { return 3; } + if (results[3] != 77) { return 4; } + if (results[4] != 777) { return 5; } + if (results[5] != 960) { return 6; } + if (results[6] != -39) { return 7; } + if (results[7] != -76855) { return 8; } + return 0; + } + + /* + * More operations, this time with 8-bit constants. (x=-55555) + */ + static int lit8Test(int x) { + + int[] results = new int[8]; + + /* try to generate op-int/lit8" instructions */ + results[0] = x + 10; + results[1] = 10 - x; + results[2] = x * 10; + results[3] = x / 10; + results[4] = x % 10; + results[5] = x & 10; + results[6] = x | -10; + results[7] = x ^ -10; + int minInt = -2147483648; + int result = minInt / -1; + if (result != minInt) {return 1; } + if (results[0] != -55545) {return 2; } + if (results[1] != 55565) {return 3; } + if (results[2] != -555550) {return 4; } + if (results[3] != -5555) {return 5; } + if (results[4] != -5) {return 6; } + if (results[5] != 8) {return 7; } + if (results[6] != -1) {return 8; } + if (results[7] != 55563) {return 9; } + return 0; + } + + + /* + * Shift some data. (value=0xff00aa01, dist=8) + */ + static int intShiftTest(int value, int dist) { + int results[] = new int[4]; + results[0] = value << dist; + results[1] = value >> dist; + results[2] = value >>> dist; + results[3] = (((value << dist) >> dist) >>> dist) << dist; + if (results[0] != 0x00aa0100) {return 1; } + if (results[1] != 0xffff00aa) {return 2; } + if (results[2] != 0x00ff00aa) {return 3; } + if (results[3] != 0xaa00) {return 4; } + return 0; + } + + /* + * We pass in the arguments and return the results so the compiler + * doesn't do the math for us. (x=70000000000, y=-3) + */ + static int longOperTest(long x, long y) { + long[] results = new long[10]; + + /* this seems to generate "op-long" instructions */ + results[0] = x + y; + results[1] = x - y; + results[2] = x * y; + results[3] = x * x; + results[4] = x / y; + results[5] = x % -y; + results[6] = x & y; + results[7] = x | y; + results[8] = x ^ y; + /* this seems to generate "op-long/2addr" instructions */ + results[9] = x + ((((((((x + y) - y) * y) / y) % y) & y) | y) ^ y); + /* check this edge case while we're here (div-long/2addr) */ + long minLong = -9223372036854775808L; + long negOne = -results[5]; + long plusOne = 1; + long result = (((minLong + plusOne) - plusOne) / negOne) / negOne; + if (result != minLong) { return 1; } + if (results[0] != 69999999997L) { return 2; } + if (results[1] != 70000000003L) { return 3; } + if (results[2] != -210000000000L) { return 4; } + if (results[3] != -6833923606740729856L) { return 5; } // overflow + if (results[4] != -23333333333L) { return 6; } + if (results[5] != 1) { return 7; } + if (results[6] != 70000000000L) { return 8; } + if (results[7] != -3) { return 9; } + if (results[8] != -70000000003L) { return 10; } + if (results[9] != 70000000000L) { return 11; } + if (results.length != 10) { return 12; } + return 0; + } + + /* + * Shift some data. (value=0xd5aa96deff00aa01, dist=16) + */ + static long longShiftTest(long value, int dist) { + long results[] = new long[4]; + results[0] = value << dist; + results[1] = value >> dist; + results[2] = value >>> dist; + results[3] = (((value << dist) >> dist) >>> dist) << dist; + if (results[0] != 0x96deff00aa010000L) { return results[0]; } + if (results[1] != 0xffffd5aa96deff00L) { return results[1]; } + if (results[2] != 0x0000d5aa96deff00L) { return results[2]; } + if (results[3] != 0xffff96deff000000L) { return results[3]; } + if (results.length != 4) { return 5; } + + return results[0]; // test return-long + } + + static int switchTest(int a) { + int res = 1234; + + switch (a) { + case -1: res = 1; return res; + case 0: res = 2; return res; + case 1: /*correct*/ break; + case 2: res = 3; return res; + case 3: res = 4; return res; + case 4: res = 5; return res; + default: res = 6; return res; + } + switch (a) { + case 3: res = 7; return res; + case 4: res = 8; return res; + default: /*correct*/ break; + } + + a = 0x12345678; + + switch (a) { + case 0x12345678: /*correct*/ break; + case 0x12345679: res = 9; return res; + default: res = 1; return res; + } + switch (a) { + case 57: res = 10; return res; + case -6: res = 11; return res; + case 0x12345678: /*correct*/ break; + case 22: res = 12; return res; + case 3: res = 13; return res; + default: res = 14; return res; + } + switch (a) { + case -6: res = 15; return res; + case 3: res = 16; return res; + default: /*correct*/ break; + } + + a = -5; + switch (a) { + case 12: res = 17; return res; + case -5: /*correct*/ break; + case 0: res = 18; return res; + default: res = 19; return res; + } + + switch (a) { + default: /*correct*/ break; + } + return res; + } + /* + * Test the integer comparisons in various ways. + */ + static int testIntCompare(int minus, int plus, int plus2, int zero) { + int res = 1111; + + if (minus > plus) + return 1; + if (minus >= plus) + return 2; + if (plus < minus) + return 3; + if (plus <= minus) + return 4; + if (plus == minus) + return 5; + if (plus != plus2) + return 6; + + /* try a branch-taken */ + if (plus != minus) { + res = res; + } else { + return 7; + } + + if (minus > 0) + return 8; + if (minus >= 0) + return 9; + if (plus < 0) + return 10; + if (plus <= 0) + return 11; + if (plus == 0) + return 12; + if (zero != 0) + return 13; + + if (zero == 0) { + res = res; + } else { + return 14; + } + return res; + } + + /* + * Test cmp-long. + * + * minus=-5, alsoMinus=0xFFFFFFFF00000009, plus=4, alsoPlus=8 + */ + static int testLongCompare(long minus, long alsoMinus, long plus, + long alsoPlus) { + int res = 2222; + + if (minus > plus) + return 2; + if (plus < minus) + return 3; + if (plus == minus) + return 4; + + if (plus >= plus+1) + return 5; + if (minus >= minus+1) + return 6; + + /* try a branch-taken */ + if (plus != minus) { + res = res; + } else { + return 7; + } + + /* compare when high words are equal but low words differ */ + if (plus > alsoPlus) + return 8; + if (alsoPlus < plus) + return 9; + if (alsoPlus == plus) + return 10; + + /* high words are equal, low words have apparently different signs */ + if (minus < alsoMinus) // bug! + return 11; + if (alsoMinus > minus) + return 12; + if (alsoMinus == minus) + return 13; + + return res; + } + + /* + * Test cmpl-float and cmpg-float. + */ + static int testFloatCompare(float minus, float plus, float plus2, + float nan) { + + int res = 3333; + if (minus > plus) + res = 1; + if (plus < minus) + res = 2; + if (plus == minus) + res = 3; + if (plus != plus2) + res = 4; + + if (plus <= nan) + res = 5; + if (plus >= nan) + res = 6; + if (minus <= nan) + res = 7; + if (minus >= nan) + res = 8; + if (nan >= plus) + res = 9; + if (nan <= plus) + res = 10; + + if (nan == nan) + res = 1212; + + return res; + } + + static int testDoubleCompare(double minus, double plus, double plus2, + double nan) { + + int res = 4444; + + if (minus > plus) + return 1; + if (plus < minus) + return 2; + if (plus == minus) + return 3; + if (plus != plus2) + return 4; + + if (plus <= nan) + return 5; + if (plus >= nan) + return 6; + if (minus <= nan) + return 7; + if (minus >= nan) + return 8; + if (nan >= plus) + return 9; + if (nan <= plus) + return 10; + + if (nan == nan) + return 11; + return res; + } + + static int fibonacci(int n) { + if (n == 0) { + return 0; + } else if (n == 1) { + return 1; + } else { + return fibonacci(n - 1) + fibonacci(n - 2); + } + } + + /* + static void throwNullPointerException() { + throw new NullPointerException("first throw"); + } + + static int throwAndCatch() { + try { + throwNullPointerException(); + return 1; + } catch (NullPointerException npe) { + return 0; + } + } + */ + + static int manyArgs(int a0, long a1, int a2, long a3, int a4, long a5, + int a6, int a7, double a8, float a9, double a10, short a11, int a12, + char a13, int a14, int a15, byte a16, boolean a17, int a18, int a19, + long a20, long a21, int a22, int a23, int a24, int a25, int a26) + { + if (a0 != 0) return 0; + if (a1 != 1L) return 1; + if (a2 != 2) return 2; + if (a3 != 3L) return 3; + if (a4 != 4) return 4; + if (a5 != 5L) return 5; + if (a6 != 6) return 6; + if (a7 != 7) return 7; + if (a8 != 8.0) return 8; + if (a9 != 9.0f) return 9; + if (a10 != 10.0) return 10; + if (a11 != (short)11) return 11; + if (a12 != 12) return 12; + if (a13 != (char)13) return 13; + if (a14 != 14) return 14; + if (a15 != 15) return 15; + if (a16 != (byte)-16) return 16; + if (a17 != true) return 17; + if (a18 != 18) return 18; + if (a19 != 19) return 19; + if (a20 != 20L) return 20; + if (a21 != 21L) return 21; + if (a22 != 22) return 22; + if (a23 != 23) return 23; + if (a24 != 24) return 24; + if (a25 != 25) return 25; + if (a26 != 26) return 26; + return -1; + } + + int virtualCall(int a) + { + return a * 2; + } + + void setFoo(int a) + { + foo_ = a; + } + + int getFoo() + { + return foo_; + } + + static int staticCall(int a) + { + IntMath foo = new IntMath(); + return foo.virtualCall(a); + } + + static int testIGetPut(int a) + { + IntMath foo = new IntMath(99); + IntMath foo123 = new IntMath(); + int z = foo.getFoo(); + z += a; + z += foo123.getFoo(); + foo.setFoo(z); + return foo.getFoo(); + } + + public static void main(String[] args) { + int res = unopTest(38); + if (res == 37) { + System.out.printf("unopTest PASSED\n"); + } else { + System.out.printf("unopTest FAILED: %d\n", res); + } + res = shiftTest1(); + if (res == 0) { + System.out.printf("shiftTest1 PASSED\n"); + } else { + System.out.printf("shiftTest1 FAILED: %d\n", res); + } + res = shiftTest2(); + if (res == 0) { + System.out.printf("shiftTest2 PASSED\n"); + } else { + System.out.printf("shiftTest2 FAILED: %d\n", res); + } + res = unsignedShiftTest(); + if (res == 0) { + System.out.printf("unsignedShiftTest PASSED\n"); + } else { + System.out.printf("unsignedShiftTest FAILED: %d\n", res); + } + res = convTest(); + if (res == 0) { + System.out.printf("convTest PASSED\n"); + } else { + System.out.printf("convTest FAILED: %d\n", res); + } + res = charSubTest(); + if (res == 0) { + System.out.printf("charSubTest PASSED\n"); + } else { + System.out.printf("charSubTest FAILED: %d\n", res); + } + res = intOperTest(70000, -3); + if (res == 0) { + System.out.printf("intOperTest PASSED\n"); + } else { + System.out.printf("intOperTest FAILED: %d\n", res); + } + res = longOperTest(70000000000L, -3L); + if (res == 0) { + System.out.printf("longOperTest PASSED\n"); + } else { + System.out.printf("longOperTest FAILED: %d\n", res); + } + long lres = longShiftTest(0xd5aa96deff00aa01L, 16); + if (lres == 0x96deff00aa010000L) { + System.out.printf("longShiftTest PASSED\n"); + } else { + System.out.printf("longShiftTest FAILED: %d\n", res); + } + + res = switchTest(1); + if (res == 1234) { + System.out.printf("switchTest PASSED\n"); + } else { + System.out.printf("switchTest FAILED: %d\n", res); + } + + res = testIntCompare(-5, 4, 4, 0); + if (res == 1111) { + System.out.printf("testIntCompare PASSED\n"); + } else { + System.out.printf("testIntCompare FAILED: %d\n", res); + } + + res = testLongCompare(-5L, -4294967287L, 4L, 8L); + if (res == 2222) { + System.out.printf("testLongCompare PASSED\n"); + } else { + System.out.printf("testLongCompare FAILED: %d\n", res); + } + + res = testFloatCompare(-5.0f, 4.0f, 4.0f, (1.0f/0.0f) / (1.0f/0.0f)); + if (res == 3333) { + System.out.printf("testFloatCompare PASSED\n"); + } else { + System.out.printf("testFloatCompare FAILED: %d\n", res); + } + + res = testDoubleCompare(-5.0, 4.0, 4.0, (1.0/0.0) / (1.0/0.0)); + if (res == 4444) { + System.out.printf("testDoubleCompare PASSED\n"); + } else { + System.out.printf("testDoubleCompare FAILED: %d\n", res); + } + + res = fibonacci(10); + if (res == 55) { + System.out.printf("fibonacci PASSED\n"); + } else { + System.out.printf("fibonacci FAILED: %d\n", res); + } + + /* + res = throwAndCatch(); + if (res == 0) { + System.out.printf("throwAndCatch PASSED\n"); + } else { + System.out.printf("throwAndCatch FAILED: %d\n", res); + } + */ + + res = manyArgs(0, 1L, 2, 3L, 4, 5L, 6, 7, 8.0, 9.0f, 10.0, + (short)11, 12, (char)13, 14, 15, (byte)-16, true, 18, + 19, 20L, 21L, 22, 23, 24, 25, 26); + if (res == -1) { + System.out.printf("manyArgs PASSED\n"); + } else { + System.out.printf("manyArgs FAILED: %d\n", res); + } + + res = staticCall(3); + if (res == 6) { + System.out.printf("virtualCall PASSED\n"); + } else { + System.out.printf("virtualCall FAILED: %d\n", res); + } + + res = testIGetPut(111); + if (res == 333) { + System.out.printf("testGetPut PASSED\n"); + } else { + System.out.printf("testGetPut FAILED: %d\n", res); + } + + res = staticFieldTest(404); + if (res == 1404) { + System.out.printf("staticFieldTest PASSED\n"); + } else { + System.out.printf("staticFieldTest FAILED: %d\n", res); + } + } +} diff --git a/test/IntMath/java/lang/Object.java b/test/IntMath/java/lang/Object.java new file mode 100644 index 0000000000..67e54e321d --- /dev/null +++ b/test/IntMath/java/lang/Object.java @@ -0,0 +1,5 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +// TODO: remove this when separate compilation works +package java.lang; +public class Object {} diff --git a/test/Interfaces/Interfaces.java b/test/Interfaces/Interfaces.java new file mode 100644 index 0000000000..0b72e92b24 --- /dev/null +++ b/test/Interfaces/Interfaces.java @@ -0,0 +1,16 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class Interfaces { + interface I { + public void i(); + } + interface J { + public void j1(); + public void j2(); + } + class A implements I, J { + public void i() {}; + public void j1() {}; + public void j2() {}; + } +} diff --git a/test/Main/Main.java b/test/Main/Main.java new file mode 100644 index 0000000000..757d513201 --- /dev/null +++ b/test/Main/Main.java @@ -0,0 +1,6 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class Main { + public static void main(String args[]) { + } +} diff --git a/test/MyClass/MyClass.java b/test/MyClass/MyClass.java new file mode 100644 index 0000000000..7a0ccbc6d7 --- /dev/null +++ b/test/MyClass/MyClass.java @@ -0,0 +1,3 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class MyClass {} diff --git a/test/MyClassNatives/MyClassNatives.java b/test/MyClassNatives/MyClassNatives.java new file mode 100644 index 0000000000..5203e4a4c4 --- /dev/null +++ b/test/MyClassNatives/MyClassNatives.java @@ -0,0 +1,11 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class MyClass { + native void foo(); + native int fooI(int x); + native int fooII(int x, int y); + native double fooDD(double x, double y); + native Object fooIOO(int x, Object y, Object z); + static native Object fooSIOO(int x, Object y, Object z); + static synchronized native Object fooSSIOO(int x, Object y, Object z); +} diff --git a/test/Nested/Nested.java b/test/Nested/Nested.java new file mode 100644 index 0000000000..73d9e8a2cd --- /dev/null +++ b/test/Nested/Nested.java @@ -0,0 +1,6 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class Nested { + class Inner { + } +} diff --git a/test/ProtoCompare/ProtoCompare.java b/test/ProtoCompare/ProtoCompare.java new file mode 100644 index 0000000000..988e07aee2 --- /dev/null +++ b/test/ProtoCompare/ProtoCompare.java @@ -0,0 +1,8 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class ProtoCompare { + int m1(short x, int y, long z) { return x + y + (int)z; } + int m2(short x, int y, long z) { return x + y + (int)z; } + int m3(long x, int y, short z) { return (int)x + y + z; } + long m4(long x, int y, short z) { return x + y + z; } +} diff --git a/test/ProtoCompare2/ProtoCompare2.java b/test/ProtoCompare2/ProtoCompare2.java new file mode 100644 index 0000000000..60d1746242 --- /dev/null +++ b/test/ProtoCompare2/ProtoCompare2.java @@ -0,0 +1,8 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class ProtoCompare2 { + int m1(short x, int y, long z) { return x + y + (int)z; } + int m2(short x, int y, long z) { return x + y + (int)z; } + int m3(long x, int y, short z) { return (int)x + y + z; } + long m4(long x, int y, short z) { return x + y + z; } +} diff --git a/test/StaticLeafMethods/StaticLeafMethods.java b/test/StaticLeafMethods/StaticLeafMethods.java new file mode 100644 index 0000000000..72aed8563c --- /dev/null +++ b/test/StaticLeafMethods/StaticLeafMethods.java @@ -0,0 +1,39 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class StaticLeafMethods { + static void nop() { + } + static byte identity(byte x) { + return x; + } + static int identity(int x) { + return x; + } + static int sum(int a, int b) { + return a + b; + } + static int sum(int a, int b, int c) { + return a + b + c; + } + static int sum(int a, int b, int c, int d) { + return a + b + c + d; + } + static int sum(int a, int b, int c, int d, int e) { + return a + b + c + d + e; + } + static double identity(double x) { + return x; + } + static double sum(double a, double b) { + return a + b; + } + static double sum(double a, double b, double c) { + return a + b + c; + } + static double sum(double a, double b, double c, double d) { + return a + b + c + d; + } + static double sum(double a, double b, double c, double d, double e) { + return a + b + c + d + e; + } +} diff --git a/test/Statics/Statics.java b/test/Statics/Statics.java new file mode 100644 index 0000000000..c38447bad4 --- /dev/null +++ b/test/Statics/Statics.java @@ -0,0 +1,14 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class Statics { + static boolean s0 = true; + static byte s1 = 5; + static char s2 = 'a'; + static short s3 = (short) 65000; + static int s4 = 2000000000; + static long s5 = 0x123456789abcdefL; + static float s6 = 0.5f; + static double s7 = 16777217; + static Object s8 = "android"; + static Object[] s9 = { "a", "b" }; +} diff --git a/test/XandY/X.java b/test/XandY/X.java new file mode 100644 index 0000000000..7104ff80c9 --- /dev/null +++ b/test/XandY/X.java @@ -0,0 +1,3 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class X {} diff --git a/test/XandY/Y.java b/test/XandY/Y.java new file mode 100644 index 0000000000..a40c3ecfff --- /dev/null +++ b/test/XandY/Y.java @@ -0,0 +1,3 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +class Y extends X {} |