From 8d0f4cff16ed14357efdbbdebc1dbe2e9afc83f0 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 29 Sep 2023 08:47:42 +0200 Subject: [PATCH 1/6] gh-103053: Run tools test_freeze on buildbot No longer skip test_tools.test_freeze on buildbots. --- Lib/test/test_tools/test_freeze.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/test/test_tools/test_freeze.py b/Lib/test/test_tools/test_freeze.py index 671ec2961e7f8f..780179170cb62b 100644 --- a/Lib/test/test_tools/test_freeze.py +++ b/Lib/test/test_tools/test_freeze.py @@ -14,7 +14,6 @@ @support.requires_zlib() @unittest.skipIf(sys.platform.startswith('win'), 'not supported on Windows') -@support.skip_if_buildbot('not all buildbots have enough space') # gh-103053: Skip test if Python is built with Profile Guided Optimization # (PGO), since the test is just too slow in this case. @unittest.skipIf(support.check_cflags_pgo(), From ee4b86afe741a13434170810b2600b8100cbc801 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 29 Sep 2023 10:05:27 +0200 Subject: [PATCH 2/6] DEBUG --- Tools/freeze/test/freeze.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Tools/freeze/test/freeze.py b/Tools/freeze/test/freeze.py index 9030ad4d4e5f93..912fc929817387 100644 --- a/Tools/freeze/test/freeze.py +++ b/Tools/freeze/test/freeze.py @@ -27,8 +27,17 @@ class UnsupportedError(Exception): """The operation isn't supported.""" +def _run(cmd, cwd=None): + print('+', shlex.join(cmd)) + return subprocess.run( + cmd, + cwd=cwd, + check=True, + ) + + def _run_quiet(cmd, cwd=None): - #print(f'# {" ".join(shlex.quote(a) for a in cmd)}') + print('+', shlex.join(cmd)) try: return subprocess.run( cmd, @@ -125,7 +134,7 @@ def prepare(script=None, outdir=None): ensure_opt(cmd, 'cache-file', os.path.join(outdir, 'python-config.cache')) prefix = os.path.join(outdir, 'python-installation') ensure_opt(cmd, 'prefix', prefix) - _run_quiet(cmd, builddir) + _run(cmd, builddir) if not MAKE: raise UnsupportedError('make') From 146b788cc1e53f48de7416c80447dbb46768db30 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 29 Sep 2023 12:01:10 +0200 Subject: [PATCH 3/6] MORE DEBUG --- Makefile.pre.in | 1 + Tools/freeze/test/freeze.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index f1f5c8557e7ffc..3c4773faf99bd0 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -784,6 +784,7 @@ clinic-tests: check-clean-src $(srcdir)/Lib/test/clinic.test.c # Build the interpreter $(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS) $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) + echo "$(BUILDPYTHON) built successfully" platform: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform diff --git a/Tools/freeze/test/freeze.py b/Tools/freeze/test/freeze.py index 912fc929817387..82ff79db198e4d 100644 --- a/Tools/freeze/test/freeze.py +++ b/Tools/freeze/test/freeze.py @@ -28,7 +28,7 @@ class UnsupportedError(Exception): def _run(cmd, cwd=None): - print('+', shlex.join(cmd)) + print('+', shlex.join(cmd), flush=True) return subprocess.run( cmd, cwd=cwd, @@ -37,7 +37,7 @@ def _run(cmd, cwd=None): def _run_quiet(cmd, cwd=None): - print('+', shlex.join(cmd)) + print('+', shlex.join(cmd), flush=True) try: return subprocess.run( cmd, @@ -53,7 +53,7 @@ def _run_quiet(cmd, cwd=None): print(err.stdout) print("--- STDERR ---") print(err.stderr) - print("---- END ----") + print("---- END ----", flush=True) raise @@ -136,6 +136,15 @@ def prepare(script=None, outdir=None): ensure_opt(cmd, 'prefix', prefix) _run(cmd, builddir) + # Dump Makefile + build_Makefile = os.path.join(builddir, 'Makefile') + with open(build_Makefile, encoding="utf8", errors="backslashreplace") as fp: + content = fp.read() + print("Makefile") + print("--") + print(content) + print("--") + if not MAKE: raise UnsupportedError('make') From f8e155766858faec8a2eb8c4c243cff9fcc2bcf0 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 29 Sep 2023 13:01:06 +0200 Subject: [PATCH 4/6] MOOOORE DEBUG --- Makefile.pre.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile.pre.in b/Makefile.pre.in index 3c4773faf99bd0..e152d1194f61a4 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -785,6 +785,8 @@ clinic-tests: check-clean-src $(srcdir)/Lib/test/clinic.test.c $(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS) $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) echo "$(BUILDPYTHON) built successfully" + pwd + echo "$(BUILDPYTHON)--" platform: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform @@ -798,12 +800,18 @@ platform: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt # or removed in case of failure. pybuilddir.txt: $(PYTHON_FOR_BUILD_DEPS) @echo "none" > ./pybuilddir.txt + echo "[pybuilddir.txt] ls" + ls + echo "[pybuilddir.txt] pwd" + pwd + echo "[pybuilddir.txt] RUN: $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars" $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\ if test $$? -ne 0 ; then \ echo "generate-posix-vars failed" ; \ rm -f ./pybuilddir.txt ; \ exit 1 ; \ fi + echo "[pybuilddir.txt]--" # blake2s is auto-generated from blake2b $(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl.c $(srcdir)/Modules/_blake2/blake2b2s.py From 223449f36d44433f7837dbb155ba3ed6aba0eaa4 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 29 Sep 2023 13:15:33 +0200 Subject: [PATCH 5/6] Makefile: DUMP $@ --- Makefile.pre.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index e152d1194f61a4..af8ede98021f12 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -783,10 +783,13 @@ clinic-tests: check-clean-src $(srcdir)/Lib/test/clinic.test.c # Build the interpreter $(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS) + echo "BUILDPYTHON: run $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS)" $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) - echo "$(BUILDPYTHON) built successfully" + echo "BUILDPYTHON: BUILDPYTHON=$(BUILDPYTHON) target=$@" + echo "BUILDPYTHON: built successfully" + echo "BUILDPYTHON: pwd" pwd - echo "$(BUILDPYTHON)--" + echo "BUILDPYTHON: --" platform: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform From 32d95c9045891d9dace0f65c976f77da9016ae6c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 5 Oct 2023 23:25:40 +0200 Subject: [PATCH 6/6] Fix Makefile $(BUILDPYTHON) rule --- Makefile.pre.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index af8ede98021f12..2851b65faa5a16 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -784,7 +784,10 @@ clinic-tests: check-clean-src $(srcdir)/Lib/test/clinic.test.c # Build the interpreter $(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS) echo "BUILDPYTHON: run $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS)" - $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) + @ # Use -o $(BUILDPYTHON) instead of -o $@ to write the program in the + @ # build directory instead of the source directory with FreeBSD make + @ # (gh-103053). + $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $(BUILDPYTHON) Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) echo "BUILDPYTHON: BUILDPYTHON=$(BUILDPYTHON) target=$@" echo "BUILDPYTHON: built successfully" echo "BUILDPYTHON: pwd"