我从源码 tar 编译 python。一切正常,但测试运行了 2 小时和两次。如何绕过这些测试?
0:16:20 [178/405] test_inspect
0:16:26 [179/405] test_int
0:16:27 [180/405] test_int_literal
0:16:27 [181/405] test_io
0:18:18 [182/405] test_ioctl -- test_io passed in 1 min 51 sec
0:18:19 [183/405] test_ipaddress
0:18:22 [184/405] test_isinstance
0:18:23 [185/405] test_iter
0:18:24 [186/405] test_iterlen
0:18:25 [187/405] test_itertools
0:19:09 [188/405] test_json -- test_itertools passed in 44 sec
0:19:30 [189/405] test_keyword
结果
make 7724,86s user 188,63s system 101% cpu 2:10:18,93 total
我的分布是这样的
PYTHON_VERSION = 3.6.1
PYTHON_URL = https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz
wget -O dl/Python-${PYTHON_VERSION}.tar.xz ${PYTHON_URL}
cd dl
tar xf Python-${PYTHON_VERSION}.tar.xz
mkdir -p dl/Python-${PYTHON_VERSION}-build/
cd Python-${PYTHON_VERSION}
./configure --enable-optimizations --prefix=$$(pwd)-build --cache-file=$$(pwd)/cache-file
此命令运行测试两次:
make -C dl/Python-${PYTHON_VERSION} -j8
make -C dl/Python-${PYTHON_VERSION} -j8 install
附注这是另一个 make 文件的一部分。
配置选项--enable-optimizations
允许运行测试套件来生成用于分析 Python 的数据。生成的 python 二进制文件在执行 python 代码时具有更好的性能。注意到的改进here https://bugs.python.org/issue24915
From configure help:
--enable-optimizations Enable expensive optimizations (PGO, etc). Disabled by default.
来自维基百科
profile-guided optimisation uses the results of profiling test runs of the instrumented program to optimize the final generated code.
简而言之,使用时不应该跳过测试--enable-optimizations
因为分析所需的数据是通过运行测试生成的。
你可以运行make -j8 build_all
其次是make -j8 install
跳过测试一次(测试仍将运行install
目标),但这会违背目的。
您可以删除配置标志以获得更好的构建时间。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)