From 22d0698d3b034f4f4314aa793da7225a5da640ba Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 6 Sep 2016 19:38:15 -0700 Subject: Adds test.support.PGO and skips tests that are not useful for PGO. --- Lib/test/libregrtest/main.py | 2 ++ Lib/test/support/__init__.py | 6 +++++- Lib/test/test_asyncore.py | 3 +++ Lib/test/test_gdb.py | 1 + Lib/test/test_multiprocessing_fork.py | 6 ++++++ Lib/test/test_multiprocessing_forkserver.py | 5 +++++ Lib/test/test_multiprocessing_main_handling.py | 3 +++ Lib/test/test_multiprocessing_spawn.py | 5 +++++ Lib/test/test_subprocess.py | 3 +++ Makefile.pre.in | 2 +- Tools/msi/buildrelease.bat | 8 +++++--- 11 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py index ba9e48b..dbbf72f 100644 --- a/Lib/test/libregrtest/main.py +++ b/Lib/test/libregrtest/main.py @@ -473,6 +473,8 @@ class Regrtest: if self.ns.wait: input("Press any key to continue...") + support.PGO = self.ns.pgo + setup_tests(self.ns) self.find_tests(tests) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 4a7cd40..3e2ab43 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -105,7 +105,7 @@ __all__ = [ "check_warnings", "check_no_resource_warning", "EnvironmentVarGuard", "run_with_locale", "swap_item", "swap_attr", "Matcher", "set_memlimit", "SuppressCrashReport", "sortdict", - "run_with_tz", + "run_with_tz", "PGO", ] class Error(Exception): @@ -878,6 +878,10 @@ else: # Save the initial cwd SAVEDCWD = os.getcwd() +# Set by libregrtest/main.py so we can skip tests that are not +# useful for PGO +PGO = False + @contextlib.contextmanager def temp_dir(path=None, quiet=False): """Return a context manager that creates a temporary directory. diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 3857916..dbee593 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -11,6 +11,9 @@ import struct from test import support from io import BytesIO +if support.PGO: + raise unittest.SkipTest("test is not helpful for PGO") + try: import threading except ImportError: diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index 09bafbd..30b5f16 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -110,6 +110,7 @@ HAS_PYUP_PYDOWN = gdb_has_frame_select() BREAKPOINT_FN='builtin_id' +@support.skipIf(support.PGO, "not useful for PGO") class DebuggerTests(unittest.TestCase): """Test that the debugger can debug Python.""" diff --git a/Lib/test/test_multiprocessing_fork.py b/Lib/test/test_multiprocessing_fork.py index 2bf4e75..9f22500 100644 --- a/Lib/test/test_multiprocessing_fork.py +++ b/Lib/test/test_multiprocessing_fork.py @@ -1,6 +1,12 @@ import unittest import test._test_multiprocessing +from test import support + +if support.PGO: + raise unittest.SkipTest("test is not helpful for PGO") + + test._test_multiprocessing.install_tests_in_module_dict(globals(), 'fork') if __name__ == '__main__': diff --git a/Lib/test/test_multiprocessing_forkserver.py b/Lib/test/test_multiprocessing_forkserver.py index 193a04a..407bb3f 100644 --- a/Lib/test/test_multiprocessing_forkserver.py +++ b/Lib/test/test_multiprocessing_forkserver.py @@ -1,6 +1,11 @@ import unittest import test._test_multiprocessing +from test import support + +if support.PGO: + raise unittest.SkipTest("test is not helpful for PGO") + test._test_multiprocessing.install_tests_in_module_dict(globals(), 'forkserver') if __name__ == '__main__': diff --git a/Lib/test/test_multiprocessing_main_handling.py b/Lib/test/test_multiprocessing_main_handling.py index 2e15cd8..32593da 100644 --- a/Lib/test/test_multiprocessing_main_handling.py +++ b/Lib/test/test_multiprocessing_main_handling.py @@ -16,6 +16,9 @@ from test.support.script_helper import ( make_pkg, make_script, make_zip_pkg, make_zip_script, assert_python_ok) +if support.PGO: + raise unittest.SkipTest("test is not helpful for PGO") + # Look up which start methods are available to test import multiprocessing AVAILABLE_START_METHODS = set(multiprocessing.get_all_start_methods()) diff --git a/Lib/test/test_multiprocessing_spawn.py b/Lib/test/test_multiprocessing_spawn.py index 334ae9e..6558952 100644 --- a/Lib/test/test_multiprocessing_spawn.py +++ b/Lib/test/test_multiprocessing_spawn.py @@ -1,6 +1,11 @@ import unittest import test._test_multiprocessing +from test import support + +if support.PGO: + raise unittest.SkipTest("test is not helpful for PGO") + test._test_multiprocessing.install_tests_in_module_dict(globals(), 'spawn') if __name__ == '__main__': diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 2bfb69c..0906606 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -21,6 +21,9 @@ try: except ImportError: threading = None +if support.PGO: + raise unittest.SkipTest("test is not helpful for PGO") + mswindows = (sys.platform == "win32") # diff --git a/Makefile.pre.in b/Makefile.pre.in index f0d1bb1..e4bee4f 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -235,7 +235,7 @@ TCLTK_LIBS= @TCLTK_LIBS@ # The task to run while instrumented when building the profile-opt target. # We exclude unittests with -x that take a rediculious amount of time to # run in the instrumented training build or do not provide much value. -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 +PROFILE_TASK=-m test.regrtest --pgo # report files for gcov / lcov coverage report COVERAGE_INFO= $(abs_builddir)/coverage.info diff --git a/Tools/msi/buildrelease.bat b/Tools/msi/buildrelease.bat index 2eae07a..89e6ec1 100644 --- a/Tools/msi/buildrelease.bat +++ b/Tools/msi/buildrelease.bat @@ -35,7 +35,7 @@ set BUILDX86= set BUILDX64= set TARGET=Rebuild set TESTTARGETDIR= -set PGO= +set PGO=default :CheckOpts @@ -55,6 +55,7 @@ if "%1" EQU "--build" (set TARGET=Build) && shift && goto CheckOpts if "%1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts if "%1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts if "%1" EQU "--pgo" (set PGO=%~2) && shift && shift && goto CheckOpts +if "%1" EQU "--skip-pgo" (set PGO=) && shift && goto CheckOpts if "%1" NEQ "" echo Invalid option: "%1" && exit /B 1 @@ -195,7 +196,7 @@ exit /B 0 :Help echo buildrelease.bat [--out DIR] [-x86] [-x64] [--certificate CERTNAME] [--build] [--skip-build] -echo [--pgo COMMAND] [--skip-doc] [--download DOWNLOAD URL] [--test TARGETDIR] +echo [--pgo COMMAND] [--skip-pgo] [--skip-doc] [--download DOWNLOAD URL] [--test TARGETDIR] echo [-h] echo. echo --out (-o) Specify an additional output directory for installers @@ -204,7 +205,8 @@ echo -x64 Build x64 installers echo --build (-b) Incrementally build Python rather than rebuilding echo --skip-build (-B) Do not build Python (just do the installers) echo --skip-doc (-D) Do not build documentation -echo --pgo Build x64 installers using PGO +echo --pgo Specify PGO command for x64 installers +echo --skip-pgo Build x64 installers using PGO echo --download Specify the full download URL for MSIs echo --test Specify the test directory to run the installer tests echo -h Display this help information -- cgit v0.12