def main(): test_cases = list_delegation_tests(FIXTURE_ROOT) # Generate the 'constraint-solving-without-injection' tests. # These replace the TargetSolverNoInjection tests we used to have in test.py. constraint_solved_tests = { "eq": { #"Concolic::Solver::ErrorsReadingSolution": "0", # Error by default, don't neet to test explicitly. #"Concolic::Solver::ConstraintsSolvedAsUNSAT": "0", # Error by default, don't neet to test explicitly. #"Concolic::Solver::ConstraintsNotSolved": "0", # Error by default, don't neet to test explicitly. "Concolic::Solver::ConstraintsSolved": "1" } } for t in test_cases: test_name = 'test_constraint-solving-without-injection_%s' % t['name'] file_name = "%s%s" % (FIXTURE_ROOT, t['fn']) test = concolic.test_generator(_artemis_runner_no_injections, file_name, test_name, test_dict=constraint_solved_tests, internal_test=None) setattr(EventDelegation, test_name, test) # Generate the tests which check for the assertions included in the test suite. for t in test_cases: test_name = 'test_%s' % t['name'] file_name = "%s%s" % (FIXTURE_ROOT, t['fn']) test = concolic.test_generator(_artemis_runner_full, file_name, test_name, test_dict=t['test'], internal_test=t['i_test']) if t['expected_failure']: test = unittest.expectedFailure(test) setattr(EventDelegation, test_name, test) unittest.main(buffer=True, catchbreak=True)
def setup_concolic_tests(): for t in list_tests_in_folder(FIXTURE_ROOT): test_name = 'test_%s' % t['fn'].replace(".", "_") file_name = "%s%s" % (FIXTURE_ROOT, t['fn']) test = test_generator(_artemis_runner, file_name, test_name, test_dict=t['test'], internal_test=t['i_test']) if t['expected_failure']: test = unittest.expectedFailure(test) setattr(ConcolicReordering, test_name, test)
import os import unittest import concolic # This suite re-uses some of the concolic test harness infrastructure. from harness.artemis import execute_artemis VISIBILITY_FIXTURE_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'fixtures/visibility/') class Visibility(unittest.TestCase): pass def _visibility_artemis_runner(name, path): return execute_artemis(name, path, iterations=1, event_visibility_check=True, verbose=True) if __name__ == '__main__': for t in concolic.list_tests_in_folder(VISIBILITY_FIXTURE_ROOT): test_name = 'test_%s' % t['fn'].replace(".", "_") file_name = "%s%s" % (VISIBILITY_FIXTURE_ROOT, t['fn']) test = concolic.test_generator(_visibility_artemis_runner, file_name, test_name, test_dict=t['test'], internal_test=t['i_test']) if t['expected_failure']: test = unittest.expectedFailure(test) setattr(Visibility, test_name, test) unittest.main(buffer=True, catchbreak=True)