]> git.saurik.com Git - apple/libpthread.git/blobdiff - tests/pthread_attr_setstacksize.c
libpthread-301.1.6.tar.gz
[apple/libpthread.git] / tests / pthread_attr_setstacksize.c
index 032b832e9aee9b0174a0526a1dfd027207282359..845ff6579580e5645dc3bdcf48e6769f2cd5753e 100644 (file)
@@ -4,13 +4,26 @@
 #include <limits.h>
 #include <pthread.h>
 
-#include <darwintest.h>
+#include "darwintest_defaults.h"
 
 #define STACK_ALLOWANCE (1024ULL * 6)
 
 static void *
 pthread_attr_setstacksize_func(void *arg)
 {
+    if ((size_t)arg < 1024ULL * 32) {
+        /*
+         * We can't use darwintest because it requires a bigger stack than
+         * this, so cheat and use the return value for the test.
+         */
+#ifndef __arm64__
+        if ((size_t)arg != pthread_get_stacksize_np(pthread_self())) {
+            return NULL;
+        }
+#endif
+        return (void*)pthread_attr_setstacksize_func;
+    }
+
 #if defined(__arm64__)
     // Because of <rdar://problem/19941744>, the kext adds additional size to the stack on arm64.
     T_EXPECTFAIL;