• Home
  • Raw
  • Download

Lines Matching +full:to +full:- +full:regex +full:- +full:range

31 LOG_PREFIX = r'[0-9]+:[0-9]+:[0-9]+ (?:load avg: [0-9]+\.[0-9]{2} )?'
59 for opt in '-h', '--help':
67 ns = libregrtest._parse_args(['--timeout', '4.2'])
69 self.checkError(['--timeout'], 'expected one argument')
70 self.checkError(['--timeout', 'foo'], 'invalid float value')
73 ns = libregrtest._parse_args(['--wait'])
77 ns = libregrtest._parse_args(['--worker-args', '[[], {}]'])
79 self.checkError(['--worker-args'], 'expected one argument')
82 for opt in '-S', '--start':
89 ns = libregrtest._parse_args(['-v'])
91 ns = libregrtest._parse_args(['-vvv'])
93 ns = libregrtest._parse_args(['--verbose'])
95 ns = libregrtest._parse_args(['--verbose'] * 3)
101 for opt in '-w', '--verbose2':
107 for opt in '-W', '--verbose3':
113 for opt in '-q', '--quiet':
120 for opt in '-o', '--slowest':
126 ns = libregrtest._parse_args(['--header'])
129 ns = libregrtest._parse_args(['--verbose'])
133 for opt in '-r', '--randomize':
139 ns = libregrtest._parse_args(['--randseed', '12345'])
142 self.checkError(['--randseed'], 'expected one argument')
143 self.checkError(['--randseed', 'foo'], 'invalid int value')
146 for opt in '-f', '--fromfile':
151 self.checkError([opt, 'foo', '-s'], "don't go together")
154 for opt in '-x', '--exclude':
160 for opt in '-s', '--single':
164 self.checkError([opt, '-f', 'foo'], "don't go together")
167 for opt in '-i', '--ignore':
179 ns = libregrtest._parse_args(['-m', 'match',
180 '--ignorefile', filename])
185 for opt in '-m', '--match':
191 ns = libregrtest._parse_args(['-m', 'pattern1',
192 '-m', 'pattern2'])
201 ns = libregrtest._parse_args(['-m', 'match',
202 '--matchfile', filename])
207 for opt in '-G', '--failfast':
209 ns = libregrtest._parse_args([opt, '-v'])
211 ns = libregrtest._parse_args([opt, '-W'])
213 self.checkError([opt], '-G/--failfast needs either -v or -W')
216 for opt in '-u', '--use':
226 ns = libregrtest._parse_args([opt, 'all,-gui'])
241 for opt in '-M', '--memlimit':
248 ns = libregrtest._parse_args(['--testdir', 'foo'])
250 self.checkError(['--testdir'], 'expected one argument')
253 for opt in '-L', '--runleaks':
259 for opt in '-R', '--huntrleaks':
271 'needs 2 or 3 colon-separated arguments')
276 for opt in '-j', '--multiprocess':
282 self.checkError([opt, '2', '-T'], "don't go together")
283 self.checkError([opt, '0', '-T'], "don't go together")
286 for opt in '-T', '--coverage':
292 for opt in '-D', '--coverdir':
300 for opt in '-N', '--nocoverdir':
306 for opt in '-t', '--threshold':
314 for opt in '-n', '--nowindows':
320 self.assertIn('the --nowindows (-n) option is deprecated', err)
323 for opt in '-F', '--forever':
329 self.checkError(['--xxx'], 'usage:')
332 ns = libregrtest._parse_args(['--qui'])
337 ns = libregrtest._parse_args(['--quiet', '--exclude'])
343 ns = libregrtest._parse_args(['--start', ''])
351 ns = libregrtest._parse_args(['--quiet', 'foo'])
357 ns = libregrtest._parse_args(['test_unaryop', '-v', 'test_binop'])
362 self.checkError(['--unknown-option'],
363 'unrecognized arguments: --unknown-option')
369 TESTNAME_REGEX = r'test_[a-zA-Z0-9_]+'
397 # Use 'x' mode to ensure that we do not override existing tests
399 with open(path, 'x', encoding='utf-8') as fp:
407 def regex_search(self, regex, output): argument
408 match = re.search(regex, output, re.MULTILINE)
410 self.fail("%r not found in %r" % (regex, output))
413 def check_line(self, output, regex): argument
414 regex = re.compile(r'^' + regex, re.MULTILINE)
415 self.assertRegex(output, regex)
418 regex = (r'^%s\[ *[0-9]+(?:/ *[0-9]+)*\] (%s)'
420 parser = re.finditer(regex, output, re.MULTILINE)
453 regex = line_format % (count, plural(count))
454 regex = r'%s:\n %s$' % (regex, names)
455 return regex
458 regex = list_regex('%s test%s skipped', skipped)
459 self.check_line(output, regex)
462 regex = list_regex('%s test%s failed', failed)
463 self.check_line(output, regex)
466 regex = list_regex('%s test%s altered the execution environment',
468 self.check_line(output, regex)
471 regex = list_regex('%s test%s omitted', omitted)
472 self.check_line(output, regex)
475 regex = list_regex('%s re-run test%s', rerun.keys())
476 self.check_line(output, regex)
477 regex = LOG_PREFIX + r"Re-running failed tests in verbose mode"
478 self.check_line(output, regex)
480 regex = LOG_PREFIX + f"Re-running {name} in verbose mode \\(matching: {match}\\)"
481 self.check_line(output, regex)
484 regex = list_regex('%s test%s run no tests', no_test_ran)
485 self.check_line(output, regex)
487 good = (len(tests) - len(skipped) - len(failed)
488 - len(omitted) - len(env_changed) - len(no_test_ran))
490 regex = r'%s test%s OK\.$' % (good, plural(good))
492 regex = 'All %s' % regex
493 self.check_line(output, regex)
518 match = self.regex_search(r'Using random seed ([0-9]+)', output)
537 "---\n"
539 "---\n"
544 "---\n"
546 "---\n"
552 args = [sys.executable, '-X', 'faulthandler', '-I', *args]
560 Check that regrtest appears to find the expected set of tests.
562 args = ['-Wd', '-E', '-bb', '-m', 'test.regrtest', '--list-tests']
568 # We're not trying to duplicate test finding logic in here,
570 # be near that. This is a regression test to prevent mishaps
572 # If you need to change the values in here during some
583 Test various ways to run the Python test suite. Use options close
584 to options used on the buildbot.
593 self.tests = [self.create_test() for index in range(self.NTEST)]
595 self.python_args = ['-Wd', '-E', '-bb']
596 self.regrtest_args = ['-uall', '-rwW',
597 '--testdir=%s' % self.tmptestdir]
598 self.regrtest_args.extend(('--timeout', '3600', '-j4'))
600 self.regrtest_args.append('-n')
618 # -m test
619 args = [*self.python_args, '-m', 'test',
624 # -m test.regrtest
625 args = [*self.python_args, '-m', 'test.regrtest',
630 # -m test.autotest
631 args = [*self.python_args, '-m', 'test.autotest',
638 args = [*self.python_args, '-c', code,
666 test_args = ['--testdir=%s' % self.tmptestdir]
668 test_args.append('-arm64') # ARM 64-bit build
670 test_args.append('-arm32') # 32-bit ARM build
672 test_args.append('-x64') # 64-bit build
683 rt_args = ["-q"] # Quick, don't run tests twice
685 rt_args.append('-arm64') # ARM 64-bit build
687 rt_args.append('-arm32') # 32-bit ARM build
689 rt_args.append('-x64') # 64-bit build
691 rt_args.append('-d') # Debug build, use python_d.exe
701 cmdargs = ['-m', 'test', '--testdir=%s' % self.tmptestdir, *testargs]
721 # test -u command line option
735 # -u all: 2 resources enabled
736 output = self.run_tests('-u', 'all', *test_names)
739 # -u audio: 1 resource enabled
740 output = self.run_tests('-uaudio', *test_names)
750 # test -r and --randseed command line option
757 # first run to get the output with the random seed
758 output = self.run_tests('-r', test)
760 match = self.regex_search(r'TESTRANDOM: ([0-9]+)', output)
763 # try to reproduce with the random seed
764 output = self.run_tests('-r', '--randseed=%s' % randseed, test)
768 match = self.regex_search(r'TESTRANDOM: ([0-9]+)', output)
773 # test --fromfile
774 tests = [self.create_test() for index in range(5)]
776 # Write the list of files using a format similar to regrtest output:
782 # test format '0:00:00 [2/7] test_opcodes -- test_grammar took 0 sec'
789 line += " -- %s took 0 sec" % previous
793 output = self.run_tests('--fromfile', filename)
801 output = self.run_tests('--fromfile', filename)
809 output = self.run_tests('--fromfile', filename)
817 output = self.run_tests('--fromfile', filename)
828 # test --slowest
829 tests = [self.create_test() for index in range(3)]
830 output = self.run_tests("--slowest", *tests)
832 regex = ('10 slowest tests:\n'
833 '(?:- %s: .*\n){%s}'
835 self.check_line(output, regex)
838 # Issue #25373: test --slowest with an interrupted test
845 args = ("--slowest", "-j2", test)
847 args = ("--slowest", test)
852 regex = ('10 slowest tests:\n')
853 self.check_line(output, regex)
856 # test --coverage
858 output = self.run_tests("--coverage", test)
860 regex = (r'lines +cov% +module +\(path\)\n'
861 r'(?: *[0-9]+ *[0-9]{1,2}% *[^ ]+ +\([^)]+\)+)+')
862 self.check_line(output, regex)
865 # test --wait
867 output = self.run_tests("--wait", test, input='key')
868 self.check_line(output, 'Press any key to continue')
871 # test --forever
888 output = self.run_tests('--forever', test, exitcode=2)
896 output = self.run_tests('--huntrleaks', '3:3:', test,
913 # test --huntrleaks
927 # test --huntrleaks for file descriptor leak
940 # test --list-tests
941 tests = [self.create_test() for i in range(5)]
942 output = self.run_tests('--list-tests', *tests)
947 # test --list-cases
959 # Test --list-cases
962 output = self.run_tests('--list-cases', testname)
965 # Test --list-cases with --match
967 output = self.run_tests('--list-cases',
968 '-m', 'test_method1',
979 output = self.run_tests("-j2", *tests, exitcode=2)
984 regex = re.compile("^(test[^ ]+).*ok$", flags=re.MULTILINE)
985 return [match.group(1) for match in regex.finditer(output)]
1018 output = self.run_tests("-v", "--ignorefile", filename, testname)
1042 output = self.run_tests("-v", testname)
1059 output = self.run_tests("-v", "--matchfile", filename, testname)
1078 # fail with --fail-env-changed
1079 output = self.run_tests("--fail-env-changed", testname, exitcode=3)
1098 output = self.run_tests("-w", testname, exitcode=2)
1119 output = self.run_tests("-w", testname, exitcode=0)
1138 output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST)
1158 output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST)
1177 output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST)
1196 output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST)
1215 output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST)
1234 output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST)
1253 output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST)
1272 output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST)
1287 output = self.run_tests(testname, "-m", "nosuchtest", exitcode=0)
1314 output = self.run_tests(testname, testname2, "-m", "nosuchtest", exitcode=0)
1336 output = self.run_tests(testname, testname2, "-m", "nosuchtest",
1337 "-m", "test_other_bug", exitcode=0)
1362 output = self.run_tests("--fail-env-changed", testname, exitcode=3)
1379 # we want to test regrtest multiprocessing timeout,
1388 output = self.run_tests("-j2", "--timeout=1.0", testname, exitcode=2)
1395 # --fail-env-changed must catch unraisable exception.
1420 output = self.run_tests("--fail-env-changed", "-v", testname, exitcode=3)
1424 self.assertIn("Warning -- Unraisable exception", output)
1428 # --fail-env-changed must catch uncaught thread exception.
1451 output = self.run_tests("--fail-env-changed", "-v", testname, exitcode=3)
1455 self.assertIn("Warning -- Uncaught thread exception", output)
1459 # bpo-45410: The order of messages must be preserved when -W and
1476 # Fail with ENV CHANGED to see print_warning() log
1484 # Warning -- msg2: print_warning
1486 regex = (r"test_print_warning.*msg1: stdout\n"
1487 r"Warning -- msg2: print_warning\n"
1489 for option in ("-v", "-W"):
1491 cmd = ["--fail-env-changed", option, testname]
1496 self.assertRegex(output, regex)
1502 # Skip to signify that the env var value was changed by the user;
1503 # possibly to something ASCII to work around Unicode issues.
1513 cmdargs = ['-m', 'test',
1514 '--tempdir=%s' % self.tmptestdir,
1515 '--cleanup']
1526 self.assertEqual(utils.format_duration(1e-9),
1528 self.assertEqual(utils.format_duration(10e-3),