Skip to content

Commit a678be5

Browse files
committed
tests/cslinker/0002-xml-parser: basic test for xml-parser
1 parent 5747e41 commit a678be5

File tree

8 files changed

+488
-5
lines changed

8 files changed

+488
-5
lines changed

tests/cslinker/0001-smoke/runtest.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
set -e
33
set -x
44

5-
# FIXME: copy-pasted from ../../CMakeLists.txt
6-
export JSFILTER_CMD="sed -e ':a;N;\$!ba;s|:\\n *\\[|: [|g'"
7-
8-
# yet another conversion needed for scan properties on EPEL-7
9-
JSFILTER_CMD="${JSFILTER_CMD}';s|:\\n *{|: {|g'"
5+
# import ${JSFILTER_CMD}
6+
. ${TEST_SRC_DIR}/../test-lib-cslinker.sh
107

118
# run cshtml
129
"${CSLINKER_BIN}" \
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0"?>
2+
3+
<valgrindoutput>
4+
5+
<protocolversion>4</protocolversion>
6+
<protocoltool>memcheck</protocoltool>
7+
8+
<preamble>
9+
<line>Memcheck, a memory error detector</line>
10+
<line>Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.</line>
11+
<line>Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info</line>
12+
<line>Command: /lib64/ld-linux-x86-64.so.2 --preload libcsexec-preload.so --argv0 /builddir/build/BUILD/logrotate-3.18.0/build/logrotate /builddir/build/BUILD/logrotate-3.18.0/build/logrotate -v -m ./mailer -s state test-config.85 -f</line>
13+
</preamble>
14+
15+
<pid>690565</pid>
16+
<ppid>690126</ppid>
17+
<tool>memcheck</tool>
18+
19+
<args>
20+
<vargv>
21+
<exe>/usr/bin/valgrind</exe>
22+
<arg>--xml=yes</arg>
23+
<arg>--xml-file=/builddir/valgrind-capture/pid-%p-%n.xml</arg>
24+
<arg>--log-file=/builddir/valgrind-capture/pid-%p-%n.log</arg>
25+
<arg>--child-silent-after-fork=yes</arg>
26+
</vargv>
27+
<argv>
28+
<exe>/lib64/ld-linux-x86-64.so.2</exe>
29+
<arg>--preload</arg>
30+
<arg>libcsexec-preload.so</arg>
31+
<arg>--argv0</arg>
32+
<arg>/builddir/build/BUILD/logrotate-3.18.0/build/logrotate</arg>
33+
<arg>/builddir/build/BUILD/logrotate-3.18.0/build/logrotate</arg>
34+
<arg>-v</arg>
35+
<arg>-m</arg>
36+
<arg>./mailer</arg>
37+
<arg>-s</arg>
38+
<arg>state</arg>
39+
<arg>test-config.85</arg>
40+
<arg>-f</arg>
41+
</argv>
42+
</args>
43+
44+
<status>
45+
<state>RUNNING</state>
46+
<time>00:00:00:00.016 </time>
47+
</status>
48+
49+
50+
<status>
51+
<state>FINISHED</state>
52+
<time>00:00:00:01.449 </time>
53+
</status>
54+
55+
<error>
56+
<unique>0x1</unique>
57+
<tid>1</tid>
58+
<kind>Leak_DefinitelyLost</kind>
59+
<xwhat>
60+
<text>6 bytes in 1 blocks are definitely lost in loss record 2 of 13</text>
61+
<leakedbytes>6</leakedbytes>
62+
<leakedblocks>1</leakedblocks>
63+
</xwhat>
64+
<stack>
65+
<frame>
66+
<ip>0x4825805</ip>
67+
<obj>/usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so</obj>
68+
<fn>malloc</fn>
69+
<dir>/builddir/build/BUILD/valgrind-3.16.1/coregrind/m_replacemalloc</dir>
70+
<file>vg_replace_malloc.c</file>
71+
<line>307</line>
72+
</frame>
73+
<frame>
74+
<ip>0x487ABB3</ip>
75+
<obj>/usr/lib64/libpopt.so.0.0.1</obj>
76+
<fn>poptGetNextOpt</fn>
77+
</frame>
78+
<frame>
79+
<ip>0x480454B</ip>
80+
<obj>/builddir/build/BUILD/logrotate-3.18.0/build/logrotate</obj>
81+
<fn>main</fn>
82+
<dir>/builddir/build/BUILD/logrotate-3.18.0/build</dir>
83+
<file>logrotate.c</file>
84+
<line>2983</line>
85+
</frame>
86+
</stack>
87+
</error>
88+
89+
<errorcounts>
90+
</errorcounts>
91+
92+
<suppcounts>
93+
</suppcounts>
94+
95+
</valgrindoutput>
96+
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0"?>
2+
3+
<valgrindoutput>
4+
5+
<protocolversion>4</protocolversion>
6+
<protocoltool>memcheck</protocoltool>
7+
8+
<preamble>
9+
<line>Memcheck, a memory error detector</line>
10+
<line>Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.</line>
11+
<line>Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info</line>
12+
<line>Command: ./a.out</line>
13+
</preamble>
14+
15+
<pid>691556</pid>
16+
<ppid>419235</ppid>
17+
<tool>memcheck</tool>
18+
19+
<args>
20+
<vargv>
21+
<exe>/usr/bin/valgrind</exe>
22+
<arg>--xml=yes</arg>
23+
<arg>--xml-file=xxx.xml</arg>
24+
</vargv>
25+
<argv>
26+
<exe>./a.out</exe>
27+
</argv>
28+
</args>
29+
30+
<status>
31+
<state>RUNNING</state>
32+
<time>00:00:00:00.015 </time>
33+
</status>
34+
35+
<error>
36+
<unique>0x0</unique>
37+
<tid>1</tid>
38+
<kind>InvalidFree</kind>
39+
<what>Invalid free() / delete / delete[] / realloc()</what>
40+
<stack>
41+
<frame>
42+
<ip>0x483B9F5</ip>
43+
<obj>/usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so</obj>
44+
<fn>free</fn>
45+
<dir>/builddir/build/BUILD/valgrind-3.16.1/coregrind/m_replacemalloc</dir>
46+
<file>vg_replace_malloc.c</file>
47+
<line>538</line>
48+
</frame>
49+
<frame>
50+
<ip>0x40114D</ip>
51+
<obj>/home/kdudka/git/csdiff/a.out</obj>
52+
<fn>main</fn>
53+
</frame>
54+
</stack>
55+
<auxwhat>Address 0x401040 is in the PLT segment of /home/kdudka/git/csdiff/a.out</auxwhat>
56+
</error>
57+
58+
59+
<status>
60+
<state>FINISHED</state>
61+
<time>00:00:00:00.186 </time>
62+
</status>
63+
64+
<error>
65+
<unique>0x1</unique>
66+
<tid>1</tid>
67+
<kind>Leak_DefinitelyLost</kind>
68+
<xwhat>
69+
<text>13 bytes in 1 blocks are definitely lost in loss record 1 of 1</text>
70+
<leakedbytes>13</leakedbytes>
71+
<leakedblocks>1</leakedblocks>
72+
</xwhat>
73+
<stack>
74+
<frame>
75+
<ip>0x483A809</ip>
76+
<obj>/usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so</obj>
77+
<fn>malloc</fn>
78+
<dir>/builddir/build/BUILD/valgrind-3.16.1/coregrind/m_replacemalloc</dir>
79+
<file>vg_replace_malloc.c</file>
80+
<line>307</line>
81+
</frame>
82+
<frame>
83+
<ip>0x401143</ip>
84+
<obj>/home/kdudka/git/csdiff/a.out</obj>
85+
<fn>main</fn>
86+
</frame>
87+
</stack>
88+
</error>
89+
90+
<errorcounts>
91+
<pair>
92+
<count>1</count>
93+
<unique>0x0</unique>
94+
</pair>
95+
</errorcounts>
96+
97+
<suppcounts>
98+
</suppcounts>
99+
100+
</valgrindoutput>
101+
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?xml version="1.0"?>
2+
3+
<valgrindoutput>
4+
5+
<protocolversion>4</protocolversion>
6+
<protocoltool>memcheck</protocoltool>
7+
8+
<preamble>
9+
<line>Memcheck, a memory error detector</line>
10+
<line>Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.</line>
11+
<line>Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info</line>
12+
<line>Command: ./a.out</line>
13+
</preamble>
14+
15+
<pid>5483</pid>
16+
<ppid>1158</ppid>
17+
<tool>memcheck</tool>
18+
19+
<args>
20+
<vargv>
21+
<exe>/usr/bin/valgrind</exe>
22+
<arg>--xml=yes</arg>
23+
<arg>--xml-file=xxx2.xml</arg>
24+
</vargv>
25+
<argv>
26+
<exe>./a.out</exe>
27+
</argv>
28+
</args>
29+
30+
<status>
31+
<state>RUNNING</state>
32+
<time>00:00:00:00.012 </time>
33+
</status>
34+
35+
<error>
36+
<unique>0x0</unique>
37+
<tid>1</tid>
38+
<kind>InvalidJump</kind>
39+
<what>Jump to the invalid address stated on the next line</what>
40+
<stack>
41+
<frame>
42+
<ip>0x0</ip>
43+
</frame>
44+
<frame>
45+
<ip>0x401130</ip>
46+
<obj>/home/kdudka/git/csdiff/a.out</obj>
47+
<fn>main</fn>
48+
<dir>/home/kdudka/git/csdiff</dir>
49+
<file>xxx.c</file>
50+
<line>9</line>
51+
</frame>
52+
</stack>
53+
<auxwhat>Address 0x0 is not stack'd, malloc'd or (recently) free'd</auxwhat>
54+
</error>
55+
56+
<fatal_signal>
57+
<tid>1</tid>
58+
<signo>11</signo>
59+
<signame>SIGSEGV</signame>
60+
<sicode>2</sicode>
61+
<event>Bad permissions for mapped region</event>
62+
<siaddr>0x0</siaddr>
63+
<stack>
64+
<frame>
65+
<ip>0x0</ip>
66+
</frame>
67+
<frame>
68+
<ip>0x401130</ip>
69+
<obj>/home/kdudka/git/csdiff/a.out</obj>
70+
<fn>main</fn>
71+
<dir>/home/kdudka/git/csdiff</dir>
72+
<file>xxx.c</file>
73+
<line>9</line>
74+
</frame>
75+
</stack>
76+
</fatal_signal>
77+
78+
79+
<status>
80+
<state>FINISHED</state>
81+
<time>00:00:00:00.176 </time>
82+
</status>
83+
84+
<errorcounts>
85+
<pair>
86+
<count>1</count>
87+
<unique>0x0</unique>
88+
</pair>
89+
</errorcounts>
90+
91+
<suppcounts>
92+
</suppcounts>
93+
94+
</valgrindoutput>
95+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -e
3+
set -x
4+
5+
# import ${JSFILTER_CMD}
6+
. ${TEST_SRC_DIR}/../test-lib-cslinker.sh
7+
8+
# run cshtml
9+
"${CSLINKER_BIN}" --quiet \
10+
"${TEST_SRC_DIR}/raw-results"/{pid-690565-2,xxx{2,}}.xml \
11+
| eval "${JSFILTER_CMD}" \
12+
> scan-results.js
13+
14+
diff -up "${TEST_SRC_DIR}/scan-results.js" "${PWD}/scan-results.js"

0 commit comments

Comments
 (0)