summaryrefslogtreecommitdiff
path: root/test/malloc/mallocbug.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-10-28 20:29:21 +0200
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-10-28 20:31:55 +0200
commit99ef2719fb3d703fe38c4113cd7f5adec516dd3a (patch)
tree2c1f77cb41b60ccbf8faa77a3640491a3546b546 /test/malloc/mallocbug.c
parent543308f6c46cf2edf8a524bc9c631e472570fe72 (diff)
test: remove test suite
The test suite is now a developed in a separate git repository. See here: http://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng-test.git The test suite should be just like every other software compiled with the cross-toolchain. In the past strange problems where found when the test suite got build in the toolchain creation step.
Diffstat (limited to 'test/malloc/mallocbug.c')
-rw-r--r--test/malloc/mallocbug.c67
1 files changed, 0 insertions, 67 deletions
diff --git a/test/malloc/mallocbug.c b/test/malloc/mallocbug.c
deleted file mode 100644
index 84a638795..000000000
--- a/test/malloc/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;
-}