Commit 94ea609a by Rainer Orth

re PR boehm-gc/11412 (boehm-gc testing problems)

	PR boehm-gc/11412
	* configure.ac (THREADCFLAGS): New variable.
	Use it instead of INCLUDES, AM_CPPFLAGS.
	<*-*-kfreebsd*-gnu> (THREADDLLIBS): Rename to THREADLIBS.
	Remove DG/UX support.
	(AC_CONFIG_FILES): Add testsuite/Makefile.
	* Makefile.am (AUTOMAKE_OPTIONS): Use foreign instead of cygnus.
	(SUBDIRS): Add testsuite.
	(libgcjgc_la_LIBADD): Remove $(UNWINDLIBS).
	(AM_CXXFLAGS): Add $(THREADCFLAGS).
	(AM_CFLAGS): Likewise.
	Remove TESTS related variables.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.am: New file.
	* testsuite/Makefile.in: New file.
	* testsuite/lib/boehm-gc.exp: New file.
	* testsuite/config/default.exp: New file.
	* testsuite/boehm-gc.c/c.exp: New file.
	* testsuite/boehm-gc.lib/lib.exp: New file.
	* tests/test.c: Move ...
	* testsuite/boehm-gc.c/gctest.c: ... here.
	* tests/leak_test.c, tests/middle.c, tests/thread_leak_test.c,
	tests/trace_test.c: Move ...
	* testsuite/boehm-gc.c: ... here.
	* testsuite/boehm-gc.c/trace_test.c: Skip everywhere.
	* tests/staticrootslib.c, tests/staticrootstest.c: Move ...
	* testsuite/boehm-gc.lib: ... here.
	* testsuite/boehm-gc.lib/staticrootstest.c: Use dg-add-shlib
	staticrootslib.c.
	* tests/test_cpp.cc: Move ...
	* testsuite/boehm-gc.c++: ... here.

From-SVN: r171514
parent 6c4e2997
......@@ -4,10 +4,10 @@
## files that should be in the distribution are not mentioned in this
## Makefile.am.
AUTOMAKE_OPTIONS = cygnus subdir-objects
AUTOMAKE_OPTIONS = foreign subdir-objects
ACLOCAL_AMFLAGS = -I .. -I ../config
SUBDIRS = include
SUBDIRS = include testsuite
noinst_LTLIBRARIES = libgcjgc.la libgcjgc_convenience.la
......@@ -35,7 +35,7 @@ sparc_sunos4_mach_dep.s ia64_save_regs_in_stack.s
# Include THREADLIBS here to ensure that the correct versions of
# linuxthread semaphore functions get linked:
libgcjgc_la_LIBADD = $(addobjs) $(THREADLIBS) $(UNWINDLIBS)
libgcjgc_la_LIBADD = $(addobjs) $(THREADLIBS)
libgcjgc_la_DEPENDENCIES = $(addobjs)
libgcjgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:2:0 -rpath $(toolexeclibdir)
libgcjgc_la_LINK = $(LINK) $(libgcjgc_la_LDFLAGS)
......@@ -43,48 +43,11 @@ libgcjgc_la_LINK = $(LINK) $(libgcjgc_la_LDFLAGS)
libgcjgc_convenience_la_LIBADD = $(addobjs)
libgcjgc_convenience_la_DEPENDENCIES = $(addobjs)
AM_CXXFLAGS = $(GC_CFLAGS)
AM_CFLAGS = $(GC_CFLAGS)
AM_CXXFLAGS = $(GC_CFLAGS) $(THREADCFLAGS)
AM_CFLAGS = $(GC_CFLAGS) $(THREADCFLAGS)
AM_LDFLAGS = $(shell $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
override CFLAGS := $(filter-out $(O0_CFLAGS), $(CFLAGS)) $(O0_CFLAGS)
test_ldadd = libgcjgc.la $(THREADLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
check_PROGRAMS = gctest
gctest_SOURCES = tests/test.c
gctest_LDADD = $(test_ldadd)
gctest_LDFLAGS = -shared-libgcc
gctest_LINK = $(LINK) $(gctest_LDFLAGS)
TESTS_ENVIRONMENT = LD_LIBRARY_PATH=../../$(MULTIBUILDTOP)gcc
TESTS = gctest
TESTS += leaktest$(EXEEXT)
check_PROGRAMS += leaktest
leaktest_SOURCES = tests/leak_test.c
leaktest_LDADD = $(test_ldadd)
leaktest_LDFLAGS = -shared-libgcc
leaktest_LINK = $(LINK) $(leaktest_LDFLAGS)
TESTS += middletest$(EXEEXT)
check_PROGRAMS += middletest
middletest_SOURCES = tests/middle.c
middletest_LDADD = $(test_ldadd)
middletest_LDFLAGS = -shared-libgcc
middletest_LINK = $(LINK) $(middletest_LDFLAGS)
TESTS += staticrootstest$(EXEEXT)
check_PROGRAMS += staticrootstest
staticrootstest_SOURCES = tests/staticrootstest.c
staticrootstest_LDADD = $(test_ldadd) libstaticrootslib.la
staticrootstest_LDFLAGS = -shared-libgcc
staticrootstest_LINK = $(LINK) $(staticrootstest_LDFLAGS)
check_LTLIBRARIES = libstaticrootslib.la
libstaticrootslib_la_SOURCES = tests/staticrootslib.c
libstaticrootslib_la_LIBADD = libgcjgc_convenience.la
libstaticrootslib_la_LDFLAGS = -version-info 1:2:0 -no-undefined \
-rpath /nowhere -shared-libgcc
libstaticrootslib_la_DEPENDENCIES = libgcjgc_convenience.la
## FIXME: we shouldn't have to do this, but automake forces us to.
.s.lo:
## We use -Wp,-P to strip #line directives. Irix `as' chokes on
......
......@@ -618,6 +618,7 @@ extra_ldflags_libgc
POWERPC_DARWIN_FALSE
POWERPC_DARWIN_TRUE
THREADLIBS
THREADCFLAGS
CXXCPP
CPP
OTOOL64
......@@ -1943,93 +1944,6 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
} # ac_fn_c_check_member
# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
# the include files in INCLUDES and setting the cache variable VAR
# accordingly.
ac_fn_c_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
else
# Is the header compilable?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
$as_echo_n "checking $2 usability... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_header_compiler=yes
else
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
# Is the header present?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
$as_echo_n "checking $2 presence... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <$2>
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
ac_header_preproc=yes
else
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
yes:no: )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
no:yes:* )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
} # ac_fn_c_check_header_mongrel
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
......@@ -11390,7 +11304,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11393 "configure"
#line 11307 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -11496,7 +11410,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11499 "configure"
#line 11413 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -14792,6 +14706,7 @@ fi
AM_CPPFLAGS="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
THREADCFLAGS=
THREADLIBS=
case "$THREADS" in
no | none | single)
......@@ -14855,11 +14770,11 @@ $as_echo "#define _REENTRANT 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&5
$as_echo "$as_me: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&2;}
;;
*-*-kfreebsd*-gnu)
*-*-kfreebsd*-gnu)
$as_echo "#define GC_FREEBSD_THREADS 1" >>confdefs.h
INCLUDES="$INCLUDES -pthread"
THREADDLLIBS=-pthread
THREADCFLAGS=-pthread
THREADLIBS=-pthread
$as_echo "#define _REENTRANT 1" >>confdefs.h
if test "${enable_parallel_mark}" = yes; then
......@@ -14871,14 +14786,14 @@ $as_echo "$as_me: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&2;}
$as_echo "#define USE_COMPILER_TLS 1" >>confdefs.h
;;
;;
*-*-freebsd*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"FreeBSD does not yet fully support threads with Boehm GC.\"" >&5
$as_echo "$as_me: WARNING: \"FreeBSD does not yet fully support threads with Boehm GC.\"" >&2;}
$as_echo "#define GC_FREEBSD_THREADS 1" >>confdefs.h
AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
THREADCFLAGS=-pthread
THREADLIBS=-pthread
;;
*-*-solaris2.8*)
......@@ -14935,7 +14850,7 @@ $as_echo "#define GC_OSF1_THREADS 1" >>confdefs.h
# May want to enable it in other cases, too.
# Measurements havent yet been done.
fi
AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
THREADCFLAGS=-pthread
THREADLIBS="-lpthread -lrt"
;;
esac
......@@ -14944,27 +14859,6 @@ $as_echo "#define GC_OSF1_THREADS 1" >>confdefs.h
$as_echo "#define GC_WIN32_THREADS 1" >>confdefs.h
;;
dgux386)
THREADS=dgux386
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $THREADLIBS" >&5
$as_echo "$THREADLIBS" >&6; }
# Use pthread GCC switch
THREADLIBS=-pthread
if test "${enable_parallel_mark}" = yes; then
$as_echo "#define PARALLEL_MARK 1" >>confdefs.h
fi
$as_echo "#define THREAD_LOCAL_ALLOC 1" >>confdefs.h
$as_echo "#define GC_DGUX386_THREADS 1" >>confdefs.h
$as_echo "#define DGUX_THREADS 1" >>confdefs.h
# Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
;;
aix)
THREADS=posix
THREADLIBS=-lpthread
......@@ -14982,6 +14876,7 @@ $as_echo "#define DGUX_THREADS 1" >>confdefs.h
esac
case "$host" in
powerpc-*-darwin*)
powerpc_darwin=true
......@@ -15322,29 +15217,6 @@ addobjs="$addobjs $machdep"
#
# Check for AViiON Machines running DGUX
#
ac_is_dgux=no
ac_fn_c_check_header_mongrel "$LINENO" "sys/dg_sys_info.h" "ac_cv_header_sys_dg_sys_info_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_dg_sys_info_h" = x""yes; then :
ac_is_dgux=yes
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if host is AViiON running DGUX" >&5
$as_echo_n "checking if host is AViiON running DGUX... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_is_dgux" >&5
$as_echo "$ac_is_dgux" >&6; }
## :GOTCHA: we do not check anything but sys/dg_sys_info.h
if test $ac_is_dgux = yes; then
if test "$enable_full_debug" = "yes"; then
GC_CFLAGS="$GC_CFLAGS -mstandard"
fi
GC_CFLAGS="$GC_CFLAGS -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GCC optimization should be disabled" >&5
$as_echo_n "checking whether GCC optimization should be disabled... " >&6; }
O0_CFLAGS=
......@@ -15407,10 +15279,6 @@ $as_echo "$as_me: WARNING: \"Client must not use -fomit-frame-pointer.\"" >&2;}
$as_echo "#define SAVE_CALL_COUNT 8" >>confdefs.h
;;
i345686-*-dgux*)
$as_echo "#define MAKE_BACK_GRAPH 1" >>confdefs.h
;;
esac
fi
fi
......@@ -15447,7 +15315,7 @@ fi
ac_config_headers="$ac_config_headers include/gc_config.h include/gc_ext_config.h"
ac_config_files="$ac_config_files Makefile include/Makefile threads.mk"
ac_config_files="$ac_config_files Makefile include/Makefile testsuite/Makefile threads.mk"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
......@@ -16552,6 +16420,7 @@ do
"include/gc_ext_config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/gc_ext_config.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
"testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
"threads.mk") CONFIG_FILES="$CONFIG_FILES threads.mk" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
......
......@@ -123,6 +123,7 @@ AC_ARG_ENABLE(parallel-mark,
)
AM_CPPFLAGS="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
THREADCFLAGS=
THREADLIBS=
case "$THREADS" in
no | none | single)
......@@ -163,21 +164,21 @@ case "$THREADS" in
*-*-hpux10*)
AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
;;
*-*-kfreebsd*-gnu)
*-*-kfreebsd*-gnu)
AC_DEFINE(GC_FREEBSD_THREADS)
INCLUDES="$INCLUDES -pthread"
THREADDLLIBS=-pthread
THREADCFLAGS=-pthread
THREADLIBS=-pthread
AC_DEFINE(_REENTRANT)
if test "${enable_parallel_mark}" = yes; then
AC_DEFINE(PARALLEL_MARK)
fi
AC_DEFINE(THREAD_LOCAL_ALLOC)
AC_DEFINE(USE_COMPILER_TLS, 1,[use tls for boehm])
;;
;;
*-*-freebsd*)
AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
AC_DEFINE(GC_FREEBSD_THREADS,1,[support FreeBSD threads])
AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
THREADCFLAGS=-pthread
THREADLIBS=-pthread
;;
*-*-solaris2.8*)
......@@ -218,7 +219,7 @@ case "$THREADS" in
# May want to enable it in other cases, too.
# Measurements havent yet been done.
fi
AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
THREADCFLAGS=-pthread
THREADLIBS="-lpthread -lrt"
;;
esac
......@@ -228,20 +229,6 @@ case "$THREADS" in
dnl Old wine getenv may not return NULL for missing entry.
dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
;;
dgux386)
THREADS=dgux386
AC_MSG_RESULT($THREADLIBS)
# Use pthread GCC switch
THREADLIBS=-pthread
if test "${enable_parallel_mark}" = yes; then
AC_DEFINE(PARALLEL_MARK,1)
fi
AC_DEFINE(THREAD_LOCAL_ALLOC,1)
AC_DEFINE(GC_DGUX386_THREADS,1,[support for DB/UX on I386 threads])
AC_DEFINE(DGUX_THREADS,1,[No description])
# Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
;;
aix)
THREADS=posix
THREADLIBS=-lpthread
......@@ -255,6 +242,7 @@ AC_MSG_RESULT($THREADLIBS)
AC_MSG_ERROR($THREADS is an unknown thread package)
;;
esac
AC_SUBST(THREADCFLAGS)
AC_SUBST(THREADLIBS)
case "$host" in
......@@ -455,22 +443,6 @@ AC_SUBST(addincludes)
AC_SUBST(addlibs)
AC_SUBST(addtests)
#
# Check for AViiON Machines running DGUX
#
ac_is_dgux=no
AC_CHECK_HEADER(sys/dg_sys_info.h, [ac_is_dgux=yes])
AC_MSG_CHECKING(if host is AViiON running DGUX)
AC_MSG_RESULT($ac_is_dgux)
## :GOTCHA: we do not check anything but sys/dg_sys_info.h
if test $ac_is_dgux = yes; then
if test "$enable_full_debug" = "yes"; then
GC_CFLAGS="$GC_CFLAGS -mstandard"
fi
GC_CFLAGS="$GC_CFLAGS -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend"
fi
dnl As of 4.13a2, the collector will not properly work on Solaris when
dnl built with gcc and -O. So we remove -O in the appropriate case.
dnl Not needed anymore on Solaris.
......@@ -513,9 +485,6 @@ AC_ARG_ENABLE(gc-debug,
AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
AC_DEFINE(SAVE_CALL_COUNT, 8, [number of call frames saved with objects allocated through the debugging interface])
;;
i[3456]86-*-dgux*)
AC_DEFINE(MAKE_BACK_GRAPH,1)
;;
esac
fi])
......@@ -547,5 +516,5 @@ fi
AC_CONFIG_HEADERS([include/gc_config.h include/gc_ext_config.h])
AC_CONFIG_FILES(Makefile include/Makefile threads.mk)
AC_CONFIG_FILES(Makefile include/Makefile testsuite/Makefile threads.mk)
AC_OUTPUT
......@@ -130,6 +130,7 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
THREADCFLAGS = @THREADCFLAGS@
THREADLIBS = @THREADLIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
......
## Process this file with automake to produce Makefile.in.
AUTOMAKE_OPTIONS = foreign dejagnu
EXPECT = expect
# Override default.
DEJATOOL = boehm-gc
CLEANFILES = *.exe core* *.log *.sum
# We need more things in site.exp, but automake completely controls the
# creation of that file; there's no way to append to it without messing up
# the dependancy chains. So we overrule automake. This rule is exactly
# what it would have generated, plus our own additions.
site.exp: Makefile
@echo 'Making a new site.exp file...'
@echo '## these variables are automatically generated by make ##' >site.tmp
@echo '# Do not edit here. If you wish to override these values' >>site.tmp
@echo '# edit the last section' >>site.tmp
@echo 'set srcdir $(srcdir)' >>site.tmp
@echo "set objdir `pwd`" >>site.tmp
@echo 'set build_alias "$(build_alias)"' >>site.tmp
@echo 'set build_triplet $(build_triplet)' >>site.tmp
@echo 'set host_alias "$(host_alias)"' >>site.tmp
@echo 'set host_triplet $(host_triplet)' >>site.tmp
@echo 'set target_alias "$(target_alias)"' >>site.tmp
@echo 'set target_triplet $(target_triplet)' >>site.tmp
@echo 'set threadcflags "$(THREADCFLAGS)"' >>site.tmp
@echo 'set threadlibs "$(THREADLIBS)"' >>site.tmp
@echo 'set extra_test_libs "$(EXTRA_TEST_LIBS)"' >>site.tmp
@echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
@test ! -f site.exp || \
sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
@-rm -f site.bak
@test ! -f site.exp || mv site.exp site.bak
@mv site.tmp site.exp
# Copyright (C) 2011 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
dg-init
boehm-gc-init
boehm-gc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "-O2" ""
dg-finish
/* { dg-skip-if "requires --enable-gc-debug" *-*-* } */
#include <stdio.h>
#define GC_DEBUG
#include "gc.h"
......
# Copyright (C) 2011 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
dg-init
boehm-gc-init
# Gather list of tests, skipping library source files.
set tests [lsort [glob -nocomplain $srcdir/$subdir/*.c]]
set tests [prune $tests $srcdir/$subdir/*lib.c]
boehm-gc-dg-runtest $tests "-O2" ""
dg-finish
/* { dg-add-shlib "staticrootslib.c" } */
#include <stdio.h>
#ifndef GC_DEBUG
......
# Copyright (C) 2011 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
proc load_gcc_lib { filename } {
global srcdir loaded_libs
load_file $srcdir/../../gcc/testsuite/lib/$filename
set loaded_libs($filename) ""
}
load_lib dg.exp
load_gcc_lib target-libpath.exp
load_gcc_lib wrapper.exp
# Required by target-supports-dg.exp.
load_gcc_lib target-supports.exp
# For dg-skip-if.
load_gcc_lib target-supports-dg.exp
# For ${tool}_exit.
load_gcc_lib gcc-defs.exp
# For prune_gcc_output.
load_gcc_lib prune.exp
set dg-do-what-default run
# Define boehm-gc callbacks for dg.exp.
# FIXME: The next two are independent of boehm-gc; move to some library.
proc ${tool}-dg-test-1 { target_compile prog do_what extra_tool_flags } {
# Set up the compiler flags, based on what we're going to do.
set options [list]
switch $do_what {
"compile" {
set compile_type "assembly"
set output_file "[file rootname [file tail $prog]].s"
}
"assemble" {
set compile_type "object"
set output_file "[file rootname [file tail $prog]].o"
}
"ltassemble" {
# Needs to be different from assemble since we cannot determine
# from $prog whether to produce a regular or a libtool object.
set compile_type "object"
set output_file "[file rootname [file tail $prog]].lo"
}
"link" {
set compile_type "executable"
# Don't add .exe extension, libtool may strip if from output file.
set output_file "[file rootname [file tail $prog]]"
# If we're linking a libtool object, produce a libtool library.
if { [file extension $prog] == ".lo" } {
set output_file "lib$output_file.la"
}
}
"run" {
set compile_type "executable"
# FIXME: "./" is to cope with "." not being in $PATH.
# Should this be handled elsewhere?
# YES.
set output_file "./[file rootname [file tail $prog]]"
# This is the only place where we care if an executable was
# created or not. If it was, dg.exp will try to run it.
remote_file build delete $output_file
}
default {
perror "$do_what: not a valid dg-do keyword"
return ""
}
}
if { $extra_tool_flags != "" } {
lappend options "additional_flags=$extra_tool_flags"
}
set comp_output [$target_compile "$prog" "$output_file" "$compile_type" $options];
return [list $comp_output $output_file]
}
proc ${tool}-dg-test { prog do_what extra_tool_flags } {
global tool
return [${tool}-dg-test-1 ${tool}_target_compile $prog $do_what $extra_tool_flags]
}
proc boehm-gc-init { args } {
global gluefile wrap_flags
global srcdir
global blddirgc
global TOOL_EXECUTABLE
global GCC_UNDER_TEST
global objdir
global gc_include
global gc_lib
global gc_lib_conv
global tool
global tool_root_dir
global ld_library_path
set blddirgc [lookfor_file [get_multilibs] ${tool}]
verbose "blddirgc: $blddirgc"
if ![info exists GCC_UNDER_TEST] then {
if [info exists TOOL_EXECUTABLE] {
set GCC_UNDER_TEST $TOOL_EXECUTABLE
} else {
set GCC_UNDER_TEST "[find_gcc]"
}
}
set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
if {$gccdir != ""} {
set gccdir [file dirname $gccdir]
}
verbose "gccdir: $gccdir"
set ld_library_path "."
append ld_library_path ":${gccdir}"
set compiler "${gccdir}/xgcc"
if { [is_remote host] == 0 && [which $compiler] != 0 } {
foreach i "[exec $compiler --print-multi-lib]" {
set mldir ""
regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
set mldir [string trimright $mldir "\;@"]
if { "$mldir" == "." } {
continue
}
if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
append ld_library_path ":${gccdir}/${mldir}"
}
}
}
# Add the library path for boehm-gc.
append ld_library_path ":${blddirgc}/.libs"
# Add the library path for boehm-gc.lib libtool libraries.
append ld_library_path ":.libs"
verbose "ld_library_path: $ld_library_path"
# Point to the headers in boehm-gc.
set gc_include "${blddirgc}/include"
verbose "gc_include: $gc_include"
set gc_lib "${blddirgc}/libgcjgc.la"
verbose "gc_lib: $gc_lib"
set gc_lib_conv "${blddirgc}/libgcjgc_convenience.la"
verbose "gc_lib_conv: $gc_lib_conv"
set_ld_library_path_env_vars
boehm-gc_maybe_build_wrapper "${objdir}/testglue.o"
}
proc boehm-gc_target_compile { source dest type options } {
global gluefile wrap_flags;
global srcdir
global TOOL_OPTIONS
global GCC_UNDER_TEST
global libtool
global gc_include
global gc_lib
global gc_lib_conv
global threadcflags
global threadlibs
global extra_test_libs
if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
lappend options "libs=${gluefile}"
lappend options "ldflags=$wrap_flags"
}
# TOOL_OPTIONS must come first, so that it doesn't override testcase
# specific options.
if [info exists TOOL_OPTIONS] {
lappend options [concat "additional_flags=$TOOL_OPTIONS" $options];
}
# Map type to libtool mode.
switch $type {
"object" {
set mode "compile"
}
"executable" {
set mode "link"
}
default {
perror "$type: unhandled type"
return ""
}
}
# Set this once for reuse in boehm-gc.lib/lib.exp.
set libtool "../libtool"
# We have to run silently to avoid DejaGnu lossage.
lappend options "compiler=$libtool --silent --tag=CC --mode=$mode \
$GCC_UNDER_TEST"
lappend options "additional_flags=-I${gc_include} -I${srcdir}/../include"
lappend options "additional_flags=${threadcflags}"
lappend options "libs=-Wc,-shared-libgcc"
if { [file extension $dest] == ".la" } {
lappend options "libs=${gc_lib_conv}"
} else {
lappend options "libs=${gc_lib}"
}
lappend options "libs=${threadlibs} ${extra_test_libs}"
verbose "options: $options"
return [target_compile $source $dest $type $options]
}
# Prune harmless messages.
proc boehm-gc-dg-prune { system text } {
# Prune the same messages as the gcc testsuite does.
set text [prune_gcc_output $text]
# Ignore harmless Darwin ranlib warnings.
regsub -all "(^|\n)(ranlib: file: \[^\n\]* has no symbols\n?)+" $text "\\1" text
return $text
}
# Build shared library from LIB.
proc boehm-gc-build-shlib { lib flags extra-flags } {
global subdir
global dg-do-what-default
global libtool
global gc_lib_conv
# Determine basename.
set basename "[file rootname [file tail $lib]]"
verbose "basename: $basename"
# DejaGnu 1.4.4 doesn't support nested calls to dg-test. Restore
# original state before calling it again.
if { [info procs dg-save-unknown] != [list] } {
rename unknown ""
rename dg-save-unknown unknown
}
set saved-dg-do-what ${dg-do-what-default}
# Compile $lib into libtool object.
set dg-do-what-default ltassemble
dg-test -keep-output $lib $flags ${extra-flags}
# FIXME: Explain options.
set shopt "-version-info 1:2:0 -no-undefined -rpath /nowhere"
# There's no way to get output_file out of dg-test, only
# ${tool}-dg-test returns it, so hardcode that here.
set dg-do-what-default link
dg-test -keep-output $basename.lo $flags "${extra-flags} $shopt"
set dg-do-what-default ${saved-dg-do-what}
# Restore unknown, dg-save-unknown as DejaGnu 1.4.4 dg-test expects them.
if { [info procs dg-save-unknown] == [list] } {
rename unknown dg-save-unknown
proc unknown {} {
}
}
remote_exec host $libtool "--mode=clean rm -f $basename.lo"
return lib$basename.la
}
# Handle dg-add-shlib.
proc dg-add-shlib { args } {
global tool
global srcdir subdir
global shlib
if { [llength $args] > 2 } {
error "[lindex $args 0]: too many arguments"
return
}
set lib [lindex $args 1]
set lib "$srcdir/$subdir/$lib"
verbose -log "dg-add-shlib $lib"
upvar tool_flags flags
upvar default_extra_tool_flags extra-flags
# Build support library.
set shlib [boehm-gc-build-shlib $lib $flags ${extra-flags}]
uplevel lappend tool_flags $shlib
}
# Run boehm-gc testcases.
proc boehm-gc-dg-runtest { testcases flags extra-flags } {
global runtests
global libtool
global shlib
set shlib ""
foreach testcase $testcases {
# If we're only testing specific files and this isn't one of them,
# skip it.
if ![runtest_file_p $runtests $testcase] {
return
}
# Run testcase.
# Keep output, otherwise libtool below won't remove the corresponding
# file in .libs.
dg-test -keep-output $testcase $flags ${extra-flags}
# Remove $execname and eventually $shlib.
remote_exec host $libtool "--mode=clean rm -f \
[file rootname [file tail $testcase]] $shlib"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment