From: Ivan Maidanski Date: Thu, 4 Oct 2012 11:14:10 +0000 (+0400) Subject: Enable test_stack for pthreads-w32 X-Git-Tag: libatomic_ops-7_4_0~97 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9b493d00ffab61f0efab8946507482b4ba39217;p=libatomic_ops Enable test_stack for pthreads-w32 * tests/test_stack.c: Do not skip this test if AO_USE_WIN32_PTHREADS. * tests/test_stack.c (main): Report (to stdout) if the test skipped; always include stdio.h. * tests/test_stack.c (LIMIT): Allow to specify alternate value from command line; use smaller value (by 50 times) if AO_USE_PTHREAD_DEFS. --- diff --git a/tests/test_stack.c b/tests/test_stack.c index 27d375b..62400a3 100644 --- a/tests/test_stack.c +++ b/tests/test_stack.c @@ -15,12 +15,17 @@ # include "config.h" #endif -#if defined(__vxworks) || defined(_MSC_VER) || defined(_WIN32_WINCE) \ - || (defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)) +#include + +#if (((defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)) \ + || defined(_MSC_VER) || defined(_WIN32_WINCE)) \ + && !defined(AO_USE_WIN32_PTHREADS)) \ + || defined(__vxworks) /* Skip the test if no pthreads. */ int main(void) { + printf("test skipped\n"); return 0; } @@ -28,7 +33,6 @@ #include #include -#include #include "atomic_ops.h" #include "atomic_ops_stack.h" @@ -120,8 +124,14 @@ void check_list(int n) volatile AO_t ops_performed = 0; -#define LIMIT 1000000 +#ifndef LIMIT /* Total number of push/pop ops in all threads per test. */ +# ifdef AO_USE_PTHREAD_DEFS +# define LIMIT 20000 +# else +# define LIMIT 1000000 +# endif +#endif #ifdef AO_HAVE_fetch_and_add # define fetch_and_add(addr, val) AO_fetch_and_add(addr, val)