summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2006-03-17 02:43:51 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2006-03-17 02:43:51 +0000
commit18811a88f74a8a0d2d54e275cd632b47817458a1 (patch)
tree266c2f82c8e6b2bee3fb1080bd503b374605c42f
parentdb8fa9bb9aee56bf3bfd83a5825a6b9051d9ac0d (diff)
Fix tests to work if MALLOC_GLIBC_COMPAT is enabled.
-rw-r--r--test/malloc/malloc.c4
-rw-r--r--test/malloc/tst-malloc.c15
-rw-r--r--test/malloc/tst-mcheck.c8
3 files changed, 27 insertions, 0 deletions
diff --git a/test/malloc/malloc.c b/test/malloc/malloc.c
index d63856845..b35e329c0 100644
--- a/test/malloc/malloc.c
+++ b/test/malloc/malloc.c
@@ -70,7 +70,11 @@ int test2(void)
ptr = malloc(100);
ptr = realloc(ptr, 0);
+#ifdef __MALLOC_GLIBC_COMPAT__
+ if (!ptr) {
+#else
if (ptr) {
+#endif
printf("realloc(,0) failed\n");
++ret;
free(ptr);
diff --git a/test/malloc/tst-malloc.c b/test/malloc/tst-malloc.c
index 468e1d4ba..95d8a6c50 100644
--- a/test/malloc/tst-malloc.c
+++ b/test/malloc/tst-malloc.c
@@ -54,9 +54,16 @@ main (void)
/* realloc (p, 0) == free (p). */
p = realloc (p, 0);
+#ifdef __MALLOC_GLIBC_COMPAT__
+ if (!p)
+#else
if (p != NULL)
+#endif
merror ("realloc (p, 0) failed.");
+#ifdef __MALLOC_GLIBC_COMPAT__
+ free (p);
+#endif
p = malloc (0);
#if !defined(__UCLIBC__) || defined(__MALLOC_GLIBC_COMPAT__)
if (p == NULL)
@@ -66,8 +73,16 @@ main (void)
merror ("malloc (0) failed.");
p = realloc (p, 0);
+#ifdef __MALLOC_GLIBC_COMPAT__
+ if (!p)
+#else
if (p != NULL)
+#endif
merror ("realloc (p, 0) failed.");
+#ifdef __MALLOC_GLIBC_COMPAT__
+ free (p);
+#endif
+
return errors != 0;
}
diff --git a/test/malloc/tst-mcheck.c b/test/malloc/tst-mcheck.c
index af72c042b..7476538d8 100644
--- a/test/malloc/tst-mcheck.c
+++ b/test/malloc/tst-mcheck.c
@@ -50,7 +50,11 @@ main (void)
merror ("malloc (10) failed.");
p = realloc (p, 0);
+#ifdef __MALLOC_GLIBC_COMPAT__
+ if (!p)
+#else
if (p != NULL)
+#endif
merror ("realloc (p, 0) failed.");
p = malloc (0);
@@ -62,7 +66,11 @@ main (void)
merror ("malloc (0) failed.");
p = realloc (p, 0);
+#ifdef __MALLOC_GLIBC_COMPAT__
+ if (!p)
+#else
if (p != NULL)
+#endif
merror ("realloc (p, 0) failed.");
q = malloc (256);