Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
943ba10b
Commit
943ba10b
authored
5 years ago
by
Virgile Prevosto
Browse files
Options
Downloads
Patches
Plain Diff
[crowbar] modify test to check for correct pretty-print of ghost else
parent
6026b072
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/crowbar/test_ghost_cfg.ml
+31
-4
31 additions, 4 deletions
tests/crowbar/test_ghost_cfg.ml
with
31 additions
and
4 deletions
tests/crowbar/test_ghost_cfg.ml
+
31
−
4
View file @
943ba10b
...
@@ -65,7 +65,7 @@ let prepare () =
...
@@ -65,7 +65,7 @@ let prepare () =
Kernel
.
set_warn_status
Kernel
.
wkey_ghost_bad_use
Log
.
Wabort
;
Kernel
.
set_warn_status
Kernel
.
wkey_ghost_bad_use
Log
.
Wabort
;
Messages
.
reset_once_flag
()
;
Messages
.
reset_once_flag
()
;
return
.
skind
<-
Return
(
None
,
Loc
.
unknown
);
return
.
skind
<-
Return
(
None
,
Loc
.
unknown
);
forward_goto_target
.
labels
<-
[
Label
(
"Unreach"
,
Loc
.
unknown
,
fals
e
)];
forward_goto_target
.
labels
<-
[
Label
(
"Unreach"
,
Loc
.
unknown
,
tru
e
)];
let
old
=
Project
.
current
()
in
let
old
=
Project
.
current
()
in
Project
.
set_current
(
Project
.
create
"simple project"
);
Project
.
set_current
(
Project
.
create
"simple project"
);
Project
.
remove
~
project
:
old
()
Project
.
remove
~
project
:
old
()
...
@@ -133,7 +133,7 @@ let mk_label =
...
@@ -133,7 +133,7 @@ let mk_label =
|
[]
->
|
[]
->
incr
nb
;
incr
nb
;
let
name
=
"L"
^
(
string_of_int
!
nb
)
in
let
name
=
"L"
^
(
string_of_int
!
nb
)
in
stmt
.
labels
<-
[
Label
(
name
,
Loc
.
unknown
,
fals
e
)
]
stmt
.
labels
<-
[
Label
(
name
,
Loc
.
unknown
,
tru
e
)
]
|
_
->
()
|
_
->
()
(* approximation for gotos: if all the statements we jump over are ghost, we
(* approximation for gotos: if all the statements we jump over are ghost, we
...
@@ -503,8 +503,35 @@ let check_file (env, file) =
...
@@ -503,8 +503,35 @@ let check_file (env, file) =
in
in
if
env
.
should_fail
&&
success
then
if
env
.
should_fail
&&
success
then
report
file_name
"Found ghost code that should not have been accepted"
report
file_name
"Found ghost code that should not have been accepted"
else
if
not
(
env
.
should_fail
)
&&
not
success
then
else
if
not
(
env
.
should_fail
)
then
begin
report
file_name
"Found ghost code that should have been accepted"
if
success
then
begin
let
norm_buf
=
Buffer
.
create
150
in
let
fmt
=
Format
.
formatter_of_buffer
norm_buf
in
let
f
=
Globals
.
Functions
.
find_by_name
"f"
in
Kernel_function
.
pretty
fmt
f
;
let
prj2
=
Project
.
create
"copy"
in
Project
.
set_current
prj2
;
Kernel
.
Files
.
set
[
Filepath
.
Normalized
.
of_string
file_name
];
File
.
init_from_cmdline
()
;
let
copy_buf
=
Buffer
.
create
150
in
let
fmt
=
Format
.
formatter_of_buffer
copy_buf
in
let
f
=
Globals
.
Functions
.
find_by_name
"f"
in
Kernel_function
.
pretty
fmt
f
;
if
Buffer
.
contents
norm_buf
<>
Buffer
.
contents
copy_buf
then
begin
let
norm
=
open_out
(
file_name
^
".norm.c"
)
in
Buffer
.
output_buffer
norm
norm_buf
;
flush
norm
;
close_out
norm
;
let
copy
=
open_out
(
file_name
^
".copy.c"
)
in
Buffer
.
output_buffer
copy
copy_buf
;
flush
copy
;
close_out
copy
;
report
file_name
"Found ghost code not well pretty-printed"
end
else
true
end
else
report
file_name
"Found ghost code that should have been accepted"
end
else
true
else
true
let
()
=
let
()
=
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment