python / python/cpython

matchfile Worker bug argument list too long when using matchfile to run many tests

未關閉
#139,207 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

tests type-bug
主要語言
Python
星號
77.2k
分支
35.9k
PR 合併指標
PR 指標待擷取

描述

Bug report

Bug description:

In https://github.com/python/cpython/issues/138313#issuecomment-3264096281, I'm trying to select different subsets of test_importlib to determine which ones are implicated in the failures. Unfortunately, it seems that when extracting the list of tests and then passing that to --matchfile the execution fails with:

+ ./python -u -W error -bb -E -m test --fast-ci --junit-xml test-results.xml test_importlib --matchfile cases.txt --dont-add-python-opts
Using random seed: 893560730
0:00:00 load avg: 0.54 Run 1 test in parallel using 1 worker process (timeout: 10 min, worker timeout: 15 min)
Warning -- regrtest worker thread failed: Traceback (most recent call last):
Warning --   File "/home/stan/cpython/Lib/test/libregrtest/run_workers.py", line 403, in run
Warning --     mp_result = self._runtest(test_name)
Warning --   File "/home/stan/cpython/Lib/test/libregrtest/run_workers.py", line 363, in _runtest
Warning --     retcode, tmp_files = self.run_tmp_files(worker_runtests,
Warning --                          ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
Warning --                                             stdout_file.fileno())
Warning --                                             ^^^^^^^^^^^^^^^^^^^^^
Warning --   File "/home/stan/cpython/Lib/test/libregrtest/run_workers.py", line 299, in run_tmp_files
Warning --     retcode = self._run_process(worker_runtests,
Warning --                                 stdout_fd, tmp_dir)
Warning --   File "/home/stan/cpython/Lib/test/libregrtest/run_workers.py", line 180, in _run_process
Warning --     popen = create_worker_process(runtests, output_fd, tmp_dir)
Warning --   File "/home/stan/cpython/Lib/test/libregrtest/worker.py", line 73, in create_worker_process
Warning --     return subprocess.Popen(cmd, **kwargs)
Warning --            ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
Warning --   File "/home/stan/cpython/Lib/subprocess.py", line 1037, in __init__
Warning --     self._execute_child(args, executable, preexec_fn, close_fds,
Warning --     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning --                         pass_fds, cwd, env,
Warning --                         ^^^^^^^^^^^^^^^^^^^
Warning --     ...<5 lines>...
Warning --                         gid, gids, uid, umask,
Warning --                         ^^^^^^^^^^^^^^^^^^^^^^
Warning --                         start_new_session, process_group)
Warning --                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning --   File "/home/stan/cpython/Lib/subprocess.py", line 1969, in _execute_child
Warning --     raise child_exception_type(errno_num, err_msg, err_filename)
Warning -- OSError: [Errno 7] Argument list too long: '/home/stan/cpython/python'

== Tests result: FAILURE, WORKER BUG ==

It seems there's a limit to the number of lines that can be passed to a --matchfile.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先使用較大的 cases.txt 重現該命令,然後檢查 Lib/test/libregrestest/run_workers.py 和 Lib/test/libregrestest/worker.py 中建立 worker 程序的相關部分。追蹤 --matchfile 選擇如何傳遞到 subprocess.Popen,並將完成定義為在不出現 OSError: [Errno 7] Argument list too long 的情況下執行這個大型選擇集。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
testing-qa
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。