summaryrefslogtreecommitdiff
path: root/test/malloc
diff options
context:
space:
mode:
Diffstat (limited to 'test/malloc')
-rw-r--r--test/malloc/tst-calloc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/malloc/tst-calloc.c b/test/malloc/tst-calloc.c
index b3594c937..eb0059f68 100644
--- a/test/malloc/tst-calloc.c
+++ b/test/malloc/tst-calloc.c
@@ -18,12 +18,12 @@
02111-1307 USA. */
#include <errno.h>
-#include <error.h>
#include <limits.h>
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>
+static int errors = 0;
/* Number of samples per size. */
#define N 50000
@@ -46,10 +46,11 @@ fixed_test (int size)
for (j = 0; j < size; ++j)
{
- if (ptrs[i][j] != '\0')
- error (EXIT_FAILURE, 0,
- "byte not cleared (size %d, element %d, byte %d)",
+ if (ptrs[i][j] != '\0') {
+ ++errors;
+ printf("byte not cleared (size %d, element %d, byte %d)",
size, i, j);
+ }
ptrs[i][j] = '\xff';
}
}
@@ -79,10 +80,11 @@ random_test (void)
for (j = 0; j < size; ++j)
{
- if (ptrs[i][j] != '\0')
- error (EXIT_FAILURE, 0,
- "byte not cleared (size %d, element %d, byte %d)",
+ if (ptrs[i][j] != '\0') {
+ ++errors;
+ printf("byte not cleared (size %d, element %d, byte %d)",
size, i, j);
+ }
ptrs[i][j] = '\xff';
}
}
@@ -122,5 +124,5 @@ main (void)
null_test ();
- return 0;
+ return errors != 0;
}