summaryrefslogtreecommitdiff
path: root/test/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'test/stdlib')
-rw-r--r--test/stdlib/.cvsignore6
-rw-r--r--test/stdlib/Makefile61
-rw-r--r--test/stdlib/mallocbug.c67
-rw-r--r--test/stdlib/testmalloc.c98
4 files changed, 0 insertions, 232 deletions
diff --git a/test/stdlib/.cvsignore b/test/stdlib/.cvsignore
index 253c81051..a85e224fb 100644
--- a/test/stdlib/.cvsignore
+++ b/test/stdlib/.cvsignore
@@ -1,14 +1,8 @@
-testmalloc
-testmalloc.o
-testmalloc_glibc
-testmalloc_glibc.o
teststrtol
teststrtol_glibc
teststrtol.o
teststrtol.out
teststrtol_glibc.out
-mallocbug
-mallocbug_glibc
qsort
qsort_glibc
qsort.out
diff --git a/test/stdlib/Makefile b/test/stdlib/Makefile
index 209c43b5b..5f2f12b16 100644
--- a/test/stdlib/Makefile
+++ b/test/stdlib/Makefile
@@ -21,8 +21,6 @@ include $(TESTDIR)/Rules.mak
-TARGETS=testmalloc testmalloc_glibc
-TARGETS+=mallocbug mallocbug_glibc
TARGETS+=teststrtol teststrtol_glibc teststrtol_diff
TARGETS+=qsort qsort_glibc qsort_diff
TARGETS+=teston_exit teston_exit_glibc teston_exit_diff
@@ -30,65 +28,6 @@ TARGETS+=testatexit testatexit_glibc testatexit_diff
all: $(TARGETS)
-testmalloc_source:
- -@ echo "-------"
- -@ echo "testmalloc.c source: "
- -@ echo " "
- -@ cat testmalloc.c
- -@ echo " "
-
-testmalloc: testmalloc.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC)
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ls -l $@
- -./$@
- -@ echo " "
-
-testmalloc_glibc: testmalloc.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling vs GNU libc: "
- -@ echo " "
- $(HOST_CC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOST_CC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ls -l $@
- -./$@
- -@ echo " "
-
-mallocbug: mallocbug.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC)
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ls -l $@
- -./$@
- -@ echo " "
-
-mallocbug_glibc: mallocbug.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling vs GNU libc: "
- -@ echo " "
- $(HOST_CC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOST_CC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ls -l $@
- -./$@
- -@ echo " "
-
teststrtol_source:
-@ echo "-------"
-@ echo "teststrtol.c source: "
diff --git a/test/stdlib/mallocbug.c b/test/stdlib/mallocbug.c
deleted file mode 100644
index 84a638795..000000000
--- a/test/stdlib/mallocbug.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Reproduce a GNU malloc bug. */
-#include <malloc.h>
-#include <stdio.h>
-#include <string.h>
-
-#define size_t unsigned int
-
-int
-main (int argc, char *argv[])
-{
- char *dummy0;
- char *dummy1;
- char *fill_info_table1;
- char *over_top;
- size_t over_top_size = 0x3000;
- char *over_top_dup;
- size_t over_top_dup_size = 0x7000;
- char *x;
- size_t i;
-
- /* Here's what memory is supposed to look like (hex):
- size contents
- 3000 original_info_table, later fill_info_table1
- 3fa000 dummy0
- 3fa000 dummy1
- 6000 info_table_2
- 3000 over_top
-
- */
- /* mem: original_info_table */
- dummy0 = malloc (0x3fa000);
- /* mem: original_info_table, dummy0 */
- dummy1 = malloc (0x3fa000);
- /* mem: free, dummy0, dummy1, info_table_2 */
- fill_info_table1 = malloc (0x3000);
- /* mem: fill_info_table1, dummy0, dummy1, info_table_2 */
-
- x = malloc (0x1000);
- free (x);
- /* mem: fill_info_table1, dummy0, dummy1, info_table_2, freexx */
-
- /* This is what loses; info_table_2 and freexx get combined unbeknownst
- to mmalloc, and mmalloc puts over_top in a section of memory which
- is on the free list as part of another block (where info_table_2 had
- been). */
- over_top = malloc (over_top_size);
- over_top_dup = malloc (over_top_dup_size);
- memset (over_top, 0, over_top_size);
- memset (over_top_dup, 1, over_top_dup_size);
-
- for (i = 0; i < over_top_size; ++i)
- if (over_top[i] != 0)
- {
- printf ("FAIL: malloc expands info table\n");
- return 0;
- }
-
- for (i = 0; i < over_top_dup_size; ++i)
- if (over_top_dup[i] != 1)
- {
- printf ("FAIL: malloc expands info table\n");
- return 0;
- }
-
- printf ("PASS: malloc expands info table\n");
- return 0;
-}
diff --git a/test/stdlib/testmalloc.c b/test/stdlib/testmalloc.c
deleted file mode 100644
index 158bf4236..000000000
--- a/test/stdlib/testmalloc.c
+++ /dev/null
@@ -1,98 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-struct list {
- struct list *next;
-};
-
-int main(void)
-{
- int z=999;
- int *y=&z;
- int *x=NULL;
- struct list *save;
- struct list *lp;
- int i;
-
-
- printf("pointer to x is %p\n", x);
- printf("pointer to y is %p\n", y);
- x=malloc(sizeof(int)*2000);
- printf("pointer to x is %p\n", x);
- y=malloc(sizeof(int)*100);
- printf("pointer to y is %p\n", y);
- free(x);
- free(y);
- printf("about to free(0)\n");
- free(0);
-
- x=malloc(13);
- printf("x = %p\n", x);
- memcpy(x, "Small string", 13);
- printf("0x%p test string1: %s\n", x, (char *)x);
- y = realloc(x, 36);
- printf("0x%p test string1: %s\n", y, (char *)y);
- memcpy(y, "********** Larger string **********", 36);
- printf("0x%p test string2: %s\n", y, (char *)y);
- free(y);
-
-
- printf("Allocate 100 nodes 500 bytes each\n");
- save = 0;
- for (i=0; i<100; i++) {
- lp = malloc(500);
- if (lp == 0) {
- printf("loop 1: malloc returned 0\n");
- goto Failed;
- }
- lp->next = save;
- save = lp;
- }
-
- printf("freeing 100 nodes\n");
- while (save) {
- lp = save;
- save = save->next;
- free(lp);
- }
-
- printf("try realloc 100 times \n");
- lp = 0;
- for (i=1; i<=100; i++) {
- lp = realloc(lp, i*200);
- if (lp == 0) {
- printf("loop 3: realloc returned 0\n");
- goto Failed;
- }
- }
- realloc(lp, 0);
-
- printf("Allocate another 100 nodes 600 bytes each\n");
- save = 0;
- for (i=0; i<100; i++) {
- lp = malloc(600);
- if (lp == 0) {
- printf("loop 2: malloc returned 0\n");
- goto Failed;
- }
- lp->next = save;
- save = lp;
- }
-
- printf("freeing 100 nodes\n");
- while (save) {
- lp = save;
- save = save->next;
- free(lp);
- }
-
-
- printf("alloc test PASSED\n");
- exit(0);
-
-Failed:
- printf("!!!!!!!!!!!! alloc test FAILED. !!!!!!!!!!!!!!!\n");
- exit(1);
-}