gcc/boehm-gc/testsuite/boehm-gc.lib/staticrootstest.c
Rainer Orth 94ea609ab3 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
2011-03-25 17:04:16 +00:00

49 lines
926 B
C

/* { dg-add-shlib "staticrootslib.c" } */
#include <stdio.h>
#ifndef GC_DEBUG
# define GC_DEBUG
#endif
#include "gc.h"
#include "gc_backptr.h"
struct treenode {
struct treenode *x;
struct treenode *y;
} * root[10];
static char *staticroot = 0;
extern struct treenode * libsrl_mktree(int i);
extern void * libsrl_init(void);
extern void * libsrl_collect (void);
int main(void)
{
int i;
staticroot = libsrl_init();
for (i = 0; i < sizeof(struct treenode); ++i) {
staticroot[i] = 0x42;
}
libsrl_collect();
for (i = 0; i < 10; ++i) {
root[i] = libsrl_mktree(12);
libsrl_collect();
}
for (i = 0; i < sizeof(struct treenode); ++i) {
if (staticroot[i] != 0x42)
return -1;
}
for (i = 0; i < 10; ++i) {
root[i] = libsrl_mktree(12);
libsrl_collect();
}
for (i = 0; i < sizeof(struct treenode); ++i) {
if (staticroot[i] != 0x42)
return -1;
}
return 0;
}