コード例 #1
0
def run_translation(path):
    reset_env()

    status = True

    if "-boolean" in path:
        boolean = True
    else:
        boolean = False

    models = list([x for x in list(os.walk(path))
                   if COSADIR not in x[0]])[-1][-1]

    j_files = [
        "%s/%s" % (path, f) for f in models if f.split(".")[1] == "json"
    ]
    s_files = [
        "%s/%s" % (path, f) for f in models
        if f.split(".")[1] in ["sts", "ets"]
    ]
    v_files = [
        "%s/%s[%s]" % (path, f, f.split(".")[0]) for f in models
        if f.split(".")[1] in ["v"]
    ]

    if os.path.isfile("%s/assumptions.txt" % path):
        assumptions = "%s/assumptions.txt" % path
    else:
        assumptions = None

    if os.path.isfile("%s/properties.txt" % path):
        properties = "%s/properties.txt" % path
    else:
        properties = None

    if os.path.isfile("%s/lemmas.txt" % path):
        lemmas = "%s/lemmas.txt" % path
    else:
        lemmas = None

    problems_manager = cosa_option_manager.get_default_problem_manager(
        verbosity=3,
        boolean=boolean,
        translate=path + GENERATED,
        printer='SMV',
        model_files=",".join(j_files + s_files + v_files))

    problems_manager.add_problem(
        solver_name='msat',
        verification='safety' if properties is not None else "simulation",
        prove=True if properties is not None else False,
        assumptions=assumptions,
        properties=properties,
        lemmas=lemmas)
    run_problems(problems_manager)

    # status = files_eq(path+EXPECTED, path+GENERATED)
    # assert status
    return status
コード例 #2
0
ファイル: test_correctness.py プロジェクト: danny-boby/CoSA
def runtest(example):
    reset_env()

    config = Config()

    config.safety = True
    config.verbosity = 3
    config.solver_name = "msat"
    config.prove = True
    config.vcd = True
    config.force_expected = True

    status = run_problems("%s/problem.txt" % example, config)

    assert status == 0
    return status
コード例 #3
0
def runtest(problem_file):
    reset_env()

    config = Config()

    config.safety = True
    config.verbosity = 2
    config.solver_name = "msat"
    config.prove = True
    config.vcd = True
    config.force_expected = True
    config.translate = "file.ssts"

    status = run_problems(problem_file, config)
    with open(config.translate, "r") as f:
        print(f.read())

    assert status == 0
    return status
コード例 #4
0
def runtest(problem_file):
    reset_env()
    translate_file = 'file.ssts'
    problems_manager = cosa_option_manager.read_problem_file(
        problem_file,
        verbosity=2,
        solver_name='msat',
        prove=True,
        vcd=True,
        translate=translate_file)

    # run option handling code then freeze problem manager
    # TODO: Update this to make a better API
    # problems_manager modified in place
    cosa_option_manager._option_handling(problems_manager)
    problems_manager.freeze()

    status = run_problems(problems_manager)
    with open(translate_file, "r") as f:
        print(f.read())

    assert status == 0
    return status