diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2011-09-21 15:28:07 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2011-09-21 15:28:07 +0400 |
commit | f8a7e9922e625c56ce3e4781495bd0ff15a2857e (patch) | |
tree | ae437e3df4e113188d7331780109e5753458be3d | |
parent | 30ab2d5d6e3cb323410a5f1782cc80ef68bd400f (diff) | |
parent | 49a5fa61ad919162bff1d11c71f3d09a68166271 (diff) | |
download | libatomic_ops-f8a7e9922e625c56ce3e4781495bd0ff15a2857e.tar.gz |
Apply hotfix-7_2a6-2 to the current release
-rw-r--r-- | ChangeLog | 44 | ||||
-rwxr-xr-x | configure | 33 | ||||
-rw-r--r-- | configure.ac | 17 | ||||
-rw-r--r-- | tests/Makefile.am | 14 | ||||
-rw-r--r-- | tests/Makefile.in | 35 | ||||
-rw-r--r-- | tests/test_atomic_include.h | 33 | ||||
-rw-r--r-- | tests/test_malloc.c | 16 | ||||
-rw-r--r-- | tests/test_stack.c | 6 |
8 files changed, 152 insertions, 46 deletions
@@ -1,4 +1,46 @@ -2011-08-10 Ivan Maidanski <ivmai@mail.ru> (really Petter Urkedal) +2011-09-21 Ivan Maidanski <ivmai@mail.ru> + + * configure: Regenerate. + * tests/Makefile.in: Ditto. + * tests/test_atomic_include.h: Ditto. + +2011-09-21 Ivan Maidanski <ivmai@mail.ru> + + * configure.ac (PICFLAG, THREADDLLIBS): Define as empty for MinGW. + * configure.ac (have_pthreads): New definition (set to true unless + MinGW). + * configure.ac (HAVE_PTHREAD_H): New AM conditional (based on + have_pthreads value). + * tests/Makefile.am (test_atomic_pthreads_SOURCES, + test_atomic_pthreads_CPPFLAGS, test_atomic_pthreads_LDADD): Define + only if HAVE_PTHREAD_H. + * tests/Makefile.am (TESTS): Don't include test_atomic_pthreads unless + HAVE_PTHREAD_H. + * tests/Makefile.am (check_PROGRAMS): Define to TESTS value. + +2011-09-21 Ivan Maidanski <ivmai@mail.ru> + + * configure.ac (PICFLAG): Set to -fPIC if GCC but not Gygwin. + +2011-09-21 Ivan Maidanski <ivmai@mail.ru> + + * tests/test_malloc.c (LIST_LENGTH, LARGE_OBJ_SIZE): Define to + a smaller value unless HAVE_MMAP. + +2011-09-21 Ivan Maidanski <ivmai@mail.ru> + + * tests/test_malloc.c (cons, run_one_test): Call exit with a non-zero + code (instead of abort) if out of memory. + * tests/test_stack.c (add_elements): Likewise. + * tests/test_stack.c (main): Use a distinct exit code if a thread + creation failed. + +2011-09-15 Ivan Maidanski <ivmai@mail.ru> + + * src/atomic_ops/sysdeps/emul_cas.h: Fix a typo (replace AO_FORCE_CAS + with AO_REQUIRE_CAS in a comment). + +2011-09-08 Ivan Maidanski <ivmai@mail.ru> (really Petter Urkedal) * src/Makefile.am, tests/Makefile.am: Set compiler include paths to $(top_builddir)/src and $(top_srcdir)/src. @@ -606,6 +606,8 @@ LTLIBOBJS LIBOBJS NEED_ASM_FALSE NEED_ASM_TRUE +HAVE_PTHREAD_H_FALSE +HAVE_PTHREAD_H_TRUE THREADDLLIBS PICFLAG EGREP @@ -4728,14 +4730,22 @@ PICFLAG= { $as_echo "$as_me:${as_lineno-$LINENO}: checking Determining PIC compiler flag" >&5 $as_echo_n "checking Determining PIC compiler flag... " >&6; } if test "$GCC" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: -fPIC" >&5 -$as_echo "-fPIC" >&6; } - PICFLAG=-fPIC case "$host" in *-*-solaris*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: -fPIC" >&5 +$as_echo "-fPIC" >&6; } + PICFLAG=-fPIC # Workaround: at least GCC 3.4.6 does not define this macro. CFLAGS="$CFLAGS -D__PIC__=1" ;; + *-*-cygwin* | *-*-mingw*) + # Cygwin and Mingw[-w32/64] do not need -fPIC. + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: -fPIC" >&5 +$as_echo "-fPIC" >&6; } + PICFLAG=-fPIC + ;; esac else case "$host" in @@ -4771,6 +4781,7 @@ CFLAGS="$CFLAGS -DNDEBUG" THREADDLLIBS= +have_pthreads=true ## Libraries needed to support threads. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 $as_echo_n "checking for pthread_self in -lpthread... " >&6; } @@ -4826,9 +4837,21 @@ case "$host" in *-*-cygwin* | *-*-darwin*) THREADDLLIBS= ;; + *-*-mingw*) + THREADDLLIBS= + have_pthreads=false + ;; esac + if test x$have_pthreads = xtrue; then + HAVE_PTHREAD_H_TRUE= + HAVE_PTHREAD_H_FALSE='#' +else + HAVE_PTHREAD_H_TRUE='#' + HAVE_PTHREAD_H_FALSE= +fi + if test x$need_asm = xtrue; then NEED_ASM_TRUE= NEED_ASM_FALSE='#' @@ -4971,6 +4994,10 @@ if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_PTHREAD_H_TRUE}" && test -z "${HAVE_PTHREAD_H_FALSE}"; then + as_fn_error $? "conditional \"HAVE_PTHREAD_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${NEED_ASM_TRUE}" && test -z "${NEED_ASM_FALSE}"; then as_fn_error $? "conditional \"NEED_ASM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 340b676..6ab62b8 100644 --- a/configure.ac +++ b/configure.ac @@ -23,13 +23,20 @@ need_asm=false PICFLAG= AC_MSG_CHECKING(Determining PIC compiler flag) if test "$GCC" = yes; then - AC_MSG_RESULT(-fPIC) - PICFLAG=-fPIC case "$host" in *-*-solaris*) + AC_MSG_RESULT(-fPIC) + PICFLAG=-fPIC # Workaround: at least GCC 3.4.6 does not define this macro. CFLAGS="$CFLAGS -D__PIC__=1" ;; + *-*-cygwin* | *-*-mingw*) + # Cygwin and Mingw[-w32/64] do not need -fPIC. + ;; + *) + AC_MSG_RESULT(-fPIC) + PICFLAG=-fPIC + ;; esac else case "$host" in @@ -61,6 +68,7 @@ AC_SUBST(DEFS) AH_TEMPLATE([_PTHREADS], [Indicates the use of pthreads (NetBSD).]) THREADDLLIBS= +have_pthreads=true ## Libraries needed to support threads. AC_CHECK_LIB(pthread, pthread_self, THREADDLLIBS="-lpthread",,) AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads.]) @@ -74,9 +82,14 @@ case "$host" in *-*-cygwin* | *-*-darwin*) THREADDLLIBS= ;; + *-*-mingw*) + THREADDLLIBS= + have_pthreads=false + ;; esac AC_SUBST(THREADDLLIBS) +AM_CONDITIONAL(HAVE_PTHREAD_H, test x$have_pthreads = xtrue) AM_CONDITIONAL(NEED_ASM, test x$need_asm = xtrue) AC_CONFIG_FILES([Makefile src/Makefile src/atomic_ops/Makefile \ diff --git a/tests/Makefile.am b/tests/Makefile.am index f23a9b6..1753c9f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,18 +8,20 @@ CLEANFILES = list_atomic.i AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src +if HAVE_PTHREAD_H TESTS=test_atomic test_atomic_pthreads test_stack test_malloc +test_atomic_pthreads_SOURCES=$(test_atomic_SOURCES) +test_atomic_pthreads_CPPFLAGS=-DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS) +test_atomic_pthreads_LDADD=$(test_atomic_LDADD) +else +TESTS=test_atomic test_stack test_malloc +endif -#create the test_atomic test program -check_PROGRAMS=test_atomic test_atomic_pthreads test_stack test_malloc +check_PROGRAMS=$(TESTS) test_atomic_SOURCES=test_atomic.c test_atomic_LDADD=$(THREADDLLIBS) ../src/libatomic_ops.a -test_atomic_pthreads_SOURCES=test_atomic.c -test_atomic_pthreads_CPPFLAGS=-DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS) -test_atomic_pthreads_LDADD=$(THREADDLLIBS) ../src/libatomic_ops.a - test_stack_SOURCES=test_stack.c test_stack_LDADD=$(THREADDLLIBS) ../src/libatomic_ops_gpl.a \ ../src/libatomic_ops.a diff --git a/tests/Makefile.in b/tests/Makefile.in index 481f4f4..2538fe5 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -34,10 +34,12 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -TESTS = test_atomic$(EXEEXT) test_atomic_pthreads$(EXEEXT) \ - test_stack$(EXEEXT) test_malloc$(EXEEXT) -check_PROGRAMS = test_atomic$(EXEEXT) test_atomic_pthreads$(EXEEXT) \ - test_stack$(EXEEXT) test_malloc$(EXEEXT) +@HAVE_PTHREAD_H_FALSE@TESTS = test_atomic$(EXEEXT) test_stack$(EXEEXT) \ +@HAVE_PTHREAD_H_FALSE@ test_malloc$(EXEEXT) +@HAVE_PTHREAD_H_TRUE@TESTS = test_atomic$(EXEEXT) \ +@HAVE_PTHREAD_H_TRUE@ test_atomic_pthreads$(EXEEXT) \ +@HAVE_PTHREAD_H_TRUE@ test_stack$(EXEEXT) test_malloc$(EXEEXT) +check_PROGRAMS = $(am__EXEEXT_1) subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -48,16 +50,24 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +@HAVE_PTHREAD_H_FALSE@am__EXEEXT_1 = test_atomic$(EXEEXT) \ +@HAVE_PTHREAD_H_FALSE@ test_stack$(EXEEXT) test_malloc$(EXEEXT) +@HAVE_PTHREAD_H_TRUE@am__EXEEXT_1 = test_atomic$(EXEEXT) \ +@HAVE_PTHREAD_H_TRUE@ test_atomic_pthreads$(EXEEXT) \ +@HAVE_PTHREAD_H_TRUE@ test_stack$(EXEEXT) test_malloc$(EXEEXT) am_test_atomic_OBJECTS = test_atomic.$(OBJEXT) test_atomic_OBJECTS = $(am_test_atomic_OBJECTS) am__DEPENDENCIES_1 = test_atomic_DEPENDENCIES = $(am__DEPENDENCIES_1) \ ../src/libatomic_ops.a -am_test_atomic_pthreads_OBJECTS = \ - test_atomic_pthreads-test_atomic.$(OBJEXT) +am__test_atomic_pthreads_SOURCES_DIST = test_atomic.c +am__objects_1 = test_atomic_pthreads-test_atomic.$(OBJEXT) +@HAVE_PTHREAD_H_TRUE@am_test_atomic_pthreads_OBJECTS = \ +@HAVE_PTHREAD_H_TRUE@ $(am__objects_1) test_atomic_pthreads_OBJECTS = $(am_test_atomic_pthreads_OBJECTS) -test_atomic_pthreads_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - ../src/libatomic_ops.a +am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) ../src/libatomic_ops.a +@HAVE_PTHREAD_H_TRUE@test_atomic_pthreads_DEPENDENCIES = \ +@HAVE_PTHREAD_H_TRUE@ $(am__DEPENDENCIES_2) am_test_malloc_OBJECTS = test_malloc.$(OBJEXT) test_malloc_OBJECTS = $(am_test_malloc_OBJECTS) test_malloc_DEPENDENCIES = $(am__DEPENDENCIES_1) \ @@ -76,7 +86,8 @@ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(test_atomic_SOURCES) $(test_atomic_pthreads_SOURCES) \ $(test_malloc_SOURCES) $(test_stack_SOURCES) -DIST_SOURCES = $(test_atomic_SOURCES) $(test_atomic_pthreads_SOURCES) \ +DIST_SOURCES = $(test_atomic_SOURCES) \ + $(am__test_atomic_pthreads_SOURCES_DIST) \ $(test_malloc_SOURCES) $(test_stack_SOURCES) ETAGS = etags CTAGS = ctags @@ -195,11 +206,11 @@ EXTRA_DIST = test_atomic.template list_atomic.template run_parallel.inc \ BUILT_SOURCES = test_atomic_include.h list_atomic.i CLEANFILES = list_atomic.i AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src +@HAVE_PTHREAD_H_TRUE@test_atomic_pthreads_SOURCES = $(test_atomic_SOURCES) +@HAVE_PTHREAD_H_TRUE@test_atomic_pthreads_CPPFLAGS = -DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS) +@HAVE_PTHREAD_H_TRUE@test_atomic_pthreads_LDADD = $(test_atomic_LDADD) test_atomic_SOURCES = test_atomic.c test_atomic_LDADD = $(THREADDLLIBS) ../src/libatomic_ops.a -test_atomic_pthreads_SOURCES = test_atomic.c -test_atomic_pthreads_CPPFLAGS = -DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS) -test_atomic_pthreads_LDADD = $(THREADDLLIBS) ../src/libatomic_ops.a test_stack_SOURCES = test_stack.c test_stack_LDADD = $(THREADDLLIBS) ../src/libatomic_ops_gpl.a \ ../src/libatomic_ops.a diff --git a/tests/test_atomic_include.h b/tests/test_atomic_include.h index 0297f23..c9970ab 100644 --- a/tests/test_atomic_include.h +++ b/tests/test_atomic_include.h @@ -10,7 +10,7 @@ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: )\n", \ - __FILE__, __LINE__), exit(1); } + __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ @@ -200,7 +200,7 @@ void test_atomic(void) } - + /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * @@ -213,7 +213,7 @@ void test_atomic(void) #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release)\n", \ - __FILE__, __LINE__), exit(1); } + __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ @@ -403,7 +403,7 @@ void test_atomic_release(void) } - + /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * @@ -416,7 +416,7 @@ void test_atomic_release(void) #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire)\n", \ - __FILE__, __LINE__), exit(1); } + __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ @@ -606,7 +606,7 @@ void test_atomic_acquire(void) } - + /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * @@ -619,7 +619,7 @@ void test_atomic_acquire(void) #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _read)\n", \ - __FILE__, __LINE__), exit(1); } + __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ @@ -809,7 +809,7 @@ void test_atomic_read(void) } - + /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * @@ -822,7 +822,7 @@ void test_atomic_read(void) #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _write)\n", \ - __FILE__, __LINE__), exit(1); } + __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ @@ -1012,7 +1012,7 @@ void test_atomic_write(void) } - + /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * @@ -1025,7 +1025,7 @@ void test_atomic_write(void) #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _full)\n", \ - __FILE__, __LINE__), exit(1); } + __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ @@ -1215,7 +1215,7 @@ void test_atomic_full(void) } - + /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * @@ -1228,7 +1228,7 @@ void test_atomic_full(void) #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release_write)\n", \ - __FILE__, __LINE__), exit(1); } + __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ @@ -1418,7 +1418,7 @@ void test_atomic_release_write(void) } - + /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * @@ -1431,7 +1431,7 @@ void test_atomic_release_write(void) #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire_read)\n", \ - __FILE__, __LINE__), exit(1); } + __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ @@ -1619,3 +1619,6 @@ void test_atomic_acquire_read(void) MISSING(AO_compare_and_swap_double); # endif } + + + diff --git a/tests/test_malloc.c b/tests/test_malloc.c index 4bf6e6c..a1f4179 100644 --- a/tests/test_malloc.c +++ b/tests/test_malloc.c @@ -39,11 +39,19 @@ #endif #ifndef LIST_LENGTH -# define LIST_LENGTH 1000 +# ifdef HAVE_MMAP +# define LIST_LENGTH 1000 +# else +# define LIST_LENGTH 100 +# endif #endif #ifndef LARGE_OBJ_SIZE -# define LARGE_OBJ_SIZE 200000 +# ifdef HAVE_MMAP +# define LARGE_OBJ_SIZE 200000 +# else +# define LARGE_OBJ_SIZE 20000 +# endif #endif #ifdef USE_STANDARD_MALLOC @@ -74,7 +82,7 @@ ln *cons(int d, ln *tail) { fprintf(stderr, "Out of memory\n"); /* Normal for more than about 10 threads without mmap? */ - abort(); + exit(2); } result -> data = d; @@ -154,7 +162,7 @@ void * run_one_test(void * arg) { { fprintf(stderr, "Out of memory\n"); /* Normal for more than about 10 threads without mmap? */ - abort(); + exit(2); } q[0] = q[LARGE_OBJ_SIZE/2] = q[LARGE_OBJ_SIZE-1] = 'b'; if (p[0] != 'a' || p[LARGE_OBJ_SIZE/2] != 'a' diff --git a/tests/test_stack.c b/tests/test_stack.c index 9b2e7b2..3a92d12 100644 --- a/tests/test_stack.c +++ b/tests/test_stack.c @@ -68,7 +68,7 @@ void add_elements(int n) if (le == 0) { fprintf(stderr, "Out of memory\n"); - abort(); + exit(2); } le -> data = n; AO_stack_push(&the_list, (AO_t *)le); @@ -203,12 +203,12 @@ int main(int argc, char **argv) ops_performed = 0; start_time = get_msecs(); for (i = 1; i < nthreads; ++i) { - int code; + int code; if ((code = pthread_create(thread+i, 0, run_one_test, (void *)(long)i)) != 0) { fprintf(stderr, "Thread creation failed %u\n", code); - exit(1); + exit(3); } } /* We use the main thread to run one test. This allows gprof */ |