tests/run-tests.py
changeset 38222 507bdc40bb17
parent 37741 700aaa19de63
child 38223 b865bba56db1
equal deleted inserted replaced
38221:ee1f052b45ef 38222:507bdc40bb17
  2644                 expanded_args.extend([arg + a for a in os.listdir(arg)])
  2644                 expanded_args.extend([arg + a for a in os.listdir(arg)])
  2645             else:
  2645             else:
  2646                 expanded_args.append(arg)
  2646                 expanded_args.append(arg)
  2647         args = expanded_args
  2647         args = expanded_args
  2648 
  2648 
       
  2649         testcasepattern = re.compile(r'([\w-]+\.t|py)( \(case ([\w-])+\))')
  2649         tests = []
  2650         tests = []
  2650         for t in args:
  2651         for t in args:
       
  2652             case = None
       
  2653 
  2651             if not (os.path.basename(t).startswith(b'test-')
  2654             if not (os.path.basename(t).startswith(b'test-')
  2652                     and (t.endswith(b'.py') or t.endswith(b'.t'))):
  2655                     and (t.endswith(b'.py') or t.endswith(b'.t'))):
  2653                 continue
  2656 
       
  2657                 m = testcasepattern.match(t)
       
  2658                 if m is not None:
       
  2659                     t, _, case = m.groups()
       
  2660                 else:
       
  2661                     continue
       
  2662 
  2654             if t.endswith(b'.t'):
  2663             if t.endswith(b'.t'):
  2655                 # .t file may contain multiple test cases
  2664                 # .t file may contain multiple test cases
  2656                 cases = sorted(parsettestcases(t))
  2665                 cases = sorted(parsettestcases(t))
  2657                 if cases:
  2666                 if cases:
  2658                     tests += [{'path': t, 'case': c} for c in sorted(cases)]
  2667                     if case is not None and case in cases:
       
  2668                         tests += [{'path': t, 'case': case}]
       
  2669                     elif case is not None and case not in cases:
       
  2670                         # Ignore invalid cases
       
  2671                         pass
       
  2672                     else:
       
  2673                         tests += [{'path': t, 'case': c} for c in sorted(cases)]
  2659                 else:
  2674                 else:
  2660                     tests.append({'path': t})
  2675                     tests.append({'path': t})
  2661             else:
  2676             else:
  2662                 tests.append({'path': t})
  2677                 tests.append({'path': t})
  2663         return tests
  2678         return tests