def Main():
    parser = optparse.OptionParser()
    parser.add_option('--download-only',
                      dest='download_only',
                      default=False,
                      action='store_true',
                      help='download to cache without running the tests')
    parser.add_option('-k',
                      '--keep-going',
                      dest='keep_going',
                      default=False,
                      action='store_true',
                      help='keep going on failure')
    parser.add_option('--validator',
                      dest='validator',
                      help='location of validator executable')
    parser.add_option('--arch',
                      dest='architecture',
                      help='architecture of validator')
    parser.add_option('--warn-only',
                      dest='warn_only',
                      default=False,
                      action='store_true',
                      help='only warn on failure')
    parser.add_option('-v',
                      '--verbose',
                      dest='verbose',
                      default=False,
                      action='store_true',
                      help='run in verbose mode')
    parser.add_option('--cache-dir',
                      dest='cache_dir',
                      default=corpus_utils.DefaultCacheDirectory(),
                      help='directory to cache downloads in')
    options, args = parser.parse_args()
    if args:
        parser.error('unused arguments')
    if not options.download_only:
        if not options.validator:
            parser.error('no validator specified')
        if not options.architecture:
            parser.error('no architecture specified')

    work_dir = tempfile.mkdtemp(suffix='validate_nexes', prefix='tmp')
    try:
        TestValidators(options, work_dir)
    finally:
        pynacl.file_tools.RemoveDir(work_dir)
def Main():
    # TODO(bradnelson): Stderr scraping doesn't work on windows, find another
    # way if we want to run there.
    if sys.platform in ['cygwin', 'win32']:
        raise Exception('Platform not yet supported')

    parser = optparse.OptionParser()
    parser.add_option('--download-only',
                      dest='download_only',
                      default=False,
                      action='store_true',
                      help='download to cache without running the tests')
    parser.add_option('--duration',
                      dest='duration',
                      default=30,
                      help='how long to run each app for')
    parser.add_option('--browser', dest='browser', help='browser to run')
    parser.add_option('-v',
                      '--verbose',
                      dest='verbose',
                      default=False,
                      action='store_true',
                      help='run in verbose mode')
    parser.add_option('--bad-only',
                      dest='bad_only',
                      default=False,
                      action='store_true',
                      help='test only known bad apps')
    parser.add_option('--cache-dir',
                      dest='cache_dir',
                      default=corpus_utils.DefaultCacheDirectory(),
                      help='directory to cache downloads in')
    options, args = parser.parse_args()
    if args:
        parser.error('unused arguments')
    if not options.download_only:
        if not options.browser:
            parser.error('no browser specified')

    work_dir = tempfile.mkdtemp(suffix='startup_crxs', prefix='tmp')
    work_dir = os.path.realpath(work_dir)
    try:
        TestApps(options, work_dir)
    finally:
        pynacl.file_tools.RemoveDirectoryIfPresent(work_dir)