Skip to content

Commit 180e5cc

Browse files
committed
pythongh-93584: Make all install+tests targets depends on all
All install targets use the "all" target as synchronization point to prevent race conditions with PGO builds. PGO builds use recursive make, which can lead to two parallel `./python setup.py build` processes that step on each others toes. "test" targets now correctly compile PGO build in a clean repo.
1 parent 296081a commit 180e5cc

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

Makefile.pre.in

+16-12
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,8 @@ LIBEXPAT_HEADERS= \
580580

581581
# Default target
582582
all: @DEF_MAKE_ALL_RULE@
583-
build_all: check-clean-src $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks \
584-
Programs/_testembed python-config
583+
build_all: check-clean-src $(BUILDPYTHON) platform oldsharedmods sharedmods \
584+
gdbhooks Programs/_testembed python-config
585585
build_wasm: check-clean-src $(BUILDPYTHON) platform oldsharedmods python-config
586586

587587
# Check that the source is clean when building out of source.
@@ -1663,7 +1663,7 @@ cleantest: all
16631663

16641664
# Run a basic set of regression tests.
16651665
# This excludes some tests that are particularly resource-intensive.
1666-
test: @DEF_MAKE_RULE@ platform
1666+
test: all
16671667
$(TESTRUNNER) $(TESTOPTS)
16681668

16691669
# Run the full test suite twice - once without .pyc files, and once with.
@@ -1673,7 +1673,7 @@ test: @DEF_MAKE_RULE@ platform
16731673
# the bytecode read from a .pyc file had the bug, sometimes the directly
16741674
# generated bytecode. This is sometimes a very shy bug needing a lot of
16751675
# sample data.
1676-
testall: @DEF_MAKE_RULE@ platform
1676+
testall: all
16771677
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
16781678
$(TESTPYTHON) -E $(srcdir)/Lib/compileall.py
16791679
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
@@ -1682,7 +1682,7 @@ testall: @DEF_MAKE_RULE@ platform
16821682

16831683
# Run the test suite for both architectures in a Universal build on OSX.
16841684
# Must be run on an Intel box.
1685-
testuniversal: @DEF_MAKE_RULE@ platform
1685+
testuniversal: all
16861686
@if [ `arch` != 'i386' ]; then \
16871687
echo "This can only be used on OSX/i386" ;\
16881688
exit 1 ;\
@@ -1693,7 +1693,7 @@ testuniversal: @DEF_MAKE_RULE@ platform
16931693

16941694
# Like testall, but with only one pass and without multiple processes.
16951695
# Run an optional script to include information about the build environment.
1696-
buildbottest: all platform
1696+
buildbottest: all
16971697
-@if which pybuildbot.identify >/dev/null 2>&1; then \
16981698
pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
16991699
fi
@@ -1708,7 +1708,7 @@ QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
17081708
test_multiprocessing_forkserver \
17091709
test_mailbox test_nntplib test_socket test_poll \
17101710
test_select test_zipfile test_concurrent_futures
1711-
quicktest: @DEF_MAKE_RULE@ platform
1711+
quicktest: all
17121712
$(TESTRUNNER) $(QUICKTESTOPTS)
17131713

17141714
# SSL tests
@@ -1719,6 +1719,10 @@ multisslcompile: all
17191719
multissltest: all
17201720
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py
17211721

1722+
# All install targets use the "all" target as synchronization point to
1723+
# prevent race conditions with PGO builds. PGO builds use recursive make,
1724+
# which can lead to two parallel `./python setup.py build` processes that
1725+
# step on each others toes.
17221726
install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@
17231727
if test "x$(ENSUREPIP)" != "xno" ; then \
17241728
case $(ENSUREPIP) in \
@@ -1747,7 +1751,7 @@ commoninstall: check-clean-src @FRAMEWORKALTINSTALLFIRST@ \
17471751
# Install shared libraries enabled by Setup
17481752
DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
17491753

1750-
oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
1754+
oldsharedinstall: $(DESTSHARED) all
17511755
@for i in X $(SHAREDMODS); do \
17521756
if test $$i != X; then \
17531757
echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
@@ -2153,7 +2157,7 @@ LIBPL= @LIBPL@
21532157
# pkgconfig directory
21542158
LIBPC= $(LIBDIR)/pkgconfig
21552159

2156-
libainstall: @DEF_MAKE_RULE@ python-config
2160+
libainstall: all python-config
21572161
@for i in $(LIBDIR) $(LIBPL) $(LIBPC) $(BINDIR); \
21582162
do \
21592163
if test ! -d $(DESTDIR)$$i; then \
@@ -2207,7 +2211,7 @@ libainstall: @DEF_MAKE_RULE@ python-config
22072211

22082212
# Install the dynamically loadable modules
22092213
# This goes into $(exec_prefix)
2210-
sharedinstall: sharedmods
2214+
sharedinstall: all
22112215
$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
22122216
--prefix=$(prefix) \
22132217
--install-scripts=$(BINDIR) \
@@ -2437,7 +2441,7 @@ distclean: clobber
24372441
-exec rm -f {} ';'
24382442

24392443
# Check that all symbols exported by libpython start with "Py" or "_Py"
2440-
smelly: @DEF_MAKE_RULE@
2444+
smelly: all
24412445
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/smelly.py
24422446

24432447
# Find files with funny names
@@ -2472,7 +2476,7 @@ funny:
24722476
-o -print
24732477

24742478
# Perform some verification checks on any modified files.
2475-
patchcheck: @DEF_MAKE_RULE@
2479+
patchcheck: all
24762480
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
24772481

24782482
check-limited-abi: all

0 commit comments

Comments
 (0)