Ejemplo n.º 1
0
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument('objdir', type=str, help='Build folder to test.')
  parser.add_argument('test', type=str, nargs='?', default=None,
                      help="Optional test folder or test file")
  parser.add_argument('--arch', type=str, default=None,
                      help="Force testing a specific arch on dual-arch builds.")
  parser.add_argument('--show-cli', default=False, action='store_true',
                      help='Show the command-line invocation of each test.')
  parser.add_argument('--spcomp2', default=False, action='store_true',
                      help="Only test using spcomp2.")
  args = parser.parse_args()

  if args.test and args.test.startswith('tests/'):
    args.test = args.test[6:]

  plan = TestPlan(args)
  plan.find_compilers()
  plan.find_shells()
  plan.find_tests()

  if not len(plan.modes):
    raise Exception('No compiler binaries were found in {0}'.format(args.objdir))
  if not len(plan.tests):
    raise Exception('No matching tests were found.')
  if not len(plan.shells):
    raise Exception('No spshell binaries were found in {0}'.format(args.objdir))

  with testutil.TempFolder() as tempFolder:
    runner = TestRunner(plan)
    if not runner.run():
      sys.exit(1)

  # Done.
  sys.exit(0)
Ejemplo n.º 2
0
    def run(self):
        with testutil.TempFolder() as temp_folder:
            with testutil.ChangeFolder(temp_folder):
                self.run_impl()

        if len(self.failures_):
            self.print_failures()
            return False
        return True
Ejemplo n.º 3
0
    def run(self):
        with testutil.TempFolder() as temp_folder:
            with testutil.ChangeFolder(temp_folder):
                self.run_impl()

        if len(self.failures_):
            self.print_failures()
            return False

        self.out("Done. {} tests passed.".format(self.total_tests_))
        return True
Ejemplo n.º 4
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('objdir', type=str, help='Build folder to test.')
    parser.add_argument('test',
                        type=str,
                        nargs='?',
                        default=None,
                        help="Optional test folder or test file")
    parser.add_argument(
        '--arch',
        type=str,
        default=None,
        help="Force testing a specific arch on dual-arch builds.")
    parser.add_argument('--show-cli',
                        default=False,
                        action='store_true',
                        help='Show the command-line invocation of each test.')
    parser.add_argument('--spcomp2',
                        default=False,
                        action='store_true',
                        help="Only test using spcomp2.")
    parser.add_argument(
        '--compile-only',
        default=False,
        action='store_true',
        help="Skip execution on tests with runtime components.")
    parser.add_argument('--runtime-only',
                        default=False,
                        action='store_true',
                        help="Skip tests that are marked as compile-only.")
    parser.add_argument('--coverage',
                        default=None,
                        type=str,
                        help="Path to store code coverage data.")
    parser.add_argument(
        '--spcomp-arg',
        default=None,
        type=str,
        action='append',
        dest='spcomp_args',
        help="Add an extra argument to all spcomp invocations.")
    args = parser.parse_args()

    if args.test and args.test.startswith('tests/'):
        args.test = args.test[6:]

    plan = TestPlan(args)
    plan.find_compilers()
    if not args.compile_only:
        plan.find_shells()
    plan.find_tests()

    if not len(plan.modes):
        raise Exception('No compiler binaries were found in {0}'.format(
            args.objdir))
    if not len(plan.tests):
        raise Exception('No matching tests were found.')
    if not len(plan.shells) and not args.compile_only:
        raise Exception('No spshell binaries were found in {0}'.format(
            args.objdir))

    with testutil.TempFolder() as tempFolder:
        runner = TestRunner(plan)
        if not runner.run():
            sys.exit(1)

    # Done.
    sys.exit(0)