Beispiel #1
0
def main(argv):
    parser = argparse.ArgumentParser()
    parser.add_argument('--server', default='', nargs='*',
                        help='list of servers to test')
    parser.add_argument('--client', default='', nargs='*',
                        help='list of clients to test')
    parser.add_argument('-F', '--features', nargs='*', default=None,
                        help='run server feature tests instead of cross language tests')
    parser.add_argument('-R', '--regex', help='test name pattern to run')
    parser.add_argument('-o', '--only-known_failures', action='store_true', dest='only_known_failures',
                        help='only execute tests that are known to fail')
    parser.add_argument('-s', '--skip-known-failures', action='store_true', dest='skip_known_failures',
                        help='do not execute tests that are known to fail')
    parser.add_argument('-r', '--retry-count', type=int,
                        default=0, help='maximum retry on failure')
    parser.add_argument('-j', '--jobs', type=int,
                        default=default_concurrenty(),
                        help='number of concurrent test executions')

    g = parser.add_argument_group(title='Advanced')
    g.add_argument('-v', '--verbose', action='store_const',
                   dest='log_level', const=logging.DEBUG, default=logging.WARNING,
                   help='show debug output for test runner')
    g.add_argument('-P', '--print-expected-failures', choices=['merge', 'overwrite'],
                   dest='print_failures',
                   help="generate expected failures based on last result and print to stdout")
    g.add_argument('-U', '--update-expected-failures', choices=['merge', 'overwrite'],
                   dest='update_failures',
                   help="generate expected failures based on last result and save to default file location")
    options = parser.parse_args(argv)

    logger = multiprocessing.log_to_stderr()
    logger.setLevel(options.log_level)

    if options.features is not None and options.client:
        print('Cannot specify both --features and --client ', file=sys.stderr)
        return 1

    # Allow multiple args separated with ',' for backward compatibility
    server_match = list(chain(*[x.split(',') for x in options.server]))
    client_match = list(chain(*[x.split(',') for x in options.client]))

    if options.update_failures or options.print_failures:
        dire = path_join(ROOT_DIR, FEATURE_DIR_RELATIVE) if options.features is not None else TEST_DIR
        res = crossrunner.generate_known_failures(
            dire, options.update_failures == 'overwrite',
            options.update_failures, options.print_failures)
    elif options.features is not None:
        features = options.features or ['.*']
        res = run_feature_tests(server_match, features, options.jobs,
                                options.skip_known_failures, options.only_known_failures,
                                options.retry_count, options.regex)
    else:
        res = run_cross_tests(server_match, client_match, options.jobs,
                              options.skip_known_failures, options.only_known_failures,
                              options.retry_count, options.regex)
    return 0 if res else 1
Beispiel #2
0
def main(argv):
    parser = argparse.ArgumentParser()
    parser.add_argument('--server', default='', nargs='*',
                        help='list of servers to test')
    parser.add_argument('--client', default='', nargs='*',
                        help='list of clients to test')
    parser.add_argument('-F', '--features', nargs='*', default=None,
                        help='run server feature tests instead of cross language tests')
    parser.add_argument('-R', '--regex', help='test name pattern to run')
    parser.add_argument('-s', '--skip-known-failures', action='store_true', dest='skip_known_failures',
                        help='do not execute tests that are known to fail')
    parser.add_argument('-r', '--retry-count', type=int,
                        default=0, help='maximum retry on failure')
    parser.add_argument('-j', '--jobs', type=int,
                        default=default_concurrenty(),
                        help='number of concurrent test executions')

    g = parser.add_argument_group(title='Advanced')
    g.add_argument('-v', '--verbose', action='store_const',
                   dest='log_level', const=logging.DEBUG, default=logging.WARNING,
                   help='show debug output for test runner')
    g.add_argument('-P', '--print-expected-failures', choices=['merge', 'overwrite'],
                   dest='print_failures',
                   help="generate expected failures based on last result and print to stdout")
    g.add_argument('-U', '--update-expected-failures', choices=['merge', 'overwrite'],
                   dest='update_failures',
                   help="generate expected failures based on last result and save to default file location")
    options = parser.parse_args(argv)

    logger = multiprocessing.log_to_stderr()
    logger.setLevel(options.log_level)

    if options.features is not None and options.client:
        print('Cannot specify both --features and --client ', file=sys.stderr)
        return 1

    # Allow multiple args separated with ',' for backward compatibility
    server_match = list(chain(*[x.split(',') for x in options.server]))
    client_match = list(chain(*[x.split(',') for x in options.client]))

    if options.update_failures or options.print_failures:
        dire = path_join(ROOT_DIR, FEATURE_DIR_RELATIVE) if options.features is not None else TEST_DIR
        res = crossrunner.generate_known_failures(
            dire, options.update_failures == 'overwrite',
            options.update_failures, options.print_failures)
    elif options.features is not None:
        features = options.features or ['.*']
        res = run_feature_tests(server_match, features, options.jobs, options.skip_known_failures, options.retry_count, options.regex)
    else:
        res = run_cross_tests(server_match, client_match, options.jobs, options.skip_known_failures, options.retry_count, options.regex)
    return 0 if res else 1
Beispiel #3
0
def main(argv):
  parser = optparse.OptionParser()
  parser.add_option('--server', type='string', dest='servers', default='',
                    help='list of servers to test separated by commas, eg:- --server=cpp,java')
  parser.add_option('--client', type='string', dest='clients', default='',
                    help='list of clients to test separated by commas, eg:- --client=cpp,java')
  parser.add_option('-s', '--skip-known-failures', action='store_true', dest='skip_known_failures',
                    help='do not execute tests that are known to fail')
  parser.add_option('-j', '--jobs', type='int', dest='jobs',
                    default=default_concurrenty(),
                    help='number of concurrent test executions')
  g = optparse.OptionGroup(parser, 'Advanced')
  g.add_option('-v', '--verbose', action='store_const',
               dest='log_level', const=logging.DEBUG, default=logging.WARNING,
               help='show debug output for test runner')
  g.add_option('-P', '--print-expected-failures', choices=['merge', 'overwrite'],
               dest='print_failures', default=None,
               help="generate expected failures based on last result and print to stdout")
  g.add_option('-U', '--update-expected-failures', choices=['merge', 'overwrite'],
               dest='update_failures', default=None,
               help="generate expected failures based on last result and save to default file location")
  g.add_option('--prepare', action='store_true',
               dest='prepare',
               help="try to prepare files needed for cross test (experimental)")
  parser.add_option_group(g)
  logger = multiprocessing.log_to_stderr()
  options, _ = parser.parse_args(argv)
  server_match = options.servers.split(',') if options.servers else []
  client_match = options.clients.split(',') if options.clients else []
  logger.setLevel(options.log_level)

  if options.prepare:
    res = prepare(server_match, client_match)
  elif options.update_failures or options.print_failures:
    res = crossrunner.generate_known_failures(
        TEST_DIR, options.update_failures == 'overwrite',
        options.update_failures, options.print_failures)
  else:
    res = run_tests(server_match, client_match, options.jobs, options.skip_known_failures)
  return 0 if res else 1
def main(argv):
    parser = argparse.ArgumentParser()
    parser.add_argument("--server", default="", nargs="*", help="list of servers to test")
    parser.add_argument("--client", default="", nargs="*", help="list of clients to test")
    parser.add_argument(
        "-F", "--features", nargs="*", default=None, help="run server feature tests instead of cross language tests"
    )
    parser.add_argument("-R", "--regex", help="test name pattern to run")
    parser.add_argument(
        "-s",
        "--skip-known-failures",
        action="store_true",
        dest="skip_known_failures",
        help="do not execute tests that are known to fail",
    )
    parser.add_argument("-r", "--retry-count", type=int, default=0, help="maximum retry on failure")
    parser.add_argument(
        "-j", "--jobs", type=int, default=default_concurrenty(), help="number of concurrent test executions"
    )

    g = parser.add_argument_group(title="Advanced")
    g.add_argument(
        "-v",
        "--verbose",
        action="store_const",
        dest="log_level",
        const=logging.DEBUG,
        default=logging.WARNING,
        help="show debug output for test runner",
    )
    g.add_argument(
        "-P",
        "--print-expected-failures",
        choices=["merge", "overwrite"],
        dest="print_failures",
        help="generate expected failures based on last result and print to stdout",
    )
    g.add_argument(
        "-U",
        "--update-expected-failures",
        choices=["merge", "overwrite"],
        dest="update_failures",
        help="generate expected failures based on last result and save to default file location",
    )
    options = parser.parse_args(argv)

    logger = multiprocessing.log_to_stderr()
    logger.setLevel(options.log_level)

    if options.features is not None and options.client:
        print("Cannot specify both --features and --client ", file=sys.stderr)
        return 1

    # Allow multiple args separated with ',' for backward compatibility
    server_match = list(chain(*[x.split(",") for x in options.server]))
    client_match = list(chain(*[x.split(",") for x in options.client]))

    if options.update_failures or options.print_failures:
        dire = path_join(ROOT_DIR, FEATURE_DIR_RELATIVE) if options.features is not None else TEST_DIR
        res = crossrunner.generate_known_failures(
            dire, options.update_failures == "overwrite", options.update_failures, options.print_failures
        )
    elif options.features is not None:
        features = options.features or [".*"]
        res = run_feature_tests(
            server_match, features, options.jobs, options.skip_known_failures, options.retry_count, options.regex
        )
    else:
        res = run_cross_tests(
            server_match, client_match, options.jobs, options.skip_known_failures, options.retry_count, options.regex
        )
    return 0 if res else 1
Beispiel #5
0
def main(argv):
    parser = optparse.OptionParser()
    parser.add_option(
        '--server',
        type='string',
        dest='servers',
        default='',
        help=
        'list of servers to test separated by commas, eg:- --server=cpp,java')
    parser.add_option(
        '--client',
        type='string',
        dest='clients',
        default='',
        help=
        'list of clients to test separated by commas, eg:- --client=cpp,java')
    parser.add_option('-s',
                      '--skip-known-failures',
                      action='store_true',
                      dest='skip_known_failures',
                      help='do not execute tests that are known to fail')
    parser.add_option('-j',
                      '--jobs',
                      type='int',
                      dest='jobs',
                      default=default_concurrenty(),
                      help='number of concurrent test executions')
    g = optparse.OptionGroup(parser, 'Advanced')
    g.add_option('-v',
                 '--verbose',
                 action='store_const',
                 dest='log_level',
                 const=logging.DEBUG,
                 default=logging.WARNING,
                 help='show debug output for test runner')
    g.add_option(
        '-P',
        '--print-expected-failures',
        choices=['merge', 'overwrite'],
        dest='print_failures',
        default=None,
        help=
        "generate expected failures based on last result and print to stdout")
    g.add_option(
        '-U',
        '--update-expected-failures',
        choices=['merge', 'overwrite'],
        dest='update_failures',
        default=None,
        help=
        "generate expected failures based on last result and save to default file location"
    )
    g.add_option(
        '--prepare',
        action='store_true',
        dest='prepare',
        help="try to prepare files needed for cross test (experimental)")
    parser.add_option_group(g)
    logger = multiprocessing.log_to_stderr()
    options, _ = parser.parse_args(argv)
    server_match = options.servers.split(',') if options.servers else []
    client_match = options.clients.split(',') if options.clients else []
    logger.setLevel(options.log_level)

    if options.prepare:
        res = prepare(server_match, client_match)
    elif options.update_failures or options.print_failures:
        res = crossrunner.generate_known_failures(
            TEST_DIR, options.update_failures == 'overwrite',
            options.update_failures, options.print_failures)
    else:
        res = run_tests(server_match, client_match, options.jobs,
                        options.skip_known_failures)
    return 0 if res else 1