Skip to content

gh-103053: Run tools test_freeze on buildbot #110075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Lib/test/test_tools/test_freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
17 changes: 16 additions & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,16 @@ 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: run $(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"
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
Expand All @@ -797,12 +806,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
Expand Down
24 changes: 21 additions & 3 deletions Tools/freeze/test/freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,17 @@ class UnsupportedError(Exception):
"""The operation isn't supported."""


def _run(cmd, cwd=None):
print('+', shlex.join(cmd), flush=True)
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), flush=True)
try:
return subprocess.run(
cmd,
Expand All @@ -44,7 +53,7 @@ def _run_quiet(cmd, cwd=None):
print(err.stdout)
print("--- STDERR ---")
print(err.stderr)
print("---- END ----")
print("---- END ----", flush=True)
raise


Expand Down Expand Up @@ -125,7 +134,16 @@ 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)

# 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')
Expand Down