|
From: <sv...@va...> - 2005-05-24 14:46:08
|
Author: sewardj
Date: 2005-05-24 15:46:02 +0100 (Tue, 24 May 2005)
New Revision: 3796
Added:
trunk/memcheck/tests/filter_xml
trunk/memcheck/tests/xml1.c
trunk/memcheck/tests/xml1.stderr.exp
trunk/memcheck/tests/xml1.stdout.exp
trunk/memcheck/tests/xml1.vgtest
Modified:
trunk/memcheck/tests/Makefile.am
Log:
Test XML output.
Modified: trunk/memcheck/tests/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/Makefile.am 2005-05-24 14:23:10 UTC (rev 3795)
+++ trunk/memcheck/tests/Makefile.am 2005-05-24 14:46:02 UTC (rev 3796)
@@ -2,7 +2,7 @@
DIST_SUBDIRS =3D ${VG_ARCH_ALL} .
=20
noinst_SCRIPTS =3D filter_allocs filter_leak_check_size \
- filter_stderr filter_stderr_backtrace
+ filter_stderr filter_stderr_backtrace filter_xml
=20
EXTRA_DIST =3D $(noinst_SCRIPTS) \
addressable.stderr.exp addressable.stdout.exp addressable.vgtest \
@@ -77,6 +77,7 @@
metadata.stderr.exp metadata.stdout.exp metadata.vgtest \
vgtest_ume.stderr.exp vgtest_ume.vgtest \
writev.stderr.exp writev.stderr.exp2 writev.stderr.exp3 writev.vgtest \
+ xml1.stderr.exp xml1.stdout.exp xml1.vgtest \
zeropage.stderr.exp zeropage.stderr.exp2 zeropage.vgtest
=20
check_PROGRAMS =3D \
@@ -100,7 +101,7 @@
str_tester supp1 supp2 suppfree \
trivialleak weirdioctl \
mismatches new_override metadata \
- vgtest_ume \
+ vgtest_ume xml1 \
writev zeropage
=20
=20
@@ -173,6 +174,7 @@
str_tester_SOURCES =3D str_tester.c
str_tester_CFLAGS =3D $(AM_CFLAGS) -Wno-shadow
writev_SOURCES =3D writev.c
+xml1_SOURCES =3D xml1.c
zeropage_SOURCES =3D zeropage.c
=20
# C++ ones
Added: trunk/memcheck/tests/filter_xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/filter_xml 2005-05-24 14:23:10 UTC (rev 3795)
+++ trunk/memcheck/tests/filter_xml 2005-05-24 14:46:02 UTC (rev 3796)
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+./filter_stderr |
+sed "s/<tid>[0-9]*<\/tid>/<tid>...<\/tid>/" |
+sed "s/<pid>[0-9]*<\/pid>/<pid>...<\/pid>/" |
+sed "s/<ppid>[0-9]*<\/ppid>/<ppid>...<\/ppid>/" |
+sed "s/<obj>.*<\/obj>/<obj>...<\/obj>/" |
+sed "s/<preamble>.*<\/preamble>/<preamble>...<\/preamble>/"
+
Property changes on: trunk/memcheck/tests/filter_xml
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/memcheck/tests/xml1.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/xml1.c 2005-05-24 14:23:10 UTC (rev 3795)
+++ trunk/memcheck/tests/xml1.c 2005-05-24 14:46:02 UTC (rev 3796)
@@ -0,0 +1,50 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+
+
+int frame3 ( void )
+{
+ int *a =3D malloc(10 * sizeof(int));
+
+ // bad address;
+ int n =3D a[10];
+
+ // undefined condition
+ if (a[5] =3D=3D 42) {
+ printf("hello from frame3(). The answer is 42.\n");
+ } else {
+ printf("hello from frame3(). The answer is not 42.\n");
+ }
+
+ // undefined address (careful ..)
+ n =3D a[ a[0] & 7 ];
+
+ // invalid free, the second time
+ free(a);
+ free(a);
+
+ // more invalid frees
+ free(&n);
+
+ // leak ..
+ a =3D malloc(99 * sizeof(int));
+
+ // pass garbage to the exit syscall
+ return n;
+}
+
+int frame2 ( void )
+{
+ return frame3() - 1;
+}
+
+int frame1 ( void )
+{
+ return frame2() + 1;
+}
+
+int main ( void )
+{
+ return frame1() - 1;
+}
Added: trunk/memcheck/tests/xml1.stderr.exp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/xml1.stderr.exp 2005-05-24 14:23:10 UTC (rev 379=
5)
+++ trunk/memcheck/tests/xml1.stderr.exp 2005-05-24 14:46:02 UTC (rev 379=
6)
@@ -0,0 +1,151 @@
+
+<valgrindoutput>
+
+<protocolversion>1</protocolversion>
+
+<preamble>...</preamble>
+<preamble>...</preamble>
+<preamble>...</preamble>
+<preamble>...</preamble>
+<preamble>...</preamble>
+<preamble>...</preamble>
+
+<pid>...</pid>
+<ppid>...</ppid>
+<tool>memcheck</tool>
+
+<argv>
+ <arg>./xml1</arg>
+</argv>
+
+<status>RUNNING</status>
+
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>InvalidRead</kind>
+ <what>Invalid read of size 4</what>
+ <stack>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame3</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame2</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame1</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>main</fn></frame>
+ </stack>
+ <auxwhat>Address 0x........ is 0 bytes after a block of size 40 alloc'=
d</auxwhat>
+ <stack>
+ <frame><ip>0x........</ip><obj>...</obj><fn>malloc</fn><file>vg_repl=
ace_malloc.c</file><line>220</line></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame3</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame2</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame1</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>main</fn></frame>
+ </stack>
+</error>
+
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>UninitCondition</kind>
+ <what>Conditional jump or move depends on uninitialised value(s)</what=
>
+ <stack>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame3</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame2</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame1</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>main</fn></frame>
+ </stack>
+</error>
+
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>UninitValue</kind>
+ <what>Use of uninitialised value of size 4</what>
+ <stack>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame3</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame2</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame1</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>main</fn></frame>
+ </stack>
+</error>
+
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>InvalidFree</kind>
+ <what>Invalid free() / delete / delete[]</what>
+ <stack>
+ <frame><ip>0x........</ip><obj>...</obj><fn>free</fn><file>vg_replac=
e_malloc.c</file><line>306</line></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame3</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame2</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame1</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>main</fn></frame>
+ </stack>
+ <auxwhat>Address 0x........ is 0 bytes inside a block of size 40 free'=
d</auxwhat>
+ <stack>
+ <frame><ip>0x........</ip><obj>...</obj><fn>free</fn><file>vg_replac=
e_malloc.c</file><line>306</line></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame3</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame2</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame1</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>main</fn></frame>
+ </stack>
+</error>
+
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>InvalidFree</kind>
+ <what>Invalid free() / delete / delete[]</what>
+ <stack>
+ <frame><ip>0x........</ip><obj>...</obj><fn>free</fn><file>vg_replac=
e_malloc.c</file><line>306</line></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame3</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame2</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame1</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>main</fn></frame>
+ </stack>
+ <auxwhat>Address 0x........ is on thread 1's stack</auxwhat>
+</error>
+
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>SyscallParam</kind>
+ <what>Syscall param exit_group(exit_code) contains uninitialised byte(=
s)</what>
+ <stack>
+ <frame><ip>0x........</ip><obj>...</obj><fn>_Exit</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>__libc_start_main</fn></=
frame>
+ <frame><ip>0x........</ip><obj>...</obj><file>start.S</file><line>10=
2</line></frame>
+ </stack>
+</error>
+
+<errorcounts>
+ <pair><count>1</count><unique>0x........</unique></pair>
+ <pair><count>1</count><unique>0x........</unique></pair>
+ <pair><count>1</count><unique>0x........</unique></pair>
+ <pair><count>1</count><unique>0x........</unique></pair>
+ <pair><count>1</count><unique>0x........</unique></pair>
+ <pair><count>1</count><unique>0x........</unique></pair>
+</errorcounts>
+
+<status>FINISHED</status>
+
+<suppcounts>
+ <pair><count>18</count><name>Ugly strchr error in /lib/ld-2.3.3.so</na=
me></pair>
+<suppcounts>
+
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>Leak_DefinitelyLost</kind>
+ <what>396 bytes in 1 blocks are definitely lost in loss record 1 of 1<=
/what>
+ <leakedbytes>396</leakedbytes>
+ <leakedblocks>1</leakedblocks>
+ <stack>
+ <frame><ip>0x........</ip><obj>...</obj><fn>malloc</fn><file>vg_repl=
ace_malloc.c</file><line>220</line></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame3</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame2</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>frame1</fn></frame>
+ <frame><ip>0x........</ip><obj>...</obj><fn>main</fn></frame>
+ </stack>
+</error>
+
+</valgrindoutput>
+
Added: trunk/memcheck/tests/xml1.stdout.exp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/xml1.stdout.exp 2005-05-24 14:23:10 UTC (rev 379=
5)
+++ trunk/memcheck/tests/xml1.stdout.exp 2005-05-24 14:46:02 UTC (rev 379=
6)
@@ -0,0 +1 @@
+hello from frame3(). The answer is not 42.
Added: trunk/memcheck/tests/xml1.vgtest
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/xml1.vgtest 2005-05-24 14:23:10 UTC (rev 3795)
+++ trunk/memcheck/tests/xml1.vgtest 2005-05-24 14:46:02 UTC (rev 3796)
@@ -0,0 +1,3 @@
+prog: xml1
+vgopts: --xml=3Dyes
+stderr_filter: filter_xml
|