Skip to content

Commit 22d0698

Browse files
committed
Adds test.support.PGO and skips tests that are not useful for PGO.
1 parent a571120 commit 22d0698

11 files changed

Lines changed: 39 additions & 5 deletions

Lib/test/libregrtest/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ def _main(self, tests, kwargs):
473473
if self.ns.wait:
474474
input("Press any key to continue...")
475475

476+
support.PGO = self.ns.pgo
477+
476478
setup_tests(self.ns)
477479

478480
self.find_tests(tests)

Lib/test/support/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"check_warnings", "check_no_resource_warning", "EnvironmentVarGuard",
106106
"run_with_locale", "swap_item",
107107
"swap_attr", "Matcher", "set_memlimit", "SuppressCrashReport", "sortdict",
108-
"run_with_tz",
108+
"run_with_tz", "PGO",
109109
]
110110

111111
class Error(Exception):
@@ -878,6 +878,10 @@ def dec(*args, **kwargs):
878878
# Save the initial cwd
879879
SAVEDCWD = os.getcwd()
880880

881+
# Set by libregrtest/main.py so we can skip tests that are not
882+
# useful for PGO
883+
PGO = False
884+
881885
@contextlib.contextmanager
882886
def temp_dir(path=None, quiet=False):
883887
"""Return a context manager that creates a temporary directory.

Lib/test/test_asyncore.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
from test import support
1212
from io import BytesIO
1313

14+
if support.PGO:
15+
raise unittest.SkipTest("test is not helpful for PGO")
16+
1417
try:
1518
import threading
1619
except ImportError:

Lib/test/test_gdb.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def gdb_has_frame_select():
110110

111111
BREAKPOINT_FN='builtin_id'
112112

113+
@support.skipIf(support.PGO, "not useful for PGO")
113114
class DebuggerTests(unittest.TestCase):
114115

115116
"""Test that the debugger can debug Python."""

Lib/test/test_multiprocessing_fork.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import unittest
22
import test._test_multiprocessing
33

4+
from test import support
5+
6+
if support.PGO:
7+
raise unittest.SkipTest("test is not helpful for PGO")
8+
9+
410
test._test_multiprocessing.install_tests_in_module_dict(globals(), 'fork')
511

612
if __name__ == '__main__':

Lib/test/test_multiprocessing_forkserver.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import unittest
22
import test._test_multiprocessing
33

4+
from test import support
5+
6+
if support.PGO:
7+
raise unittest.SkipTest("test is not helpful for PGO")
8+
49
test._test_multiprocessing.install_tests_in_module_dict(globals(), 'forkserver')
510

611
if __name__ == '__main__':

Lib/test/test_multiprocessing_main_handling.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
make_pkg, make_script, make_zip_pkg, make_zip_script,
1717
assert_python_ok)
1818

19+
if support.PGO:
20+
raise unittest.SkipTest("test is not helpful for PGO")
21+
1922
# Look up which start methods are available to test
2023
import multiprocessing
2124
AVAILABLE_START_METHODS = set(multiprocessing.get_all_start_methods())

Lib/test/test_multiprocessing_spawn.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import unittest
22
import test._test_multiprocessing
33

4+
from test import support
5+
6+
if support.PGO:
7+
raise unittest.SkipTest("test is not helpful for PGO")
8+
49
test._test_multiprocessing.install_tests_in_module_dict(globals(), 'spawn')
510

611
if __name__ == '__main__':

Lib/test/test_subprocess.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
except ImportError:
2222
threading = None
2323

24+
if support.PGO:
25+
raise unittest.SkipTest("test is not helpful for PGO")
26+
2427
mswindows = (sys.platform == "win32")
2528

2629
#

Makefile.pre.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ TCLTK_LIBS= @TCLTK_LIBS@
235235
# The task to run while instrumented when building the profile-opt target.
236236
# We exclude unittests with -x that take a rediculious amount of time to
237237
# run in the instrumented training build or do not provide much value.
238-
PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_subprocess
238+
PROFILE_TASK=-m test.regrtest --pgo
239239

240240
# report files for gcov / lcov coverage report
241241
COVERAGE_INFO= $(abs_builddir)/coverage.info

0 commit comments

Comments
 (0)