Skip to content

test_tools: test_freeze_simple_script() fails on s390x SLES 3.x: [Errno 2] No such file or directory: (...) #109615

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
vstinner opened this issue Sep 20, 2023 · 8 comments
Labels
tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

vstinner commented Sep 20, 2023

s390x SLES 3.x:

test_freeze_simple_script (test.test_tools.test_freeze.TestFreeze.test_freeze_simple_script) ... ERROR

Stdout:
creating the script to be frozen at /tmp/test_python_3vf4i07o/tmp7pw_cxg6/app.py
copying the source tree into /tmp/test_python_3vf4i07o/tmp7pw_cxg6/cpython...

(...)

======================================================================
ERROR: test_freeze_simple_script (test.test_tools.test_freeze.TestFreeze.test_freeze_simple_script)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Lib/test/test_tools/test_freeze.py", line 32, in test_freeze_simple_script
    outdir, scriptfile, python = helper.prepare(script, outdir)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Tools/freeze/test/freeze.py", line 146, in prepare
    copy_source_tree(srcdir, SRCDIR)
  File "/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Tools/freeze/test/freeze.py", line 95, in copy_source_tree
    shutil.copytree(oldroot, newroot, ignore=ignore_non_src)
  File "/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Lib/shutil.py", line 588, in copytree
    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Lib/shutil.py", line 542, in _copytree
    raise Error(errors)
shutil.Error: [('/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/build/test_python_29475æ', '/tmp/test_python_3vf4i07o/tmp7pw_cxg6/cpython/build/test_python_29475æ', "[Errno 2] No such file or directory: '/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/build/test_python_29475æ'")]

Stdout:
creating the script to be frozen at /tmp/test_python_3vf4i07o/tmp7pw_cxg6/app.py
copying the source tree into /tmp/test_python_3vf4i07o/tmp7pw_cxg6/cpython...

----------------------------------------------------------------------
Ran 36 tests in 7.203s

FAILED (errors=1)
test test_tools failed

build: https://buildbot.python.org/all/#/builders/540/builds/6583

Linked PRs

@vstinner vstinner added the tests Tests in the Lib/test dir label Sep 20, 2023
@vstinner
Copy link
Member Author

The test fails also on s390x Debian 3.x: https://buildbot.python.org/all/#builders/49/builds/6610

@serhiy-storchaka
Copy link
Member

It tries to copy the source tree from /home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/build/test_python_29475æ, but the correct path is /home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/.

@vstinner
Copy link
Member Author

build: https://buildbot.python.org/all/#/builders/540/builds/6583

  • Git was run in directory: /home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build.

  • configure command: ./configure --prefix '$(PWD)/target' --with-pydebug

  • test.pythoninfo:

    • sysconfig[abs_builddir]: /home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build
    • sysconfig[srcdir]: /home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build
  • Tests are run in directory: /home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/build/test_python_worker_8799æ

Tools/freeze/freeze.py computes:

SRCDIR = os.path.dirname(os.path.dirname(TOOL_ROOT))

It tries to copy the source tree from /home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/build/test_python_29475æ, but the correct path is /home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/.

Oh. Maybe the code defining SRCDIR is wrong.

vstinner added a commit to vstinner/cpython that referenced this issue Sep 26, 2023
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.
@vstinner
Copy link
Member Author

I proposed PR #109935 to fix the issue. I'm not sure yet if my fix is correct.

vstinner added a commit to vstinner/cpython that referenced this issue Sep 27, 2023
Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.
@vstinner
Copy link
Member Author

It seems like freeze copy_source_tree() copies build/ directory which is modified by other tests running in parallel. So it's likely that the copy can fail. I updated my PR #109935 to ignore this directory in the copy. Recently, I fixed a similar issue in venv with __pycache__/ directories: see issue gh-109748.

vstinner added a commit to vstinner/cpython that referenced this issue Sep 27, 2023
Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 27, 2023
Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.
vstinner added a commit that referenced this issue Sep 27, 2023
Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 27, 2023
Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.

(cherry picked from commit 1512d6c)
vstinner added a commit to vstinner/cpython that referenced this issue Sep 27, 2023
Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.

(cherry picked from commit 1512d6c)
vstinner added a commit to vstinner/cpython that referenced this issue Sep 27, 2023
Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.

(cherry picked from commit 1512d6c)
vstinner added a commit that referenced this issue Sep 27, 2023
gh-109615: Fix test_tools.test_freeze SRCDIR (#109935)

Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.

(cherry picked from commit 1512d6c)
vstinner added a commit to vstinner/cpython that referenced this issue Sep 27, 2023
Fix the test when the test is run on an installed Python: get
abs_srcdir of sysconfig, and skip the test if the Python source code
cannot be found.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 27, 2023
Fix the test when the test is run on an installed Python: get
abs_srcdir of sysconfig, and skip the test if the Python source code
cannot be found.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 27, 2023
Fix the test when the test is run on an installed Python: use
"abs_srcdir" of sysconfig, and skip the test if the Python source
code cannot be found.

* Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and
  Lib/test/libregrtest/utils.py now first try to get "abs_srcdir"
  from sysconfig, before getting "srcdir" from sysconfig.
* test.pythoninfo logs sysconfig "abs_srcdir".
vstinner added a commit to vstinner/cpython that referenced this issue Sep 27, 2023
Fix the test when run on an installed Python: use "abs_srcdir" of
sysconfig, and skip the test if the Python source code cannot be
found.

* Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and
  Lib/test/libregrtest/utils.py now first try to get "abs_srcdir"
  from sysconfig, before getting "srcdir" from sysconfig.
* test.pythoninfo logs sysconfig "abs_srcdir".
vstinner added a commit that referenced this issue Sep 27, 2023
Fix the test when run on an installed Python: use "abs_srcdir" of
sysconfig, and skip the test if the Python source code cannot be
found.

* Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and
  Lib/test/libregrtest/utils.py now first try to get "abs_srcdir"
  from sysconfig, before getting "srcdir" from sysconfig.
* test.pythoninfo logs sysconfig "abs_srcdir".
vstinner added a commit that referenced this issue Sep 27, 2023
…#109962)

gh-109615: Fix support test_copy_python_src_ignore() (#109958)

Fix the test when run on an installed Python: use "abs_srcdir" of
sysconfig, and skip the test if the Python source code cannot be
found.

* Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and
  Lib/test/libregrtest/utils.py now first try to get "abs_srcdir"
  from sysconfig, before getting "srcdir" from sysconfig.
* test.pythoninfo logs sysconfig "abs_srcdir".

(cherry picked from commit b89ed9d)
vstinner added a commit to vstinner/cpython that referenced this issue Sep 27, 2023
Not only check if src_dir exists, but look also for Lib/os.py
landmark.
vstinner added a commit that referenced this issue Sep 27, 2023
Not only check if src_dir exists, but look also for Lib/os.py
landmark.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 27, 2023
…ythonGH-109970)

Not only check if src_dir exists, but look also for Lib/os.py
landmark.
(cherry picked from commit cc54bcf)

Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this issue Sep 27, 2023
…H-109970) (#109976)

gh-109615: Fix support test_copy_python_src_ignore() on WASM (GH-109970)

Not only check if src_dir exists, but look also for Lib/os.py
landmark.
(cherry picked from commit cc54bcf)

Co-authored-by: Victor Stinner <[email protected]>
csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 28, 2023
Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.
csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 28, 2023
…9958)

Fix the test when run on an installed Python: use "abs_srcdir" of
sysconfig, and skip the test if the Python source code cannot be
found.

* Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and
  Lib/test/libregrtest/utils.py now first try to get "abs_srcdir"
  from sysconfig, before getting "srcdir" from sysconfig.
* test.pythoninfo logs sysconfig "abs_srcdir".
csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 28, 2023
…ython#109970)

Not only check if src_dir exists, but look also for Lib/os.py
landmark.
@zooba
Copy link
Member

zooba commented Sep 29, 2023

The last change makes test_copy_python_src_ignore fail rather than skip on Windows installs, because the standard library exists but the Modules directory (which is the actual important landmark) does not.

PR incoming.

@zooba
Copy link
Member

zooba commented Sep 29, 2023

There's a few fixes here waiting on 3.12 branch to open up before they'll be merged, so I'm leaving this open until they're done.

zooba added a commit that referenced this issue Sep 29, 2023
Yhg1s pushed a commit that referenced this issue Oct 2, 2023
gh-109615: Fix test_tools.test_freeze SRCDIR (#109935)

Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.

(cherry picked from commit 1512d6c)
vstinner added a commit to vstinner/cpython that referenced this issue Oct 4, 2023
…9958)

Fix the test when run on an installed Python: use "abs_srcdir" of
sysconfig, and skip the test if the Python source code cannot be
found.

* Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and
  Lib/test/libregrtest/utils.py now first try to get "abs_srcdir"
  from sysconfig, before getting "srcdir" from sysconfig.
* test.pythoninfo logs sysconfig "abs_srcdir".

(cherry picked from commit b89ed9d)
vstinner added a commit to vstinner/cpython that referenced this issue Oct 4, 2023
…ython#109970)

Not only check if src_dir exists, but look also for Lib/os.py
landmark.

(cherry picked from commit cc54bcf)
vstinner pushed a commit to vstinner/cpython that referenced this issue Oct 4, 2023
vstinner added a commit that referenced this issue Oct 4, 2023
…#110340)

* gh-109615: Fix support test_copy_python_src_ignore() (#109958)

Fix the test when run on an installed Python: use "abs_srcdir" of
sysconfig, and skip the test if the Python source code cannot be
found.

* Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and
  Lib/test/libregrtest/utils.py now first try to get "abs_srcdir"
  from sysconfig, before getting "srcdir" from sysconfig.
* test.pythoninfo logs sysconfig "abs_srcdir".

(cherry picked from commit b89ed9d)

* gh-109615: Fix support test_copy_python_src_ignore() on WASM (#109970)

Not only check if src_dir exists, but look also for Lib/os.py
landmark.

(cherry picked from commit cc54bcf)

* gh-109615: Look for 'Modules' as landmark for test_copy_python_src_ignore (GH-110108)

(cherry picked from commit 20bc5f7)

* gh-109748: Fix again venv test_zippath_from_non_installed_posix() (#110149)

Call also copy_python_src_ignore() on listdir() names.

shutil.copytree(): replace set() with an empty tuple. An empty tuple
becomes a constant in the compiler and checking if an item is in an
empty tuple is cheap.

(cherry picked from commit 0def8c7)

---------

Co-authored-by: Steve Dower <[email protected]>
@vstinner
Copy link
Member Author

Ok, all changes should now be backported. I close the issue.

Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…9958)

Fix the test when run on an installed Python: use "abs_srcdir" of
sysconfig, and skip the test if the Python source code cannot be
found.

* Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and
  Lib/test/libregrtest/utils.py now first try to get "abs_srcdir"
  from sysconfig, before getting "srcdir" from sysconfig.
* test.pythoninfo logs sysconfig "abs_srcdir".
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…ython#109970)

Not only check if src_dir exists, but look also for Lib/os.py
landmark.
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir
Projects
None yet
Development

No branches or pull requests

3 participants