A simple command-line interface for the cgroups check of BenchExec.

def main(argv=None):
    """
    A simple command-line interface for the cgroups check of BenchExec.
    """
    if argv is None:
        argv = sys.argv

    parser = argparse.ArgumentParser(
        fromfile_prefix_chars='@',
        description=
        """Check whether cgroups are available and can be used for BenchExec.
           Part of BenchExec: https://github.com/sosy-lab/benchexec/""")
    parser.add_argument("--wait", type=int, default=1, metavar="SECONDS",
                        help='wait some time to ensure no process interferes with cgroups in the meantime (default: 1s)')
    parser.add_argument("--no-thread", action="store_true",
                        help='run check on the main thread instead of a separate thread'
                            + '(behavior of cgrulesengd differs depending on this)')

    options = parser.parse_args(argv[1:])

    if options.no_thread:
        check_cgroup_availability(options.wait)
    else:
        check_cgroup_availability_in_thread(options)