<commit_before>import os

import angr
import simuvex
import claripy as cp
import logging

test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests'))

def regression_test_memcmp_strlen_simprocedure_interaction():
    logging.getLogger('angr.manager').setLevel(logging.DEBUG)

    bin_path = os.path.join(test_location, 'i386/cpp_regression_test_ch25')
    p = angr.Project(bin_path)
    argv1 = cp.Concat(*[cp.BVS('argv%d' % i, 8) for i in range(48)])

    state = p.factory.full_init_state(args=[bin_path, argv1],
            add_options=simuvex.o.unicorn,
            remove_options={simuvex.o.LAZY_SOLVES})

    sm = p.factory.simgr(state)
    x = sm.explore(find=0x8048b9b, num_find=3)

    print x
    for s in x.found:
        solution = s.state.se.eval_one(argv1, cast_to=str)
        print solution

if __name__ == '__main__':
    regression_test_memcmp_strlen_simprocedure_interaction()<commit_msg>Fix test case regression_memcmp_definite_size. It now works under Windows. (#902)<commit_after>import os

import nose.tools

import angr
import claripy as cp

test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests'))


def regression_test_memcmp_strlen_simprocedure_interaction():
    # import logging
    # logging.getLogger('angr.manager').setLevel(logging.DEBUG)

    bin_path = os.path.join(test_location, 'i386', 'cpp_regression_test_ch25')
    p = angr.Project(bin_path, auto_load_libs=True)  # this binary requires the loading of libstdc++.so.6
    argv1 = cp.Concat(*[cp.BVS('argv%d' % i, 8) for i in range(48)])

    state = p.factory.full_init_state(args=[bin_path, argv1],
                                      add_options=angr.sim_options.unicorn
                                      )

    sm = p.factory.simgr(state)
    x = sm.explore(find=0x8048b9b, num_find=3)

    nose.tools.assert_equal(len(x.found), 1)
    for s in x.found:
        solution = s.state.se.eval_one(argv1, cast_to=str).strip("\x00")
        nose.tools.assert_equal(solution, "Here_you_have_to_understand_a_little_C++_stuffs")


if __name__ == '__main__':
    regression_test_memcmp_strlen_simprocedure_interaction()
{'fraction_non_alphanumeric': 0.12601994560290117, 'fraction_numerical': 0.019492293744333637, 'mean_word_length': 3.7057569296375266, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1361058', 'n_tokens_mistral': 825, 'n_tokens_neox': 784, 'n_words': 129}