具有多个测试套件的 Automake(编码/部署)
我正在将 Automake 用于一个项目,除了典型的单元测试之外,该项目还开始运行更长时间的集成/部署样式测试。问题是,在正常编程期间,不需要运行较长的测试,只需运行较短的单元测试集。然而,最终的合并和/或存储库构建必须运行完整的测试套件。
automake 有没有标准的方法来处理这个问题?理想情况下,我只想有两个目标,一个是运行所有内容的正常 check
目标,另一个是运行精简测试的 check-lite
目标。
该项目分布在多个子项目和目录中,因此标准的 automake 方法是确保一致性的理想选择。
I'm using Automake for a project that is starting to have longer running integration/deployment style tests in addition to the typical unit tests. The issue is that during normal programming there is no need to run the longer tests, only the shorter set of unit tests. However, the final merge, and/or repository build, must run the complete test suite.
Is there a standard way to handle this with automake? Ideally I'd like to just have two targets, the normal check
target to run everything and perhaps a check-lite
to run the reduced test.
The project is spread across several sub-projects and directories, thus a standard automake approach would be ideal to ensure consistency.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议在您的
configure
脚本中添加一个--enable-extended-tests
选项:然后您可以在 Makefile.am 中使用 Automake 条件:
I suggest adding a
--enable-extended-tests
option to yourconfigure
script:Then you can use an Automake conditional in your Makefile.am:
如果您已根据测试类型将测试套件拆分为单独的目录,则可以向顶级
Makefile.am
添加一些其他目标来执行部分测试套件运行。例如,如果您的树组织如下:
您可以将以下内容添加到 makefile:
现在,当您运行
make check-unit
时,它只会运行您的单元测试。运行 make check-integration 将运行另一半测试。标准make check
目标将继续运行整个套件。如果您无法将所有测试组织在一个目录下,则可以向目标添加额外的
$(MAKE)
调用。它确实需要了解顶层项目结构的一些知识,但没有明确的方法从子目录中的Makefile.am
文件向上传递所需信息。If you have split your test suite into separate directories based on the test type, then you can add some additional targets to the top level
Makefile.am
to do partial test suite runs.For example, if your tree is organised as:
You could add the following to the makefile:
Now when you run
make check-unit
, it will only run your unit tests. And runningmake check-integration
will run the other half of the tests. The standardmake check
target will continue to run the whole suite.If you can't organise all the tests under a single directory, you can add additional
$(MAKE)
invocations to the targets. It does require some knowledge of the project structure at the top level, but there isn't a clear way to pass the required information up from theMakefile.am
files in subdirectories.