Commit 7e4f7bd
Release Manager
gh-36226: Use CPU time for --warn-long
Finally address #32981.
Using wall time to measure which tests are "long" doesn't make much
sense. Wall time is subject to every conflating factor:
1. Faster hardware runs tests in less wall time
2. Faster compiler flags makes code that runs in less wall time
3. A busy machine will run tests slower than an unburdened one
4. Operating system priority can increase or decrease the time taken by
a process
5. etc.
Ideally, everyone would agree on how long is too long for a test to run.
Attaining that ideal is not so easy, but the first step is to
switch`--warn-long` away from using wall time and towards using CPU
time. A second phase (#33022)
will normalize the CPU time.
### Examples
#### --warn-long output
The user-facing portion of this can be tested with a low `--warn-long`
value,
```
$ sage -t --warn-long=1 src/sage/rings/qqbar.py
...
Doctesting 1 file.
sage -t --warn-long --random-
seed=309742757431591512726158538133919135994 src/sage/rings/qqbar.py
**********************************************************************
File "src/sage/rings/qqbar.py", line 511, in sage.rings.qqbar
Warning, slow doctest:
z, = [r for r in p4.roots(QQbar, False) if r in ival]
Test ran for 1.51s cpu, 1.51s wall
Check ran for 0.00s cpu, 0.00s wall
**********************************************************************
File "src/sage/rings/qqbar.py", line 524, in sage.rings.qqbar
Warning, slow doctest:
z2 = QQbar.polynomial_root(p4, ival)
Test ran for 1.07s cpu, 1.07s wall
Check ran for 0.00s cpu, 0.00s wall
**********************************************************************
File "src/sage/rings/qqbar.py", line 808, in
sage.rings.qqbar.AlgebraicField_common._factor_multivariate_polynomial
Warning, slow doctest:
F = QQbar._factor_multivariate_polynomial(p)
Test ran for 2.38s cpu, 2.42s wall
Check ran for 0.00s cpu, 0.00s wall
...
```
#### pexpect accounting
Two different methods are used to account for the CPU time, one for
linux, and one for everything else. This GAP command uses pexpect and
should chew up a good bit of CPU time:
```
sage: from sage.doctest.util import Timer
sage: t = Timer()
sage: _ = t.start(); t.stop() # no CPU time used between start/stop
{'cputime': 0.0, 'walltime': 7.605552673339844e-05}
sage: _ = t.start(); gap.eval('a:=List([0..10000],i->WordAlp("a",i));;
IsSortedList(a);'); t.stop() # lots of CPU time used
'true'
{'cputime': 30.089999999999996, 'walltime': 36.292088747024536}
```
URL: #36226
Reported by: Michael Orlitzky
Reviewer(s): Gonzalo Tornaría, John H. Palmieri, Michael Orlitzky, Tobias Diez
File tree
12 files changed
+340
-102
lines changed- pkgs/sagemath-repl
- src
- bin
- doc/en/developer
- sage
- doctest
- interfaces
12 files changed
+340
-102
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
431 | | - | |
| 431 | + | |
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
745 | 745 | | |
746 | 746 | | |
747 | 747 | | |
748 | | - | |
749 | | - | |
750 | | - | |
751 | | - | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
752 | 752 | | |
753 | 753 | | |
754 | 754 | | |
| |||
758 | 758 | | |
759 | 759 | | |
760 | 760 | | |
761 | | - | |
| 761 | + | |
762 | 762 | | |
763 | 763 | | |
764 | 764 | | |
765 | 765 | | |
766 | | - | |
| 766 | + | |
767 | 767 | | |
768 | 768 | | |
769 | 769 | | |
770 | 770 | | |
771 | | - | |
| 771 | + | |
772 | 772 | | |
773 | 773 | | |
774 | 774 | | |
775 | 775 | | |
776 | | - | |
| 776 | + | |
777 | 777 | | |
778 | 778 | | |
779 | 779 | | |
| |||
792 | 792 | | |
793 | 793 | | |
794 | 794 | | |
795 | | - | |
| 795 | + | |
796 | 796 | | |
797 | 797 | | |
798 | 798 | | |
799 | 799 | | |
800 | | - | |
| 800 | + | |
801 | 801 | | |
802 | 802 | | |
803 | 803 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
591 | | - | |
| 591 | + | |
| 592 | + | |
592 | 593 | | |
593 | 594 | | |
594 | 595 | | |
595 | 596 | | |
596 | 597 | | |
597 | | - | |
598 | | - | |
599 | | - | |
| 598 | + | |
| 599 | + | |
600 | 600 | | |
601 | | - | |
602 | | - | |
| 601 | + | |
603 | 602 | | |
604 | | - | |
| 603 | + | |
605 | 604 | | |
606 | | - | |
| 605 | + | |
| 606 | + | |
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
610 | | - | |
| 610 | + | |
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
615 | 615 | | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
621 | 623 | | |
622 | 624 | | |
623 | 625 | | |
| |||
637 | 639 | | |
638 | 640 | | |
639 | 641 | | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
640 | 645 | | |
641 | 646 | | |
642 | 647 | | |
| |||
1152 | 1157 | | |
1153 | 1158 | | |
1154 | 1159 | | |
1155 | | - | |
| 1160 | + | |
1156 | 1161 | | |
1157 | 1162 | | |
1158 | 1163 | | |
| |||
1229 | 1234 | | |
1230 | 1235 | | |
1231 | 1236 | | |
1232 | | - | |
| 1237 | + | |
1233 | 1238 | | |
1234 | 1239 | | |
1235 | 1240 | | |
| |||
1433 | 1438 | | |
1434 | 1439 | | |
1435 | 1440 | | |
1436 | | - | |
| 1441 | + | |
1437 | 1442 | | |
1438 | 1443 | | |
1439 | 1444 | | |
| |||
1457 | 1462 | | |
1458 | 1463 | | |
1459 | 1464 | | |
1460 | | - | |
| 1465 | + | |
1461 | 1466 | | |
1462 | 1467 | | |
1463 | 1468 | | |
| |||
1483 | 1488 | | |
1484 | 1489 | | |
1485 | 1490 | | |
1486 | | - | |
| 1491 | + | |
1487 | 1492 | | |
1488 | 1493 | | |
1489 | 1494 | | |
| |||
1501 | 1506 | | |
1502 | 1507 | | |
1503 | 1508 | | |
1504 | | - | |
| 1509 | + | |
1505 | 1510 | | |
1506 | 1511 | | |
1507 | 1512 | | |
| |||
1519 | 1524 | | |
1520 | 1525 | | |
1521 | 1526 | | |
1522 | | - | |
| 1527 | + | |
1523 | 1528 | | |
1524 | 1529 | | |
1525 | 1530 | | |
| |||
1627 | 1632 | | |
1628 | 1633 | | |
1629 | 1634 | | |
1630 | | - | |
| 1635 | + | |
1631 | 1636 | | |
1632 | 1637 | | |
1633 | 1638 | | |
| |||
0 commit comments