angr
angr copied to clipboard
Fix bug in CFGUtils.quasi_topological_sort_nodes
The previous implementation would return an empty list of nodes when given a cycle of two nodes. This fixes that.
LGTM. Can you also add a test case of your observed failure case?
Wow. That's a strange one! Thanks @lockshaw!
I can't check the "real" test case in here, but before I merge, I will add one to binaries-private
Test is covered by, at least https://github.com/angr/angr/pull/1668
Let's add a unit test before merging this in.
@ltfish Sorry that took so long! Unit test added. Where does angr track test dependencies?
@lockshaw Our dependencies are marked in setup.py. But, why are we adding adding this library for a single test? We already use nose for our unit testing, would it be possible for you implement the unit test using that rather than a whole new library?
@twizmwazin Are test dependencies marked in setup.py? I imagine nose would be a pretty hard dependency for tests, and I see it referenced nowhere in that file.
Hypothesis is orthogonal to the nose. It would be possible to implement a similar test without it, but would require a non-trivial amount of code that we would then be responsible for maintaining, and would be lower quality than what hypothesis already offers. I added it because using it (ideally for more than just this test) should make bugs like this one a lot more rare. I've had good experiences using it over the last few months, if that counts for anything.
Fair enough. It appears that we do not explicitly mark test dependencies up to this point. setuptools seems to support test dependencies, which would be installed when running python setup.py develop but not python setup.py install. We should probably add this to each project's setup.py.
@twizmwazin Do you want to take care of that or should I? I'd like to get this fix merged
I'll add the dependency to our install and rerun the tests.
You'll want to rebase your branch on top of the latest master first. Some interfaces have changed.