]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Added regression test for drd's memory allocation replacement functions.
authorBart Van Assche <bvanassche@acm.org>
Sun, 20 Apr 2008 08:29:04 +0000 (08:29 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 20 Apr 2008 08:29:04 +0000 (08:29 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7894

exp-drd/tests/Makefile.am
exp-drd/tests/memory_allocation.c [new file with mode: 0644]
exp-drd/tests/memory_allocation.stderr.exp [new file with mode: 0644]
exp-drd/tests/memory_allocation.vgtest [new file with mode: 0644]

index 22a9f04154036e173ba405511b95cf69a5a2c1c5..d041a224af893b6fd63c49996aa6806e46484de8 100644 (file)
@@ -40,6 +40,8 @@ EXTRA_DIST =                                        \
        matinv.stderr.exp                           \
        matinv.stdout.exp                           \
        matinv.vgtest                               \
+       memory_allocation.stderr.exp                \
+       memory_allocation.vgtest                    \
        omp_matinv.stderr.exp                       \
        omp_matinv.stdout.exp                       \
        omp_matinv.vgtest                           \
@@ -155,6 +157,7 @@ check_PROGRAMS_COMMON = \
   hg06_readshared     \
   linuxthreads_det    \
   matinv              \
+  memory_allocation   \
   pth_barrier         \
   pth_broadcast       \
   pth_cond_race       \
@@ -228,6 +231,9 @@ linuxthreads_det_LDADD      = -lpthread
 matinv_SOURCES              = matinv.c
 matinv_LDADD                = -lpthread -lm
 
+memory_allocation_SOURCES   = memory_allocation.c
+memory_allocation_LDADD     = -lpthread -lm
+
 pth_barrier_SOURCES         = pth_barrier.c
 pth_barrier_LDADD           = -lpthread
 
diff --git a/exp-drd/tests/memory_allocation.c b/exp-drd/tests/memory_allocation.c
new file mode 100644 (file)
index 0000000..ddb0b32
--- /dev/null
@@ -0,0 +1,15 @@
+/* Repeatedly allocate and free memory. Tests whether drd */
+/* really frees memory allocated by a client. See also    */
+/* http://bugs.kde.org/show_bug.cgi?id=161036             */
+
+#include <stdlib.h>
+
+int main()
+{
+  int i;
+  for (i = 0; i < 100000; i++)
+  {
+    free(malloc(40960));
+  }
+  return 0;
+}
diff --git a/exp-drd/tests/memory_allocation.stderr.exp b/exp-drd/tests/memory_allocation.stderr.exp
new file mode 100644 (file)
index 0000000..d18786f
--- /dev/null
@@ -0,0 +1,3 @@
+
+
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
diff --git a/exp-drd/tests/memory_allocation.vgtest b/exp-drd/tests/memory_allocation.vgtest
new file mode 100644 (file)
index 0000000..5a6ce4a
--- /dev/null
@@ -0,0 +1 @@
+prog: memory-allocation