summaryrefslogtreecommitdiff
path: root/test/malloc/malloc.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/malloc.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/malloc.c')
-rw-r--r--test/malloc/malloc.c81
1 files changed, 0 insertions, 81 deletions
diff --git a/test/malloc/malloc.c b/test/malloc/malloc.c
deleted file mode 100644
index ca7c5f927..000000000
--- a/test/malloc/malloc.c
+++ /dev/null
@@ -1,81 +0,0 @@
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#define N_PTRS 1000
-#define N_ALLOCS 10000
-#define MAX_SIZE 0x10000
-
-#define random_size() (random()%MAX_SIZE)
-#define random_ptr() (random()%N_PTRS)
-
-int test1(void);
-int test2(void);
-
-int main(int argc, char *argv[])
-{
- return test1() + test2();
-}
-
-int test1(void)
-{
- void **ptrs;
- int i,j;
- int size;
- int ret = 0;
-
- srandom(0x19730929);
-
- ptrs = malloc(N_PTRS*sizeof(void *));
-
- for(i=0; i<N_PTRS; i++){
- if ((ptrs[i] = malloc(random_size())) == NULL) {
- printf("malloc random failed! %i\n", i);
- ++ret;
- }
- }
- for(i=0; i<N_ALLOCS; i++){
- j = random_ptr();
- free(ptrs[j]);
-
- size = random_size();
- ptrs[j] = malloc(size);
- if (!ptrs[j]) {
- printf("malloc failed! %d\n", i);
- ++ret;
- }
- memset(ptrs[j],0,size);
- }
- for(i=0; i<N_PTRS; i++){
- free(ptrs[i]);
- }
-
- return ret;
-}
-
-int test2(void)
-{
- void *ptr = NULL;
- int ret = 0;
-
- ptr = realloc(ptr,100);
- if (!ptr) {
- printf("couldn't realloc() a NULL pointer\n");
- ++ret;
- } else {
- free(ptr);
- }
-
- ptr = malloc(100);
- ptr = realloc(ptr, 0);
- if (ptr) {
- printf("realloc(,0) failed\n");
- ++ret;
- free(ptr);
- }
-
- return ret;
-}
-