Run linux examples in Travis (#668)

* Update makefile; add a list target for testing

* simplify nostdlib example

* Make sendmail example return success

* Add tests to run all examples

* Add some targets to exclude

* Run example scripts; temporarily add a workspace accsesor to mcore

* Optionally read end of main from argv

* Make concolic test more robust

* Clean up Makefile

* Be better with phony targets

* Add run_simple and state_control tests

* verbosity++

* Make sure we fail when we intend to

* Simplify travis_test.sh

* Remove multi_arch_sym
This commit is contained in:
Yan Ivnitskiy
2018-01-18 15:50:13 -05:00
committed by GitHub
parent 7907d0179d
commit 60d2b61fb3
7 changed files with 121 additions and 103 deletions
+9 -2
View File
@@ -13,6 +13,7 @@ Bugs
'''
import sys
import Queue
import struct
import itertools
@@ -27,7 +28,7 @@ import copy
from manticore.core.smtlib.expression import *
prog = '../linux/simpleassert'
endd = 0x400ae9
main_end = 0x400ae9
VERBOSITY = 0
def _partition(pred, iterable):
@@ -163,7 +164,7 @@ def symbolic_run_get_cons(trace):
m2.verbosity(VERBOSITY)
m2.register_plugin(f)
@m2.hook(endd)
@m2.hook(main_end)
def x(s):
with m2.locked_context() as ctx:
readdata = []
@@ -250,6 +251,12 @@ def concrete_input_to_constraints(ci, prev=None):
def main():
global main_end
# Read the address of main's `ret` from cmdline if we're passed it. Used for testing.
if len(sys.argv) > 1:
main_end = int(sys.argv[1], 0)
log("Got end of main: {:x}".format(main_end))
q = Queue.Queue()
-36
View File
@@ -1,36 +0,0 @@
#!/usr/bin/env python
import sys
from manticore import Manticore
'''
Minimal example demonstrating setting execution hooks, the ability to target
multiple target architectures, and symbolicating memory.
'''
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage: {} [binary] [arguments]".format(sys.argv[0])
sys.exit(1)
# Create a new Manticore object
m = Manticore(sys.argv[1], sys.argv[2:])
m.verbosity = 2
if m.arch == 'arm':
target = (0x1082c, 'R4')
else:
target = (0x400a83, 'EBX')
@m.hook(target[0])
def entered_func(state):
'''
For ARM, Make R4 symbolic at 0x1082c, as r4 is used in a branch right
after.
'''
sym_var = state.new_symbolic_value(32, label='from_callback')
state.cpu.write_register(target[1], sym_var)
m.run()