On 14/03/16 15:21, Matt Caswell via RT wrote:
> 
> 
> On 14/03/16 15:05, Andy Polyakov via RT wrote:
>>>>> Bump... The issue is still present as of b36a2ef for OS X 10.6 64-bit.
>>>>> 32-bit tests OK.
>>>>>
>>>>> The relevant snippets are:
>>>>>
>>>>> $ make test
>>>>> ...
>>>>> ../test/recipes/90-test_async.t ........... 1/1
>>>>> #   Failed test 'running asynctest'
>>>>> #   at ../test/testlib/OpenSSL/Test/Simple.pm line 70.
>>>>> # Looks like you failed 1 test of 1.
>>>>> ../test/recipes/90-test_async.t ........... Dubious, test returned 1
>>>>> (wstat 256, 0x100)
>>>>> Failed 1/1 subtests
>>>>
>>>> Once again, "it boils down to the fact that getcontext always returns
>>>> failure to ppc64 program. There is nothing we can do about it, you just
>>>> have to accept that this particular thing doesn't work on MacOS
>>>> X/ppc64." getcontext is part of libc equivalent, which is why there is
>>>> nothing that can be done about it.
>>>>
>>>>
>>> Can we detect the platform in async_posix.h so that if we work out we're
>>> on ppc64 then we default to ASYNC_NULL?
>>
>> #if defined(__APPLE__) && (defined(__ppc64__) || defined(_ARCH_PPC64))
>>
>>
> So something like the attached?
> 
> Jeff, can you test this?

Jeff reported to me off list that this did not work.

Jeff - please can you try the attached alternative patch?

Thanks

Matt

>From d81d6f1d7b9bb9497e0661eacc616d35755fa24b Mon Sep 17 00:00:00 2001
From: Matt Caswell <m...@openssl.org>
Date: Wed, 16 Mar 2016 10:38:39 +0000
Subject: [PATCH] Some platforms provide getcontext() but it does not work

Some platforms claim to be POSIX but their getcontext() implementation
does not work. Therefore we update the ASYNC_is_capable() function to test
for this.
---
 crypto/async/arch/async_posix.c |  8 +++++++-
 test/asynctest.c                | 45 +++++++++++++----------------------------
 2 files changed, 21 insertions(+), 32 deletions(-)

diff --git a/crypto/async/arch/async_posix.c b/crypto/async/arch/async_posix.c
index 2d9e510..b0975c3 100644
--- a/crypto/async/arch/async_posix.c
+++ b/crypto/async/arch/async_posix.c
@@ -62,7 +62,13 @@
 
 int ASYNC_is_capable(void)
 {
-    return 1;
+    ucontext_t ctx;
+
+    /*
+     * Some platforms provide getcontext() but it does not work. Check for
+     * a working getcontext();
+     */
+    return getcontext(&ctx) == 0;
 }
 
 void async_local_cleanup(void)
diff --git a/test/asynctest.c b/test/asynctest.c
index 31f04e9..4694fda 100644
--- a/test/asynctest.c
+++ b/test/asynctest.c
@@ -61,21 +61,6 @@
 #include <openssl/crypto.h>
 #include <../apps/apps.h>
 
-#if (defined(OPENSSL_SYS_UNIX) || defined(OPENSSL_SYS_CYGWIN)) && defined(OPENSSL_THREADS)
-# include <unistd.h>
-# if _POSIX_VERSION >= 200112L
-#  define ASYNC_POSIX
-# endif
-#elif defined(_WIN32)
-# define ASYNC_WIN
-#endif
-
-#if !defined(ASYNC_POSIX) && !defined(ASYNC_WIN)
-# define ASYNC_NULL
-#endif
-
-#ifndef ASYNC_NULL
-
 static int ctr = 0;
 static ASYNC_JOB *currjob = NULL;
 
@@ -308,25 +293,23 @@ static int test_ASYNC_block_pause()
     return 1;
 }
 
-#endif
-
 int main(int argc, char **argv)
 {
-
-#ifdef ASYNC_NULL
-    fprintf(stderr, "NULL implementation - skipping async tests\n");
-#else
-    CRYPTO_set_mem_debug(1);
-    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
-
-    if (       !test_ASYNC_init_thread()
-            || !test_ASYNC_start_job()
-            || !test_ASYNC_get_current_job()
-            || !test_ASYNC_WAIT_CTX_get_all_fds()
-            || !test_ASYNC_block_pause()) {
-        return 1;
+    if (!ASYNC_is_capable()) {
+        fprintf(stderr,
+                "OpenSSL build is not ASYNC capable - skipping async tests\n");
+    } else {
+        CRYPTO_set_mem_debug(1);
+        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
+
+        if (       !test_ASYNC_init_thread()
+                || !test_ASYNC_start_job()
+                || !test_ASYNC_get_current_job()
+                || !test_ASYNC_WAIT_CTX_get_all_fds()
+                || !test_ASYNC_block_pause()) {
+            return 1;
+        }
     }
-#endif
     printf("PASS\n");
     return 0;
 }
-- 
2.5.0

-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev

Reply via email to