Skip to content

Commit 598c554

Browse files
authored
Merge pull request #5934 from tautschnig/fault-localization-tests
Add fault-localization regression tests
2 parents 4ae0bcf + 40309c0 commit 598c554

File tree

14 files changed

+92
-69
lines changed

14 files changed

+92
-69
lines changed

doc/assets/xml_spec.xsd

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,27 @@
183183

184184
<xs:element name="refinement-iteration" type="xs:integer"/>
185185

186+
<xs:element name="fault-localization">
187+
<xs:complexType>
188+
<xs:sequence>
189+
<xs:element name="diagnosis">
190+
<xs:complexType>
191+
<xs:sequence>
192+
<xs:element name="result">
193+
<xs:complexType>
194+
<xs:sequence>
195+
<xs:element ref="location"/>
196+
</xs:sequence>
197+
</xs:complexType>
198+
</xs:element>
199+
</xs:sequence>
200+
<xs:attribute name="property" type="xs:string"/>
201+
</xs:complexType>
202+
</xs:element>
203+
</xs:sequence>
204+
</xs:complexType>
205+
</xs:element>
206+
186207
<xs:element name="program" type="xs:string"/>
187208
<xs:element name="cprover-status" type="xs:string"/>
188209
<xs:element name="cprover">
@@ -193,6 +214,7 @@
193214
<xs:element ref="message"/>
194215
<xs:element ref="result"/>
195216
<xs:element ref="refinement-iteration"/>
217+
<xs:element ref="fault-localization"/>
196218
</xs:choice>
197219
<xs:element ref="cprover-status" minOccurs="0"/>
198220
</xs:sequence>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <assert.h>
2+
3+
void main()
4+
{
5+
int x, c;
6+
if(c)
7+
x = 0;
8+
else
9+
x++;
10+
assert(x == 0);
11+
assert(x != 0);
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
KNOWNBUG
2+
main.c
3+
--localize-faults
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
line 7 function main$
7+
line 9 function main$
8+
^VERIFICATION FAILED$
9+
--
10+
--
11+
With --localize-faults, CBMC only reports the first assertion as failing.
12+
Without --localize-faults, CBMC correctly reports both assertions as failing.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <assert.h>
2+
3+
void main()
4+
{
5+
int x, c;
6+
if(c)
7+
x = 0;
8+
else
9+
x++;
10+
assert(x == 0);
11+
assert(x == 0 || c == 0);
12+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
KNOWNBUG
2+
main.c
3+
--localize-faults
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
line 9 function main$
7+
^VERIFICATION FAILED$
8+
--
9+
--
10+
CBMC wrongly reports line 7 as the faulty statement when instead it should be
11+
line 9.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <assert.h>
2+
3+
void main()
4+
{
5+
int x, c;
6+
if(c)
7+
x = 0;
8+
else
9+
x++;
10+
assert(x == 0);
11+
assert(x != 0);
12+
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
CORE
1+
CORE paths-lifo-expected-failure broken-smt-backend
22
main.c
33
--localize-faults --stop-on-fail
44
^EXIT=10$
55
^SIGNAL=0$
6-
^\[main.assertion.1\]:
6+
^\[main.assertion.[12]\]:
77
line . function main$
88
^VERIFICATION FAILED$
99
--

regression/fault-localization/Makefile

Lines changed: 0 additions & 12 deletions
This file was deleted.

regression/fault-localization/all_properties1/main.c

Lines changed: 0 additions & 10 deletions
This file was deleted.

regression/fault-localization/all_properties1/test.desc

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)