-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for synthetic YAML witness invariant locations (PR #758)
- Loading branch information
Showing
4 changed files
with
150 additions
and
6 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,6 +1,2 @@ | ||
(env | ||
(_ | ||
(binaries ../../util/yamlWitnessStrip.exe))) | ||
|
||
(cram | ||
(deps (glob_files *.c) %{bin:yamlWitnessStrip})) | ||
(deps (glob_files *.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 |
---|---|---|
@@ -1,3 +1,10 @@ | ||
(env | ||
(_ | ||
(binaries ../util/yamlWitnessStrip.exe))) | ||
|
||
(cram | ||
(applies_to :whole_subtree) | ||
(deps %{bin:goblint} (package goblint))) ; need entire package for includes/ | ||
(deps | ||
%{bin:goblint} | ||
(package goblint) ; need entire package for includes/ | ||
%{bin:yamlWitnessStrip})) |
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,22 @@ | ||
// Code from https://github.com/goblint/cil/pull/98 | ||
|
||
int main() { | ||
// for loop | ||
int x = 42; | ||
for (x = 0; x < 10; x++) { // there shouldn't be invariants x <= 9, x <= 10 and 0 <= x before this line | ||
// ... | ||
} | ||
|
||
// expression with side effect | ||
int i, k; | ||
i = k = 0; // there shouldn't be invariant k == 0 before this line | ||
|
||
// compound initializers | ||
struct kala { | ||
int kaal; | ||
int hind; | ||
}; | ||
|
||
struct kala a = {2, 3}; // there shouldn't be invariant a.kaal == 2 before this line | ||
return 0; | ||
} |
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,119 @@ | ||
$ goblint --enable ana.int.interval --enable witness.yaml.enabled --set witness.yaml.entry-types '["loop_invariant", "location_invariant"]' pr-758.c | ||
[Info][Deadcode] Logical lines of code (LLoC) summary: | ||
live: 6 | ||
dead: 0 | ||
total lines: 6 | ||
[Info][Witness] witness generation summary: | ||
total generation entries: 10 | ||
|
||
$ yamlWitnessStrip < witness.yml | ||
- entry_type: loop_invariant | ||
location: | ||
file_name: pr-758.c | ||
file_hash: $FILE_HASH | ||
line: 6 | ||
column: 2 | ||
function: main | ||
loop_invariant: | ||
string: (0 <= x && (x <= 9 || x <= 10)) | ||
type: assertion | ||
format: C | ||
- entry_type: location_invariant | ||
location: | ||
file_name: pr-758.c | ||
file_hash: $FILE_HASH | ||
line: 21 | ||
column: 2 | ||
function: main | ||
location_invariant: | ||
string: x == 10 | ||
type: assertion | ||
format: C | ||
- entry_type: location_invariant | ||
location: | ||
file_name: pr-758.c | ||
file_hash: $FILE_HASH | ||
line: 21 | ||
column: 2 | ||
function: main | ||
location_invariant: | ||
string: k == 0 | ||
type: assertion | ||
format: C | ||
- entry_type: location_invariant | ||
location: | ||
file_name: pr-758.c | ||
file_hash: $FILE_HASH | ||
line: 21 | ||
column: 2 | ||
function: main | ||
location_invariant: | ||
string: i == 0 | ||
type: assertion | ||
format: C | ||
- entry_type: location_invariant | ||
location: | ||
file_name: pr-758.c | ||
file_hash: $FILE_HASH | ||
line: 21 | ||
column: 2 | ||
function: main | ||
location_invariant: | ||
string: a.kaal == 2 | ||
type: assertion | ||
format: C | ||
- entry_type: location_invariant | ||
location: | ||
file_name: pr-758.c | ||
file_hash: $FILE_HASH | ||
line: 21 | ||
column: 2 | ||
function: main | ||
location_invariant: | ||
string: a.hind == 3 | ||
type: assertion | ||
format: C | ||
- entry_type: location_invariant | ||
location: | ||
file_name: pr-758.c | ||
file_hash: $FILE_HASH | ||
line: 20 | ||
column: 2 | ||
function: main | ||
location_invariant: | ||
string: x == 10 | ||
type: assertion | ||
format: C | ||
- entry_type: location_invariant | ||
location: | ||
file_name: pr-758.c | ||
file_hash: $FILE_HASH | ||
line: 20 | ||
column: 2 | ||
function: main | ||
location_invariant: | ||
string: k == 0 | ||
type: assertion | ||
format: C | ||
- entry_type: location_invariant | ||
location: | ||
file_name: pr-758.c | ||
file_hash: $FILE_HASH | ||
line: 20 | ||
column: 2 | ||
function: main | ||
location_invariant: | ||
string: i == 0 | ||
type: assertion | ||
format: C | ||
- entry_type: location_invariant | ||
location: | ||
file_name: pr-758.c | ||
file_hash: $FILE_HASH | ||
line: 12 | ||
column: 2 | ||
function: main | ||
location_invariant: | ||
string: x == 10 | ||
type: assertion | ||
format: C |