-
Notifications
You must be signed in to change notification settings - Fork 274
Added basic block source lines to source_locationt #3967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0512088
to
ee35009
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. I wonder if @peterschrammel or whoever is in charge of Diffblue's test case generator wants to comment as this seems like the kind of thing that would change their output.
ee35009
to
31727ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: 31727ed).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98753027
src/goto-instrument/source_lines.cpp
Outdated
{ | ||
if(loc.get_file().empty() || loc.is_built_in()) | ||
return; | ||
std::string file = id2string(loc.get_file()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Const ref?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, done.
src/goto-instrument/source_lines.cpp
Outdated
std::string file = id2string(loc.get_file()); | ||
|
||
// the function of a source location can fail to be set | ||
std::string func = id2string(loc.get_function()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const ref?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
31727ed
to
e92a5c6
Compare
block 5 \(lines main.c:main:20\): SATISFIED | ||
block 6 \(lines main.c:main:15,21,22\): SATISFIED | ||
block 7 \(lines main.c:main:24,25\): SATISFIED | ||
block 1 \(lines main.c:foo:6,7,8,9\): SATISFIED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to use util/format_number_range
for a more compact representation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should do that. As Mark explained in #1439 we have a tool (to be open sourced) that uses this information, so I'll first make sure it can cope with both the explicit enumeration as well as the ranges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In practice, blocks are so small it makes almost no difference.
But the essential thing is to continue listing filename-numberset pairs, because the lines contributing to a block can come from more than one file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be preserved, yes. The only change (and really the only change that was necessary to the regression tests) is that instead of 6,7,8,9
we now print 6-9
.
e92a5c6
to
b70f696
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: b70f696).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99099532
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
b70f696
to
b3209a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: b3209a0).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99113365
Marking do-not-merge: I would like to ask for explicit approval that this doesn't break TG (as this PR changes the output) and also I need to co-ordinate the merge on our end. |
b3209a0
to
b1a2804
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: b1a2804).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99575601
b1a2804
to
77ae56c
Compare
Thanks @jeannielynnmoulton! This PR is now rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: 77ae56c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99673839
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
77ae56c
to
a51d007
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: a51d007).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99704188
@tautschnig I've had to update some tests on test-gen for this change, but it doesn't seem to break anything. The one curious thing that I see is that some
Is this expected? |
Bump passes. It would be good to get an answer to the above question before this is merged though. |
Thanks @jeannielynnmoulton - I'll look into this, it is reproducible on one of the regression tests. |
a51d007
to
4707ed5
Compare
@jeannielynnmoulton Thank you very much for not letting me be lazy - I have now added code to |
Block coverage obtained with "cbmc --cover locations" now reports the file name and line number of every line of source code contributing to a basic block in the "description" field of the xml output. (The lines contributing to a block can come from multiple files via function inlining and definitions in include files, so reporting line numbers alone is not sufficient.)
4707ed5
to
01f4ee2
Compare
@tautschnig Seems to be non-empty now. |
@jeannielynnmoulton Many thanks for confirming! Does it still pass TG tests, or should I hold back on merging this one (once Travis has settled)? |
I'm updating the tests to be more specific so we don't have the blank lines regression. I'll run CI one more time to be safe and let you know when it's safe to merge. (Sorry about closing the PR accidentally, my laptop track pad is so sensitive) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: 01f4ee2).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100217199
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: 01f4ee2).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100219604
@tautschnig Bump passed! |
This is a rebased version of #1439.
Block coverage obtained with "cbmc --cover locations" now reports the file name
and line number of every line of source code contributing to a basic block in
the "description" field of the xml output. (The lines contributing to a block
can come from multiple files via function inlining and definitions in include
files, so reporting line numbers alone is not sufficient.)