OSDN Git Service

ART: Relax java_vm_ext test
authorAndreas Gampe <agampe@google.com>
Fri, 9 Jan 2015 00:43:13 +0000 (16:43 -0800)
committerAndreas Gampe <agampe@google.com>
Fri, 9 Jan 2015 00:43:13 +0000 (16:43 -0800)
Bionic gives more than the requested stack size in some cases, see
change-id I7037ac8273ebe54dd19b1561c7a376819049124c. In that case,
attaching a thread with STACK_MIN may actually succeed.

Bug: 18908062
Change-Id: Ibb3f5c7a7399c01ec2032a133896cf91327370ed

runtime/java_vm_ext_test.cc

index 60c6a5c..2cbfa81 100644 (file)
@@ -69,7 +69,12 @@ static void* attach_current_thread_callback(void* arg ATTRIBUTE_UNUSED) {
     } else {
       ok = vms_buf[0]->AttachCurrentThreadAsDaemon(&env, nullptr);
     }
-    EXPECT_EQ(gSmallStack ? JNI_ERR : JNI_OK, ok);
+    // TODO: Find a way to test with exact SMALL_STACK value, for which we would bail. The pthreads
+    //       spec says that the stack size argument is a lower bound, and bionic currently gives us
+    //       a chunk more on arm64.
+    if (!gSmallStack) {
+      EXPECT_EQ(JNI_OK, ok);
+    }
     if (ok == JNI_OK) {
       ok = vms_buf[0]->DetachCurrentThread();
       EXPECT_EQ(JNI_OK, ok);