Skip to content

Commit 40309c0

Browse files
committed
Add fault-localization regression tests
Moving the (three) tests from a dedicated folder to cbmc to run them, also making use of all three configurations that the cbmc folder is being tested with.
1 parent 21f0c4e commit 40309c0

File tree

12 files changed

+61
-61
lines changed

12 files changed

+61
-61
lines changed
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.

regression/fault-localization/all_properties2/main.c

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

regression/fault-localization/all_properties2/test.desc

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

regression/fault-localization/stop_on_fail1/main.c

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

0 commit comments

Comments
 (0)