bpo-37707: Exclude expensive unit tests from PGO task (GH-15009) · python/cpython@52a48e6 (original) (raw)
8 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -643,6 +643,7 @@ def _main(self, tests, kwargs): | ||
643 | 643 | input("Press any key to continue...") |
644 | 644 | |
645 | 645 | support.PGO = self.ns.pgo |
646 | +support.PGO_EXTENDED = self.ns.pgo_extended | |
646 | 647 | |
647 | 648 | setup_tests(self.ns) |
648 | 649 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2281,6 +2281,7 @@ def test_setitems_on_non_dicts(self): | ||
2281 | 2281 | FRAME_SIZE_MIN = 4 |
2282 | 2282 | FRAME_SIZE_TARGET = 64 * 1024 |
2283 | 2283 | |
2284 | +@support.skip_if_pgo_task | |
2284 | 2285 | def check_frame_opcodes(self, pickled): |
2285 | 2286 | """ |
2286 | 2287 | Check the arguments of FRAME opcodes in a protocol 4+ pickle. |
@@ -2328,6 +2329,7 @@ def check_frame_opcodes(self, pickled): | ||
2328 | 2329 | elif frameless_start is not None: |
2329 | 2330 | self.assertLess(pos - frameless_start, self.FRAME_SIZE_MIN) |
2330 | 2331 | |
2332 | +@support.skip_if_pgo_task | |
2331 | 2333 | def test_framing_many_objects(self): |
2332 | 2334 | obj = list(range(10**5)) |
2333 | 2335 | for proto in range(4, pickle.HIGHEST_PROTOCOL + 1): |
@@ -2417,6 +2419,7 @@ def remove_frames(pickled, keep_frame=None): | ||
2417 | 2419 | count_opcode(pickle.FRAME, pickled)) |
2418 | 2420 | self.assertEqual(obj, self.loads(some_frames_pickle)) |
2419 | 2421 | |
2422 | +@support.skip_if_pgo_task | |
2420 | 2423 | def test_framed_write_sizes_with_delayed_writer(self): |
2421 | 2424 | class ChunkAccumulator: |
2422 | 2425 | """Accumulate pickler output in a list of raw chunks.""" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -973,6 +973,10 @@ def dec(*args, **kwargs): | ||
973 | 973 | # useful for PGO |
974 | 974 | PGO = False |
975 | 975 | |
976 | +# Set by libregrtest/main.py if we are running the extended (time consuming) | |
977 | +# PGO task. If this is True, PGO is also True. | |
978 | +PGO_EXTENDED = False | |
979 | + | |
976 | 980 | @contextlib.contextmanager |
977 | 981 | def temp_dir(path=None, quiet=False): |
978 | 982 | """Return a context manager that creates a temporary directory. |
@@ -2638,6 +2642,12 @@ def skip_unless_xattr(test): | ||
2638 | 2642 | msg = "no non-broken extended attribute support" |
2639 | 2643 | return test if ok else unittest.skip(msg)(test) |
2640 | 2644 | |
2645 | +def skip_if_pgo_task(test): | |
2646 | +"""Skip decorator for tests not run in (non-extended) PGO task""" | |
2647 | +ok = not PGO or PGO_EXTENDED | |
2648 | +msg = "Not run for (non-extended) PGO task" | |
2649 | +return test if ok else unittest.skip(msg)(test) | |
2650 | + | |
2641 | 2651 | _bind_nix_socket_error = None |
2642 | 2652 | def skip_unless_bind_unix_socket(test): |
2643 | 2653 | """Decorator for tests requiring a functional bind() for unix sockets.""" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -643,6 +643,7 @@ def testCompressChunks10(self): | ||
643 | 643 | data += bz2c.flush() |
644 | 644 | self.assertEqual(ext_decompress(data), self.TEXT) |
645 | 645 | |
646 | +@support.skip_if_pgo_task | |
646 | 647 | @bigmemtest(size=_4G + 100, memuse=2) |
647 | 648 | def testCompress4G(self, size): |
648 | 649 | # "Test BZ2Compressor.compress()/flush() with >4GiB input" |
@@ -701,6 +702,7 @@ def testEOFError(self): | ||
701 | 702 | self.assertRaises(EOFError, bz2d.decompress, b"anything") |
702 | 703 | self.assertRaises(EOFError, bz2d.decompress, b"") |
703 | 704 | |
705 | +@support.skip_if_pgo_task | |
704 | 706 | @bigmemtest(size=_4G + 100, memuse=3.3) |
705 | 707 | def testDecompress4G(self, size): |
706 | 708 | # "Test BZ2Decompressor.decompress() with >4GiB input" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2062,6 +2062,7 @@ def gen2(x): | ||
2062 | 2062 | self.assertRaises(AssertionError, list, cycle(gen1())) |
2063 | 2063 | self.assertEqual(hist, [0,1]) |
2064 | 2064 | |
2065 | +@support.skip_if_pgo_task | |
2065 | 2066 | def test_long_chain_of_empty_iterables(self): |
2066 | 2067 | # Make sure itertools.chain doesn't run into recursion limits when |
2067 | 2068 | # dealing with long chains of empty iterables. Even with a high |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -333,6 +333,7 @@ def test_decompressor_multistream(self): | ||
333 | 333 | |
334 | 334 | # Test with inputs larger than 4GiB. |
335 | 335 | |
336 | +@support.skip_if_pgo_task | |
336 | 337 | @bigmemtest(size=_4G + 100, memuse=2) |
337 | 338 | def test_compressor_bigmem(self, size): |
338 | 339 | lzc = LZMACompressor() |
@@ -344,6 +345,7 @@ def test_compressor_bigmem(self, size): | ||
344 | 345 | finally: |
345 | 346 | ddata = None |
346 | 347 | |
348 | +@support.skip_if_pgo_task | |
347 | 349 | @bigmemtest(size=_4G + 100, memuse=3) |
348 | 350 | def test_decompressor_bigmem(self, size): |
349 | 351 | lzd = LZMADecompressor() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -14,6 +14,7 @@ | ||
14 | 14 | import random |
15 | 15 | import sys |
16 | 16 | import unittest |
17 | +from test import support | |
17 | 18 | |
18 | 19 | from decimal import Decimal |
19 | 20 | from fractions import Fraction |
@@ -2462,6 +2463,7 @@ def test_cdf(self): | ||
2462 | 2463 | self.assertEqual(X.cdf(float('Inf')), 1.0) |
2463 | 2464 | self.assertTrue(math.isnan(X.cdf(float('NaN')))) |
2464 | 2465 | |
2466 | +@support.skip_if_pgo_task | |
2465 | 2467 | def test_inv_cdf(self): |
2466 | 2468 | NormalDist = statistics.NormalDist |
2467 | 2469 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1 | +Mark some individual tests to skip when --pgo is used. The tests marked | |
2 | +increase the PGO task time significantly and likely don't help improve | |
3 | +optimization of the final executable. |