python - 在不运行测试的情况下制作(从源代码安装)python

我从源代码 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

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 目标运行),但是那会破坏目的。 您可以改为删除配置标志以获得更好的构建时间。

https://stackoverflow.com/questions/44708262/

相关文章:

xcode - 无法将 testflight 与从 XCode 7.0.1 上传的构建一起使用

android - 如何以编程方式读取我的 Android apk 的构建日期?

android - 使用没有运行的 Eclipse 重建 .apk

android - Visual Studio 2015 Xamarin 部署失败,没有任何错误消息

python - 问题构建 cx_Oracle - libclntsh.so.11.1 => 未找到

iphone - 为什么 Xcode 会在钥匙串(keychain)中自动安装(重复和过期的)证书?

build-process - 改进您的构建过程

go - 如何使用 Golang 包以外的名称构建可执行文件

build - Xcode 4 术语 "Build for testing/Build for ru

android - com.android.ddmlib.AdbCommandRejectedExc