-
Notifications
You must be signed in to change notification settings - Fork 273
Make direct children of a class publicly available #2482
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
Make direct children of a class publicly available #2482
Conversation
@peterschrammel @mgudemann @romainbrenguier Could you have a look at this please? |
Could unit tests please be added (there are some for this code in jbmc/unit/java_bytecode/goto-programs/class_hierarchy_output.cpp already)? |
@tautschnig I asked about that in the PR description. :) So you think it's fine to add unit tests for cbmc code in the jbmc unit folder (and the already existing tests are in the right place)? |
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.
Wouldn't this be rather trivial if using class_hierarchy_grapht
instead? Then it's just node.out
?!
Then at least it's tested somewhere :-) Yes, I think that would be a perfectly ok place. |
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: c682411).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/77345335
@tautschnig I didn't know much about the difference between
|
You seem to be going for a grand plan :-) - I'd be totally fine with you using |
9a63fba
to
9359747
Compare
@tautschnig That makes sense. From my point of view, of course it's much nicer to have a clean interface of CBMC structures that we can use directly in Diffblue code without having to understand the implementation details of those structures and use five lines of set-up code every time we use them. So I hope my new approach is a good compromise. Of course it adds even more to the code base than my previous approach... But the idea is that it should be a step on the way to move everything in |
9359747
to
4c650a2
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: 4c650a2).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/77381494
3cd0c3c
to
11b8026
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: 3cd0c3c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/77450890
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: 11b8026).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/77454640
11b8026
to
6f861fc
Compare
@@ -13,6 +13,7 @@ Date: April 2016 | |||
|
|||
#include "class_hierarchy.h" | |||
|
|||
#include <iterator> |
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 line was only needed to make the "AWS cbmc-windows" build happy, which would otherwise complain about back_inserter
in ids_from_indices
.
6f861fc
to
ff7b37c
Compare
class_hierarchy_grapht is a more advanced representation of the class hierarchy than class_hierarchyt. So ideally we want to migrate all functions from the old version to the graph-based representation. This commit does this for the functions get_parents_trans, get_children_trans, and introduces a new function get_direct_children.
This way everything related to class_hierarchy_grapht appears first in the file, followed by everything related to class_hierarchyt. Ideally these parts should be split into different files in the future.
These two tests were previously never run because of a missing comma in the SCENARIO line. The two scenarios also need to have different names.
ff7b37c
to
9af7ef1
Compare
@tautschnig Step 2 is done - I added unit tests for all the new functions (except helper functions). I also noticed that the previously existing tests for class hierarchies were never actually run so I fixed that. Could you please re-review? |
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: 6f861fc).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/77479794
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).
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: ff7b37c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/77480971
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).
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: 9af7ef1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/77481372
@antlechner Thanks a lot for all the work, this looks all very good to me. Just one bit:
|
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.
Looks good to me as said, just that question (#2482 (comment)) about unit tests remains open.
@tautschnig Glad I found a way to make this change that works for everyone!
The change is in its own commit: 79cad15
They used the wrong syntax in the |
Oh, wow, slightly scary that syntax errors lead to silently ignored unit tests. |
Agreed! I |
6fd77f4 Merge pull request diffblue#2472 from smowton/smowton/fix/nondet-stringbuilders 5423ea4 Merge pull request diffblue#2488 from polgreen/common_call_graph_funcs a2a5662 Merge pull request diffblue#2263 from JohnDumbell/bugfix/nondet_direct_return bbf0d02 Merge pull request diffblue#2482 from antlechner/antonia/direct-children-of-class c982c21 Merge pull request diffblue#2486 from Degiorgio/jbmc-synchronoization-asymmetry-fix 8e7b6e7 Java object factory: initialize AbstractStringBuilder-derived types correctly 9af7ef1 Add tests for new class_hierarchy_grapht functions 79cad15 Fix existing class hierarchy test syntax dbac316 Add documentation to class_hierarchyt 3ecac30 Move non-graph function below graph functions 4badd8f Add useful functions to class_hierarchy_grapht 610467e Merge pull request diffblue#2480 from smowton/smowton/admin/graph-unit-tests 2431ac0 Doxygen formatting for dependence_graph test includes 19a1ceb factor out common call graph unit test functions into header deff59d Add tests for grapht::make_chordal and grapht::connected_subgraphs e94208f Merge pull request diffblue#2428 from tautschnig/vs-ref d00d833 Fix: several grapht functions were uncompilable if ever called b9014de Merge pull request diffblue#2381 from polgreen/depth_limited_search 7c767ab Merge pull request diffblue#2485 from tautschnig/vs-unreachable da76500 JBMC: Fixed asymmetry between synchronized blocks and methods. 5918640 Merge pull request diffblue#2487 from JohnDumbell/bugfix/add_java_load_class d65c655 Merge pull request diffblue#2484 from tautschnig/vs-printf 91e8b89 Fix for nondet replacement on a direct return (pre-remove returns) 904132d unit tests for depth limited search on call graph 2c76d0d call graph helper interface to depth limited search 64fdb9b depht limited search for grapht e708bfb Adds --java-load-class to tests that require it 6665c69 Remove unreachable instructions 6e4d5a7 printf does not and should not have a left-hand side 2111f7c Merge pull request diffblue#2475 from tautschnig/vs-wmm 6566d10 Merge pull request diffblue#2469 from tautschnig/vs-string2 3703974 Merge pull request diffblue#2477 from tautschnig/vs-string-abstraction cf797da Merge pull request diffblue#2473 from tautschnig/vs-update c07a09b Merge pull request diffblue#2476 from tautschnig/vs-cex e504e80 Remove unused parameter in string abstraction 4d88b98 Remove unused parameter in counterexample beautification 888f168 Remove unused parameter from update_scores 461754d Remove unused parameters in goto-instrument/wmm 93300aa Use string2unsigned when reading/expecting an unsigned 1a7033a String refinement: Take a reference to avoid copy git-subtree-dir: cbmc git-subtree-split: 6fd77f4
Previously it was only possible to retrieve all children of a class (i.e. those that inherit directly and those that inherit by transitivity) given its ID. The new function retrieves only those children that inherit directly from the given class.
This new function is not used anywhere in CBMC but will be useful for Diffblue code.
I'm not sure how I would write a unit test for this, so if you think a test is necessary, some advice on that would be appreciated. It looks like there are no tests for anything in
class_hierarchy.h
incbmc/unit
, but there are some tests related to this file injbmc/unit/java_bytecode/goto-programs
. I'm not sure if those tests are supposed to be in thejbmc
folder as the code ingoto-programs
is not Java-specific? In any case, the change in this PR is quite small so maybe a test is not necessary. Let me know what you think.