1

我有一个使用库 Z3 求解器的项目,并且想应用 Travis-CI 进行连续测试。但是,我无法在 Travis-CI 中的远程机器上设置 z3。

以下是有关我的项目的更多信息:

  • 从 IDE Eclipse Mars 创建
  • 使用 JDK 8
  • 使用 Ant 构建build.xml

内容文件.travis.yml

 language: java
 sudo: enabled
 jdk:
   - oraclejdk8
 before_install:
 - sudo apt-get update
 - sudo apt-get install z3 -y
 script:
 - ant build
 - ant 'MyJUnitTest'

远程机器控制台上的输出

... (be removed for clarity)
$ sudo apt-get install z3 -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package z3
The command "sudo apt-get install z3 -y" failed and exited with 100 during .
Your build has been stopped.

我知道可以通过将包含 Z3 求解器的存储库添加到.travis.ymlbefore_install部分)来解决该问题。我找到了一个存储库:https ://launchpad.net/~hvr/+archive/ubuntu/z3 。但是,此存储库不再起作用。更清楚的是,在 10 分钟后(Travis-CI 机器上的默认等待时间),此存储库没有响应。

$ sudo add-apt-repository ppa:hvr/z3

More info: https://launchpad.net/~hvr/+archive/ubuntu/z3
Press [ENTER] to continue or ctrl-c to cancel adding it
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated
4

1 回答 1

1

据我所知,没有官方/支持的方法可以做到这一点。如果确实有维护的回购,那就太好了。但是可以通过一些黑客攻击来做到这一点,方法是直接拉下版本并将它们安装在构建机器上。

使用 Nightly Z3 构建

Z3 人员确实在 github 上维护夜间构建,因此确实可以提取最新代码并将其与 Travis-CI(适用于 Linux 和 Mac)以及 Appveyor(适用于 Windows)集成。

作为如何在 travis 中执行此操作的示例,请参阅:

https://github.com/LeventErkok/sbv/blob/master/.travis.yml#L46-L66

对于 Appveyor 设置,请参阅:

https://github.com/LeventErkok/sbv/blob/master/.appveyor.yml#L10-L13

根据您的确切需求,您应该能够将其用于您自己的问题。(请注意,通过在 Mac 上安装一些其他依赖项,travis 位比 z3 做得更多;您应该将它们排除在外。如果您需要帮助,请 Ping!)

关于稳定性的说明

不幸的是,这个技巧并不是 100% 万无一失的,它确实需要偶尔维护,因为它依赖于 Z3 的存储位置、每晚构建的命名方式、travis/appveyor 处理环境的方式等;但它已经为我工作了相当长一段时间了。祝你好运!

使用稳定版 Z3

如果您想要“稳定”构建而不是“夜间”z3,您可以通过稍微修改位置来使用类似的技巧;通过从本质上获取它们:https://github.com/Z3Prover/bin/tree/master/releases而不是https://github.com/Z3Prover/bin/tree/master/nightly

于 2018-04-26T13:51:54.773 回答