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
e50f33f4
Commit
e50f33f4
authored
5 years ago
by
Virgile Prevosto
Browse files
Options
Downloads
Patches
Plain Diff
[crowbar] catch exception if pretty-printed code is not re-parsable
parent
4688e55b
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
+15
-6
15 additions, 6 deletions
tests/crowbar/test_ghost_cfg.ml
with
15 additions
and
6 deletions
tests/crowbar/test_ghost_cfg.ml
+
15
−
6
View file @
e50f33f4
...
@@ -512,12 +512,18 @@ let check_file (env, file) =
...
@@ -512,12 +512,18 @@ let check_file (env, file) =
let
prj2
=
Project
.
create
"copy"
in
let
prj2
=
Project
.
create
"copy"
in
Project
.
set_current
prj2
;
Project
.
set_current
prj2
;
Kernel
.
Files
.
set
[
Filepath
.
Normalized
.
of_string
file_name
];
Kernel
.
Files
.
set
[
Filepath
.
Normalized
.
of_string
file_name
];
File
.
init_from_cmdline
()
;
let
parse_success
=
let
copy_buf
=
Buffer
.
create
150
in
try
let
fmt
=
Format
.
formatter_of_buffer
copy_buf
in
File
.
init_from_cmdline
()
;
true
let
f
=
Globals
.
Functions
.
find_by_name
"f"
in
with
Kernel_function
.
pretty
fmt
f
;
Log
.
AbortError
_
->
ignore_deferred_errors
()
;
false
if
Buffer
.
contents
norm_buf
<>
Buffer
.
contents
copy_buf
then
begin
in
if
parse_success
then
begin
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
let
norm
=
open_out
(
file_name
^
".norm.c"
)
in
Buffer
.
output_buffer
norm
norm_buf
;
Buffer
.
output_buffer
norm
norm_buf
;
flush
norm
;
flush
norm
;
...
@@ -528,6 +534,9 @@ let check_file (env, file) =
...
@@ -528,6 +534,9 @@ let check_file (env, file) =
close_out
copy
;
close_out
copy
;
report
file_name
"Found ghost code not well pretty-printed"
report
file_name
"Found ghost code not well pretty-printed"
end
else
true
end
else
true
end
else
begin
report
file_name
"Error during re-parsing of pretty-printed code"
end
end
end
else
else
report
file_name
"Found ghost code that should have been accepted"
report
file_name
"Found ghost code that should have been accepted"
...
...
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