Exemplo n.º 1
0
Arquivo: aisy.py Projeto: 5nizza/aisy
            res, string = aiger_write_to_string(spec, aiger_ascii_mode, 2147483648)
            assert res != 0 or out_file_name is None, 'writing failure'
            print(string)   # print independently of logger level setup
        return True

    return False


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Simple synthesizer from AIGER GR1 format')
    parser.add_argument('aiger', metavar='aiger', type=str,
                        help='input specification in AIGER format')
    parser.add_argument('--out', '-o', metavar='out', type=str, required=False, default=None,
                        help='output file in AIGER format (if realizable)')
    parser.add_argument('--full', action='store_true', default=False,
                        help='produce a full circuit that has outputs other than error bit')
    parser.add_argument('--realizability', '-r', action='store_true', default=False,
                        help='Check Realizability only (do not produce circuits)')
    parser.add_argument('--quiet', '-q', action='store_true', default=False,
                        help='Do not print anything but the model (if realizable)')

    args = parser.parse_args()

    logger = setup_logging(-1 if args.quiet else 0)

    is_realizable = main(args.aiger, args.out, args.full, args.realizability)

    logger.info(['unrealizable', 'realizable'][is_realizable])

    exit([EXIT_STATUS_UNREALIZABLE, EXIT_STATUS_REALIZABLE][is_realizable])
Exemplo n.º 2
0
    parser = argparse.ArgumentParser(description='Functional tests runner')

    parser.add_argument('--mc',
                        action='store_true',
                        required=False,
                        default=False,
                        help='model check the result (default: not set)')
    parser.add_argument('-a',
                        '--args',
                        required=False,
                        default='',
                        help='arguments to pass to the tool. '
                             'Enclose the arguments in "".')

    parser.add_argument('-v', '--verbose', action='count', default=0)

    args = parser.parse_args()

    tests_dir = os.path.dirname(os.path.abspath(__file__))
    test_files = find_files(tests_dir + '/aag-files/', extension='aag')

    logger = setup_logging(args.verbose)

    failed_tests = run_tests(test_files,
                             lambda test_file, result_file: run_tool(test_file, result_file, args.args),
                             [check_answer, check_answer_with_mc][args.mc],
                             True,
                             logger)

    exit(len(failed_tests))
Exemplo n.º 3
0
Arquivo: reu.py Projeto: 5nizza/bene
                                                 "Care: existing tables of the same name may be xxx.",
                                     formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--tool',        required=True, help='your tool executable')
    parser.add_argument('--tool_params', required=False, help='parameters for your tool (excl. input and output files)')
    parser.add_argument('--input_file',  required=True, help='input file to the tool')
    parser.add_argument('--output_file', required=False, default=None, help='output file for the tool')
    parser.add_argument('--exec_log',    required=True, help='file name to store my execution logs')
    parser.add_argument('--tool_log',    required=True, help="file name to store your tool' logs")
    parser.add_argument('--exp_name',    required=True, help="name the experiment run")
    parser.add_argument('--commit',      required=True, help='tool version')
    parser.add_argument('--time_limit_sec',  required=True, type=int)
    parser.add_argument('--memory_limit_mb', required=True, type=int)
    parser.add_argument('--hardware',    required=True)
    args = parser.parse_args()

    setup_logging(filename=args.exec_log)

    logging.info(args)

    set_exc_hook()

    exp_desc = ExpDesc(args.exp_name, datetime.datetime.now(), args.commit, args.hardware, None)

    timed_run_params = TimedRunParams(args.time_limit_sec, args.memory_limit_mb)

    tool_run_params = ToolRunParams(args.tool, args.tool_params,
                                    args.input_file, args.output_file,
                                    args.tool_log)

    exit(main(exp_desc, timed_run_params, tool_run_params))
Exemplo n.º 4
0
    rc, out, err = execute_shell(SPEC_FRAMEWORK_DIR + '/check_model.sh ' + tmp_file_name)

    os.remove(tmp_file_name)

    return rc, out, err


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='Functional tests runner')

    parser.add_argument('--mc', action='store_true',
                        required=False, default=False,
                        help='model check the result, default: False')

    args = parser.parse_args()

    TEST_FILES = find_files('./tests/safety/', extension='aag', ignore_mark='notest') + \
                 find_files('./tests/buechi/', extension='aag', ignore_mark='notest') + \
                 find_files('./tests/syntcomp-format/', extension='aag', ignore_mark='notest') + \
                 find_files('./tests/1-streett/', extension='aag', ignore_mark='notest')
    RUN_TOOL = run_tool
    CHECK_RESULT = [check_answer, check_answer_with_mc][args.mc]

    logger = setup_logging()
    exit(run_tests(TEST_FILES,
                   RUN_TOOL,
                   CHECK_RESULT,
                   True,
                   logger))
Exemplo n.º 5
0
Arquivo: run.py Projeto: 5nizza/bene
    parser.add_argument('--tool', required=True, help='your tool executable')
    parser.add_argument('--tool_params', required=True, help='parameters for your tool')
    parser.add_argument('--benchmarks_list', required=True, type=argparse.FileType(),
                        help='file containing a list of benchmarks (one filepath per line)')
    parser.add_argument('--logs_dir', required=True, type=str,
                        help='directory for log files (will be created if does not exists)')
    parser.add_argument('--exp_name', required=False, help="name your experiment (if not set, will be 'exp_<datetime>'")
    parser.add_argument('--commit', required=True, help='version of the tool')
    parser.add_argument('--time_limit_sec', required=False, default=10, type=int, help='(default: %(default)i)')
    parser.add_argument('--memory_limit_mb', required=False, default=10000, type=int, help='(default: %(default)i)')
    parser.add_argument('--hardware', required=True, help='hardware on which you run')
    # TODO: default logs folder created from exp_name + salt?
    # TODO: default commit/hardware
    # TODO: None for time/memory limits

    args = parser.parse_args()

    benchmarks = [b for b in args.benchmarks_list.read().splitlines()  # this avoids newlines (vs. readlines())
                  if b.strip()]

    setup_logging()
    logging.info(args)

    exit(main(args.tool, args.tool_params,
              benchmarks,
              os.path.abspath(args.logs_dir),
              args.exp_name or 'exp {datetime}'.format(datetime=str(datetime.datetime.now())),
              args.commit,
              args.time_limit_sec, args.memory_limit_mb,
              args.hardware))