Skip to content

Commit 24ba3bd

Browse files
author
Remi Delmas
committed
CONTACTS: update regression test suite for DFCC
Updated tests - update assigns-enforce-malloc-zero - update assigns-local-composite - update assigns-replace-ignored-return-value - update assigns-replace-malloc-zero - update assigns-slice-targets - update assigns-slice-targets - update assigns_enforce_01 - update assigns_enforce_02 - update assigns_enforce_03 - update assigns_enforce_04 - update assigns_enforce_05 - update assigns_enforce_06 - update assigns_enforce_07
1 parent f59b93c commit 24ba3bd

File tree

19 files changed

+116
-92
lines changed

19 files changed

+116
-92
lines changed

regression/contracts/assigns-enforce-malloc-zero/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ int foo(char *a, int size)
66
// clang-format off
77
__CPROVER_requires(0 <= size && size <= __CPROVER_max_malloc_size)
88
__CPROVER_requires(a == NULL || __CPROVER_is_fresh(a, size))
9-
__CPROVER_assigns(a: __CPROVER_POINTER_OBJECT(a))
9+
__CPROVER_assigns(a: __CPROVER_whole_object(a))
1010
__CPROVER_ensures(
1111
a && __CPROVER_return_value >= 0 ==> a[__CPROVER_return_value] == 0)
1212
// clang-format on

regression/contracts/assigns-enforce-malloc-zero/test.desc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
CORE
22
main.c
3-
--enforce-contract foo _ --malloc-may-fail --malloc-fail-null
4-
^\[foo.assigns.\d+\] line 9 Check that POINTER_OBJECT\(\(const void \*\)a\) is valid when a != \(\(char \*\)NULL\): SUCCESS$
3+
--dfcc main --enforce-contract foo _ --malloc-may-fail --malloc-fail-null
54
^\[foo.assigns.\d+\] line 19 Check that a\[\(signed long (long )?int\)i\] is assignable: SUCCESS$
65
^EXIT=0$
76
^SIGNAL=0$
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
CORE
22
main.c
3-
--enforce-contract foo
3+
--dfcc main --enforce-contract foo
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$
77
--
88
--
9-
Checks that assigns clause checking explicitly checks assignments to locally
9+
Checks that assigns clause checking explicitly checks assignments to locally
1010
declared symbols with composite types, when they are dirty.
11-
Out of bounds accesses to locally declared arrays, structs, etc.
11+
Out of bounds accesses to locally declared arrays, structs, etc.
1212
will be detected by assigns clause checking.

regression/contracts/assigns-replace-ignored-return-value/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
main.c
3-
--replace-call-with-contract bar --replace-call-with-contract baz --enforce-contract foo
3+
--dfcc main --replace-call-with-contract bar --replace-call-with-contract baz --enforce-contract foo
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$

regression/contracts/assigns-replace-malloc-zero/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ int foo(char *a, int size)
66
// clang-format off
77
__CPROVER_requires(0 <= size && size <= __CPROVER_max_malloc_size)
88
__CPROVER_requires(a == NULL || __CPROVER_rw_ok(a, size))
9-
__CPROVER_assigns(__CPROVER_POINTER_OBJECT(a))
9+
__CPROVER_assigns(__CPROVER_whole_object(a))
1010
__CPROVER_ensures(
1111
a && __CPROVER_return_value >= 0 ==> a[__CPROVER_return_value] == 0)
1212
// clang-format on

regression/contracts/assigns-replace-malloc-zero/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
main.c
3-
--replace-call-with-contract foo _ --malloc-may-fail --malloc-fail-null
3+
--dfcc main --replace-call-with-contract foo _ --malloc-may-fail --malloc-fail-null
44
^EXIT=0$
55
^SIGNAL=0$
66
\[main\.assertion\.1\] line 35 expecting SUCCESS: SUCCESS$

regression/contracts/assigns-slice-targets/test-enforce.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
main-enforce.c
3-
--enforce-contract foo
3+
--dfcc main --enforce-contract foo
44
^\[foo.assigns.\d+\].* Check that s->arr1\[\(.*\)0\] is assignable: SUCCESS$
55
^\[foo.assigns.\d+\].* Check that s->arr1\[\(.*\)1\] is assignable: SUCCESS$
66
^\[foo.assigns.\d+\].* Check that s->arr1\[\(.*\)2\] is assignable: SUCCESS$

regression/contracts/assigns-slice-targets/test-replace.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
main-replace.c
3-
--replace-call-with-contract foo
3+
--dfcc main --replace-call-with-contract foo
44
^\[main.assertion.\d+\].*assertion s.a == 0: SUCCESS$
55
^\[main.assertion.\d+\].*assertion \(.*\)s.arr1\[\(.*\)0\] == 0: FAILURE$
66
^\[main.assertion.\d+\].*assertion \(.*\)s.arr1\[\(.*\)1\] == 0: FAILURE$

regression/contracts/assigns_enforce_01/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
main.c
3-
--enforce-contract foo
3+
--dfcc main --enforce-contract foo
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$

regression/contracts/assigns_enforce_02/test.desc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
CORE
22
main.c
3-
--enforce-contract foo
4-
^\[foo.assigns.\d+\] line 3 Check that z is valid: SUCCESS$
3+
--dfcc main --enforce-contract foo
54
^\[foo.assigns.\d+\] line 6 Check that \*x is assignable: FAILURE$
65
^EXIT=10$
76
^SIGNAL=0$

0 commit comments

Comments
 (0)