Implement state.generate_testcase (#438)

* ran

* Some dirty work

* Rm unnecessary sanitization

* Fix state.generate_inputs event publishing

We don't need to manually pass `self` because State is automatically
forwarded as an argument. Also correctly specify a message for the state
and expose to the API

* Rename

* Update test for new save_testcase args, make test more robust

* Simplify arguments related to generate_testcase_callback by removing default arg. Add test for this behavior

* Minor test fixup

* Add official API docs

* Remove unnecessary new event type
This commit is contained in:
Mark Mossberg
2017-08-08 18:12:55 -04:00
committed by GitHub
parent 9ae76a4430
commit eef3cd20e2
7 changed files with 34 additions and 12 deletions

View File

@@ -86,8 +86,18 @@ class StateTest(unittest.TestCase):
def test_output(self):
out = ManticoreOutput('mem:')
out.save_testcase(self.state, 'saving state')
keys = [x[14:] for x in out._store._data.keys()]
name = 'mytest'
message = 'custom message'
out.save_testcase(self.state, name, message)
workspace = out._store._data
# Make sure names are constructed correctly
for name, data in workspace.items():
self.assertTrue(name.startswith(name))
if 'messages' in name:
self.assertTrue(message in data)
keys = [x.split('.')[1] for x in workspace.keys()]
# Make sure we log everything we should be logging
self.assertIn('smt', keys)