Skip to content

Commit

Permalink
2011-07-26 Ivan Maidanski <[email protected]>
Browse files Browse the repository at this point in the history
	* tests/realloc_test.c: New file.
	* tests/tests.am (TESTS, check_PROGRAMS): Add realloc_test.
	* .cvsignore: Add realloc_test.
	* configure: Regenerate.
	* Makefile.in: Ditto.
  • Loading branch information
ivmai authored and ivmai committed Jul 26, 2011
1 parent 31831b1 commit a63d343
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 10 deletions.
1 change: 1 addition & 0 deletions .cvsignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ initsecondarythread
leaktest
libtool
middletest
realloc_test
setjmp_test
smashtest
staticrootstest
Expand Down
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2011-07-26 Ivan Maidanski <[email protected]>

* tests/realloc_test.c: New file.
* tests/tests.am (TESTS, check_PROGRAMS): Add realloc_test.
* .cvsignore: Add realloc_test.
* configure: Regenerate.
* Makefile.in: Ditto.

2011-07-14 Ivan Maidanski <[email protected]>

* .cvsignore: Add more auto-generated files.
Expand Down
44 changes: 35 additions & 9 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ target_triplet = @target@
@USE_INTERNAL_LIBATOMIC_OPS_TRUE@ -I$(top_srcdir)/libatomic_ops/src

check_PROGRAMS = gctest$(EXEEXT) leaktest$(EXEEXT) middletest$(EXEEXT) \
smashtest$(EXEEXT) hugetest$(EXEEXT) staticrootstest$(EXEEXT) \
$(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3)
smashtest$(EXEEXT) hugetest$(EXEEXT) realloc_test$(EXEEXT) \
staticrootstest$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
$(am__EXEEXT_3)

# C Library: Architecture Dependent
# ---------------------------------
Expand Down Expand Up @@ -237,6 +238,9 @@ leaktest_DEPENDENCIES = $(am__DEPENDENCIES_2)
am_middletest_OBJECTS = middle.$(OBJEXT)
middletest_OBJECTS = $(am_middletest_OBJECTS)
middletest_DEPENDENCIES = $(am__DEPENDENCIES_2)
am_realloc_test_OBJECTS = realloc_test.$(OBJEXT)
realloc_test_OBJECTS = $(am_realloc_test_OBJECTS)
realloc_test_DEPENDENCIES = $(am__DEPENDENCIES_2)
am_smashtest_OBJECTS = smash_test.$(OBJEXT)
smashtest_OBJECTS = $(am_smashtest_OBJECTS)
smashtest_DEPENDENCIES = $(am__DEPENDENCIES_2)
Expand Down Expand Up @@ -300,15 +304,16 @@ SOURCES = $(libcord_la_SOURCES) $(libgc_la_SOURCES) \
$(libgccpp_la_SOURCES) $(libstaticrootslib_la_SOURCES) \
$(gctest_SOURCES) $(hugetest_SOURCES) \
$(initsecondarythread_SOURCES) $(leaktest_SOURCES) \
$(middletest_SOURCES) $(smashtest_SOURCES) \
$(staticrootstest_SOURCES) $(test_cpp_SOURCES) \
$(threadkey_test_SOURCES) $(threadleaktest_SOURCES) \
$(tracetest_SOURCES)
$(middletest_SOURCES) $(realloc_test_SOURCES) \
$(smashtest_SOURCES) $(staticrootstest_SOURCES) \
$(test_cpp_SOURCES) $(threadkey_test_SOURCES) \
$(threadleaktest_SOURCES) $(tracetest_SOURCES)
DIST_SOURCES = $(libcord_la_SOURCES) $(am__libgc_la_SOURCES_DIST) \
$(EXTRA_libgc_la_SOURCES) $(am__libgccpp_la_SOURCES_DIST) \
$(libstaticrootslib_la_SOURCES) $(gctest_SOURCES) \
$(hugetest_SOURCES) $(am__initsecondarythread_SOURCES_DIST) \
$(leaktest_SOURCES) $(middletest_SOURCES) $(smashtest_SOURCES) \
$(leaktest_SOURCES) $(middletest_SOURCES) \
$(realloc_test_SOURCES) $(smashtest_SOURCES) \
$(staticrootstest_SOURCES) $(am__test_cpp_SOURCES_DIST) \
$(am__threadkey_test_SOURCES_DIST) \
$(am__threadleaktest_SOURCES_DIST) \
Expand Down Expand Up @@ -601,8 +606,9 @@ dist_noinst_HEADERS = include/private/gc_hdrs.h \
include/ec.h include/javaxfc.h
check_LTLIBRARIES = libstaticrootslib.la
TESTS = gctest$(EXEEXT) leaktest$(EXEEXT) middletest$(EXEEXT) \
smashtest$(EXEEXT) hugetest$(EXEEXT) staticrootstest$(EXEEXT) \
$(am__append_7) $(am__append_9) $(am__append_11)
smashtest$(EXEEXT) hugetest$(EXEEXT) realloc_test$(EXEEXT) \
staticrootstest$(EXEEXT) $(am__append_7) $(am__append_9) \
$(am__append_11)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = bdw-gc.pc
libgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
Expand Down Expand Up @@ -670,6 +676,8 @@ smashtest_SOURCES = tests/smash_test.c
smashtest_LDADD = $(test_ldadd)
hugetest_SOURCES = tests/huge_test.c
hugetest_LDADD = $(test_ldadd)
realloc_test_SOURCES = tests/realloc_test.c
realloc_test_LDADD = $(test_ldadd)
staticrootstest_SOURCES = tests/staticrootstest.c
staticrootstest_LDADD = $(test_ldadd) libstaticrootslib.la
libstaticrootslib_la_SOURCES = tests/staticrootslib.c
Expand Down Expand Up @@ -857,6 +865,9 @@ leaktest$(EXEEXT): $(leaktest_OBJECTS) $(leaktest_DEPENDENCIES)
middletest$(EXEEXT): $(middletest_OBJECTS) $(middletest_DEPENDENCIES)
@rm -f middletest$(EXEEXT)
$(LINK) $(middletest_OBJECTS) $(middletest_LDADD) $(LIBS)
realloc_test$(EXEEXT): $(realloc_test_OBJECTS) $(realloc_test_DEPENDENCIES)
@rm -f realloc_test$(EXEEXT)
$(LINK) $(realloc_test_OBJECTS) $(realloc_test_LDADD) $(LIBS)
smashtest$(EXEEXT): $(smashtest_OBJECTS) $(smashtest_DEPENDENCIES)
@rm -f smashtest$(EXEEXT)
$(LINK) $(smashtest_OBJECTS) $(smashtest_LDADD) $(LIBS)
Expand Down Expand Up @@ -920,6 +931,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pthread_support.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ptr_chck.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/real_malloc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/realloc_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reclaim.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smash_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc_mach_dep.Plo@am__quote@
Expand Down Expand Up @@ -1090,6 +1102,20 @@ middle.obj: tests/middle.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o middle.obj `if test -f 'tests/middle.c'; then $(CYGPATH_W) 'tests/middle.c'; else $(CYGPATH_W) '$(srcdir)/tests/middle.c'; fi`

realloc_test.o: tests/realloc_test.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT realloc_test.o -MD -MP -MF $(DEPDIR)/realloc_test.Tpo -c -o realloc_test.o `test -f 'tests/realloc_test.c' || echo '$(srcdir)/'`tests/realloc_test.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/realloc_test.Tpo $(DEPDIR)/realloc_test.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tests/realloc_test.c' object='realloc_test.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o realloc_test.o `test -f 'tests/realloc_test.c' || echo '$(srcdir)/'`tests/realloc_test.c

realloc_test.obj: tests/realloc_test.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT realloc_test.obj -MD -MP -MF $(DEPDIR)/realloc_test.Tpo -c -o realloc_test.obj `if test -f 'tests/realloc_test.c'; then $(CYGPATH_W) 'tests/realloc_test.c'; else $(CYGPATH_W) '$(srcdir)/tests/realloc_test.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/realloc_test.Tpo $(DEPDIR)/realloc_test.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tests/realloc_test.c' object='realloc_test.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o realloc_test.obj `if test -f 'tests/realloc_test.c'; then $(CYGPATH_W) 'tests/realloc_test.c'; else $(CYGPATH_W) '$(srcdir)/tests/realloc_test.c'; fi`

smash_test.o: tests/smash_test.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT smash_test.o -MD -MP -MF $(DEPDIR)/smash_test.Tpo -c -o smash_test.o `test -f 'tests/smash_test.c' || echo '$(srcdir)/'`tests/smash_test.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/smash_test.Tpo $(DEPDIR)/smash_test.Po
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac Revision: 1.68 .
# From configure.ac Revision: 1.69 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for gc 7.2alpha7.
#
Expand Down
34 changes: 34 additions & 0 deletions tests/realloc_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

#include <stdio.h>
#include <stdlib.h>
#include "gc.h"

#define COUNT 10000000

int main(void) {
int i;
unsigned long last_heap_size = 0;

GC_INIT();

for (i = 0; i < COUNT; i++) {
int **p = GC_MALLOC(sizeof(int *));
int *q = GC_MALLOC_ATOMIC(sizeof(int));

if (*p != 0) {
fprintf(stderr, "GC_malloc returned garbage\n");
exit(1);
}

*p = GC_REALLOC(q, 2 * sizeof(int));

if (i % 10 == 0) {
unsigned long heap_size = (unsigned long)GC_get_heap_size();
if (heap_size != last_heap_size) {
printf("Heap size: %lu\n", heap_size);
last_heap_size = heap_size;
}
}
}
return 0;
}
5 changes: 5 additions & 0 deletions tests/tests.am
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ check_PROGRAMS += hugetest
hugetest_SOURCES = tests/huge_test.c
hugetest_LDADD = $(test_ldadd)

TESTS += realloc_test$(EXEEXT)
check_PROGRAMS += realloc_test
realloc_test_SOURCES = tests/realloc_test.c
realloc_test_LDADD = $(test_ldadd)

TESTS += staticrootstest$(EXEEXT)
check_PROGRAMS += staticrootstest
staticrootstest_SOURCES = tests/staticrootstest.c
Expand Down

0 comments on commit a63d343

Please sign in to comment.