#NEWLINE# def test_mips( ) : #NEWLINE# #INDENT# MAIN_END = 4196312 #NEWLINE# INNER_LOOP = 4195996 #NEWLINE# OUTER_LOOP = 4196204 #NEWLINE# p = angr . Project ( ( location + '/mips/test_loops' ) ) #NEWLINE# output = [ ] #NEWLINE# def hook1( _ ) : #NEWLINE# #INDENT# output . append ( 1 ) #NEWLINE# #UNINDENT# def hook2( state ) : #NEWLINE# #INDENT# output . append ( 2 ) #NEWLINE# num = state . se . any_int ( state . regs . a1 ) #NEWLINE# string = ( '%d ' % num ) #NEWLINE# state . posix . files [ 1 ] . write ( state . se . BVV ( string ) , state . se . BVV ( len ( string ) , 32 ) ) #NEWLINE# #UNINDENT# p . hook ( INNER_LOOP , hook1 ) #NEWLINE# p . hook ( OUTER_LOOP , hook2 , length = 20 ) #NEWLINE# s = p . surveyors . Explorer ( start = p . factory . path ( ) , find = [ MAIN_END ] ) #NEWLINE# s . run ( ) #NEWLINE# nose . tools . assert_equal ( len ( s . found ) , 1 ) #NEWLINE# nose . tools . assert_equal ( s . found [ 0 ] . state . posix . dumps ( 1 ) , ( '' . join ( ( ( '%d ' % x ) for x in xrange ( 100 ) ) ) + '\n' ) ) #NEWLINE# nose . tools . assert_equal ( output , ( ( [ 1 ] * 100 ) + ( [ 2 ] * 100 ) ) )