]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Moved discard, clientperm and clientstackperm from tests/ into the test
authorNicholas Nethercote <njn@valgrind.org>
Fri, 4 Oct 2002 14:16:38 +0000 (14:16 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Fri, 4 Oct 2002 14:16:38 +0000 (14:16 +0000)
suite-proper, giving them .vgtest files and all that.  They don't make sense
for 1.0.X because the client request constants are different in HEAD, indeed
one of them (clientperm) fails with --stable.

Also moved blocked_syscall.c from tests/ to tests/unused/.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1181

20 files changed:
memcheck/tests/.cvsignore
memcheck/tests/Makefile.am
memcheck/tests/clientperm.c [moved from tests/clientperm.c with 79% similarity]
memcheck/tests/clientperm.stderr.exp [new file with mode: 0644]
memcheck/tests/clientperm.stderr.exp.hd [new file with mode: 0644]
memcheck/tests/clientperm.stdout.exp [new file with mode: 0644]
memcheck/tests/clientperm.vgtest [new file with mode: 0644]
memcheck/tests/clientstackperm.c [moved from tests/clientstackperm.c with 62% similarity]
memcheck/tests/clientstackperm.stderr.exp [new file with mode: 0644]
memcheck/tests/clientstackperm.stderr.exp.hd [new file with mode: 0644]
memcheck/tests/clientstackperm.stdout.exp [new file with mode: 0644]
memcheck/tests/clientstackperm.vgtest [new file with mode: 0644]
none/tests/.cvsignore
none/tests/Makefile.am
none/tests/discard.c [moved from tests/discard.c with 91% similarity]
none/tests/discard.stderr.exp [new file with mode: 0644]
none/tests/discard.stderr.exp.hd [new file with mode: 0644]
none/tests/discard.stdout.exp [new file with mode: 0644]
none/tests/discard.vgtest [new file with mode: 0644]
tests/unused/blocked_syscall.c [moved from tests/blocked_syscall.c with 100% similarity]

index faa43f3fe2cc8fbf583fd157c56eec7dd46c1efe..7968ef805d6d010d74b86f39c391e6ae00e60e17 100644 (file)
@@ -5,6 +5,8 @@ badfree
 badjump
 badloop
 buflen_check
+clientperm
+clientstackperm
 dir
 doublefree
 errs1
index 7cf25e7a285cd860a53cabf95145c501b0a7d9f1..fb8f0f502bc3338f8c64746b0385b9935cfd01f3 100644 (file)
@@ -20,6 +20,10 @@ EXTRA_DIST = \
        badjump.stderr.exp badjump.vgtest \
        badloop.stderr.exp badloop.vgtest \
        buflen_check.stderr.exp buflen_check.stderr.exp.hd buflen_check.vgtest \
+       clientperm.stderr.exp clientperm.stderr.exp.hd \
+       clientperm.stdout.exp clientperm.vgtest \
+       clientstackperm.stderr.exp clientstackperm.stderr.exp.hd \
+       clientstackperm.stdout.exp clientstackperm.vgtest \
        doublefree.stderr.exp doublefree.vgtest \
        errs1.stderr.exp errs1.vgtest \
        exitprog.stderr.exp exitprog.vgtest \
@@ -53,7 +57,8 @@ EXTRA_DIST = \
        weirdioctl.stderr.exp weirdioctl.stdout.exp weirdioctl.vgtest
 
 noinst_PROGRAMS = \
-       badaddrvalue badfree badjump badloop buflen_check \
+       badaddrvalue badfree badjump badloop buflen_check clientperm \
+       clientstackperm \
        doublefree errs1 exitprog fprw fwrite inits inline \
        malloc1 malloc2 manuel1 manuel2 manuel3 \
        memalign_test memcmptest mmaptest nanoleak pushfpopf \
@@ -61,8 +66,9 @@ noinst_PROGRAMS = \
        trivialleak tronical weirdioctl \
        mismatches new_override
 
-CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g
+CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g 
 CXXFLAGS = $(CFLAGS)
+INCLUDES = -I$(top_srcdir)/include
 
 # C ones
 badaddrvalue_SOURCES   = badaddrvalue.c
@@ -70,6 +76,8 @@ badfree_SOURCES       = badfree.c
 badjump_SOURCES        = badjump.c
 badloop_SOURCES        = badloop.c
 buflen_check_SOURCES   = buflen_check.c
+clientperm_SOURCES     = clientperm.c
+clientstackperm_SOURCES        = clientstackperm.c
 doublefree_SOURCES     = doublefree.c
 errs1_SOURCES          = errs1.c
 exitprog_SOURCES       = exitprog.c
similarity index 79%
rename from tests/clientperm.c
rename to memcheck/tests/clientperm.c
index ee7809d807c6d1c12b343e706476d647a7af42f0..27cb11a07889ac1062ff13e789b1ae151468bd48 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "valgrind.h"
+#include "../memcheck.h"
 
 int main1 ( void )
 {
@@ -26,14 +26,14 @@ int main ( void )
 
    for (i = 0; i < 100; i++)
      sum += aa[i];
-   printf("sum is %d\n", sum);
+   printf("sum is %s\n", sum > 0 ? "positive" : "non-positive");
 
    m = VALGRIND_DISCARD(m);
    printf("m_rm: returned value is %d\n", m );
 
    for (i = 0; i < 100; i++)
      sum += aa[i];
-   printf("sum is %d\n", sum);
+   printf("sum is %s\n", sum > 0 ? "positive" : "non-positive");
 
    return 0;
 }
diff --git a/memcheck/tests/clientperm.stderr.exp b/memcheck/tests/clientperm.stderr.exp
new file mode 100644 (file)
index 0000000..37a1379
--- /dev/null
@@ -0,0 +1,16 @@
+
+Conditional jump or move depends on uninitialised value(s)
+   at 0x........: main (clientperm.c:29)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: calloc@@GLIBC_2.0 (in /.../tests/clientperm)
+
+Conditional jump or move depends on uninitialised value(s)
+   at 0x........: main (clientperm.c:36)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: calloc@@GLIBC_2.0 (in /.../tests/clientperm)
+
+ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: 100 bytes in 1 blocks.
+malloc/free: 1 allocs, 0 frees, 100 bytes allocated.
+For a detailed leak analysis,  rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v
diff --git a/memcheck/tests/clientperm.stderr.exp.hd b/memcheck/tests/clientperm.stderr.exp.hd
new file mode 100644 (file)
index 0000000..0f6ddc0
--- /dev/null
@@ -0,0 +1,11 @@
+
+discard 0 (0 -> 0) translations in range 0x........ .. 0x........
+discard 0 (0 -> 0) translations in range 0x........ .. 0x........
+discard 0 (0 -> 0) translations in range 0x........ .. 0x........
+discard 0 (0 -> 0) translations in range 0x........ .. 0x........
+
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: 0 bytes in 0 blocks.
+malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+For a detailed leak analysis,  rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v
diff --git a/memcheck/tests/clientperm.stdout.exp b/memcheck/tests/clientperm.stdout.exp
new file mode 100644 (file)
index 0000000..7ab39d3
--- /dev/null
@@ -0,0 +1,4 @@
+m_na: returned value is 0
+sum is non-positive
+m_rm: returned value is 0
+sum is non-positive
diff --git a/memcheck/tests/clientperm.vgtest b/memcheck/tests/clientperm.vgtest
new file mode 100644 (file)
index 0000000..15289f1
--- /dev/null
@@ -0,0 +1 @@
+prog: clientperm
similarity index 62%
rename from tests/clientstackperm.c
rename to memcheck/tests/clientstackperm.c
index 31a50101ff5ba0bfa88fe5ae9b5dbe71b0e7654c..1e4e79dc24899cbc60cb6603cfa345d437c8aa12 100644 (file)
@@ -3,34 +3,29 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#include "valgrind.h"
-
+#include "../memcheck.h"
 
 int baaaad ( void )
 {
-   int i;
    int spacer0[10];
-   int aaa[10];
+   int aaa[10] __attribute__((unused));
    int spacer1[10];
-   int bbb[10];
+   int bbb[10] __attribute__((unused));
    int spacer2[10];
-   int ccc[10];
+   int ccc[10] __attribute__((unused));
    int spacer3[10];
    VALGRIND_MAKE_NOACCESS_STACK(spacer0, sizeof spacer0);
    VALGRIND_MAKE_NOACCESS_STACK(spacer1, sizeof spacer1);
    VALGRIND_MAKE_NOACCESS_STACK(spacer2, sizeof spacer2);
    VALGRIND_MAKE_NOACCESS_STACK(spacer3, sizeof spacer3);
-   printf("reading %p\n", &aaa[-3]);
+   printf("reading memory\n");
+   if ((int*)0xDEADBEEF == &aaa[-3]) { printf("DEAD BEEF!\n"); }
    return aaa[-3];
-   for (i = 0; i < 10; i++) {
-     printf("poking addr %p\n", & spacer1[i]);
-     spacer0[i] = spacer1[i] = spacer2[i] = spacer3[i] = 0;
-   }
 }
 
 
 int main ( void )
 {
    int z = baaaad();
-   return 0;
+   return z;
 }
diff --git a/memcheck/tests/clientstackperm.stderr.exp b/memcheck/tests/clientstackperm.stderr.exp
new file mode 100644 (file)
index 0000000..9ca69f1
--- /dev/null
@@ -0,0 +1,17 @@
+
+Invalid read of size 4
+   at 0x........: baaaad (clientstackperm.c:23)
+   by 0x........: main (clientstackperm.c:29)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: (within /.../tests/clientstackperm)
+   Address 0x........ is 36 bytes inside a 40-byte stack red-zone created
+   at 0x........: baaaad (clientstackperm.c:18)
+   by 0x........: main (clientstackperm.c:29)
+   by 0x........: __libc_start_main (...libc...)
+   by 0x........: (within /.../tests/clientstackperm)
+
+ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: 0 bytes in 0 blocks.
+malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+For a detailed leak analysis,  rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v
diff --git a/memcheck/tests/clientstackperm.stderr.exp.hd b/memcheck/tests/clientstackperm.stderr.exp.hd
new file mode 100644 (file)
index 0000000..0f6ddc0
--- /dev/null
@@ -0,0 +1,11 @@
+
+discard 0 (0 -> 0) translations in range 0x........ .. 0x........
+discard 0 (0 -> 0) translations in range 0x........ .. 0x........
+discard 0 (0 -> 0) translations in range 0x........ .. 0x........
+discard 0 (0 -> 0) translations in range 0x........ .. 0x........
+
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: 0 bytes in 0 blocks.
+malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+For a detailed leak analysis,  rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v
diff --git a/memcheck/tests/clientstackperm.stdout.exp b/memcheck/tests/clientstackperm.stdout.exp
new file mode 100644 (file)
index 0000000..df0c0ce
--- /dev/null
@@ -0,0 +1 @@
+reading memory
diff --git a/memcheck/tests/clientstackperm.vgtest b/memcheck/tests/clientstackperm.vgtest
new file mode 100644 (file)
index 0000000..3b5b208
--- /dev/null
@@ -0,0 +1 @@
+prog: clientstackperm
index a2ae42900790e89a5d0bc06196215d0247f99f41..5812911b8e2990d2cba34d86d576297b6cf043fd 100644 (file)
@@ -7,6 +7,7 @@ coolo_sigaction
 coolo_strlen
 cpuid
 dastest
+discard
 floored
 fork
 fucomip
index e00d485bfd636221476fae3287960b3b47985059..ed925e5e5c81ffe20101218239f2f72da4fd9a93 100644 (file)
@@ -19,6 +19,8 @@ EXTRA_DIST = \
        cpuid.stderr.exp cpuid.stderr.exp.hd cpuid.stdout.exp cpuid.vgtest \
        dastest.stderr.exp dastest.stderr.exp.hd dastest.stdout.exp \
        dastest.vgtest \
+       discard.stderr.exp discard.stderr.exp.hd discard.stdout.exp \
+       discard.vgtest \
        floored.stderr.exp floored.stderr.exp.hd floored.stdout.exp \
        floored.vgtest \
        fork.stderr.exp fork.stderr.exp.hd fork.stdout.exp fork.vgtest \
@@ -41,7 +43,7 @@ EXTRA_DIST = \
 
 noinst_PROGRAMS = \
        bitfield1 bt_everything bt_literal coolo_strlen \
-       cpuid dastest floored fork fucomip munmap_exe rcl_assert \
+       cpuid dastest discard floored fork fucomip munmap_exe rcl_assert \
        rcrl readline1 resolv seg_override sha1_test shortpush shorts smc1 \
        pth_blockedsig \
        coolo_sigaction gxx304
@@ -56,6 +58,7 @@ bt_literal_SOURCES    = bt_literal.c
 cpuid_SOURCES          = cpuid_c.c cpuid_s.s
 coolo_strlen_SOURCES   = coolo_strlen.c
 dastest_SOURCES        = dastest_c.c dastest_s.s
+discard_SOURCES        = discard.c
 fork_SOURCES           = fork.c
 floored_SOURCES        = floored.c
 floored_LDADD          = -lm
similarity index 91%
rename from tests/discard.c
rename to none/tests/discard.c
index 0c14e9f14c6f2b9d0db742180ef42524cab1ed25..aaa1b2d32aa81848979da637170e1878e5ab1838 100644 (file)
@@ -1,6 +1,6 @@
 
 #include <stdio.h>
-#include <valgrind.h>
+#include "../../include/valgrind.h"
 
 int fooble ( void )
 {
diff --git a/none/tests/discard.stderr.exp b/none/tests/discard.stderr.exp
new file mode 100644 (file)
index 0000000..554e639
--- /dev/null
@@ -0,0 +1,3 @@
+
+discard ... (... -> ...) translations in range 0x........ .. 0x........
+
diff --git a/none/tests/discard.stderr.exp.hd b/none/tests/discard.stderr.exp.hd
new file mode 100644 (file)
index 0000000..c4aa6f0
--- /dev/null
@@ -0,0 +1,7 @@
+
+
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: 0 bytes in 0 blocks.
+malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
+For a detailed leak analysis,  rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v
diff --git a/none/tests/discard.stdout.exp b/none/tests/discard.stdout.exp
new file mode 100644 (file)
index 0000000..22c6cbb
--- /dev/null
@@ -0,0 +1,2 @@
+fooble-1() = 1749
+fooble-2() = 1749
diff --git a/none/tests/discard.vgtest b/none/tests/discard.vgtest
new file mode 100644 (file)
index 0000000..9501fc3
--- /dev/null
@@ -0,0 +1,2 @@
+prog: discard
+stderr_filter: filter_none_discards