-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5409 from hannes-steffenhagen-diffblue/fix/do_not…
…_use_side_effect_expr_nondett_in_goto_harness Do not use side_effect_expr_nondett in recursive_initialization
- Loading branch information
Showing
8 changed files
with
87 additions
and
48 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
regression/goto-harness/do-not-use-nondet-for-primitives/test.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <assert.h> | ||
|
||
void test_function(int test) | ||
{ | ||
assert(test != 42); | ||
} |
17 changes: 17 additions & 0 deletions
17
regression/goto-harness/do-not-use-nondet-for-primitives/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
CORE | ||
test.c | ||
--function test_function --harness-type call-function | ||
\[test_function\.assertion\.1\] line \d+ assertion test != 42 | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
nondet_signed_int | ||
-- | ||
If we use side_effect_expr_nondett then dump_c will generation function calls | ||
to functions with names like nondet_signed_int without declaration. | ||
This can cause problems around usability. | ||
|
||
To fix this, we changed goto-harness to just not use side_effect_expr_nondett | ||
at all. | ||
|
||
This test tests for the absence the use for these things. |
11 changes: 11 additions & 0 deletions
11
regression/goto-harness/do-not-use-nondet-for-recursion/test.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
struct linked_list | ||
{ | ||
struct linked_list *next; | ||
}; | ||
|
||
void test(struct linked_list *list) | ||
{ | ||
assert(list); | ||
assert(list->next); | ||
assert(!list->next); | ||
} |
14 changes: 14 additions & 0 deletions
14
regression/goto-harness/do-not-use-nondet-for-recursion/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
CORE | ||
test.c | ||
--function test --harness-type call-function | ||
\[test.assertion.1\] line \d+ assertion list: SUCCESS | ||
\[test.assertion.2\] line \d+ assertion list->next: FAILURE | ||
\[test.assertion.3\] line \d+ assertion !\(list->next != \(\(struct linked_list \*\).*\)\): FAILURE | ||
should_recurse_nondet | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
__CPROVER_nondet_bool | ||
-- | ||
This is to check that we use the new mechanism to decide whether we should recurse | ||
non-deterministically (i.e. without using side_effect_expr_nondett). |
8 changes: 8 additions & 0 deletions
8
regression/goto-harness/do-not-use-nondet-for-selecting-pointers-to-treat-as-equal/test.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
void test(int *x, int *y) | ||
{ | ||
assert(x); | ||
assert(y); | ||
assert(x == y); | ||
assert(x != y); | ||
assert(*x == *y); | ||
} |
18 changes: 18 additions & 0 deletions
18
regression/goto-harness/do-not-use-nondet-for-selecting-pointers-to-treat-as-equal/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CORE | ||
test.c | ||
--function test --harness-type call-function --treat-pointers-equal x,y --treat-pointers-equal-maybe | ||
should_make_equal | ||
\[test.assertion.1\] line 3 assertion x: SUCCESS | ||
\[test.assertion.2\] line 4 assertion y: SUCCESS | ||
\[test.assertion.3\] line 5 assertion x == y: FAILURE | ||
\[test.assertion.4\] line 6 assertion x != y: FAILURE | ||
\[test.assertion.5\] line 7 assertion \*x == \*y: FAILURE | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
__CPROVER_nondet_bool | ||
-- | ||
We are no longer using side_effect_expr_nondett for nondet primitives, | ||
specifically this is testing that we are using a variable called some variation | ||
of “should_make_equal” (plus some optional postfix) as the condition variable | ||
that assigns the same destination to pointers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters