diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2012-10-04 15:14:10 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2012-10-04 15:16:21 +0400 |
commit | c9b493d00ffab61f0efab8946507482b4ba39217 (patch) | |
tree | d63cb3f243ad6aa4df304c5847f89952a62c20e8 /tests | |
parent | 4692f84521ce19f095bed6c65771c952c86e7066 (diff) | |
download | libatomic_ops-c9b493d00ffab61f0efab8946507482b4ba39217.tar.gz |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_stack.c | 18 |
1 files changed, 14 insertions, 4 deletions
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 <stdio.h> + +#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 <pthread.h> #include <stdlib.h> -#include <stdio.h> #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) |