Testing 无论如何,在Automake';让我们核对一下吧?

Testing 无论如何,在Automake';让我们核对一下吧?,testing,makefile,autotools,automake,notice,Testing,Makefile,Autotools,Automake,Notice,我正在完善我的Makefile.am文件。如果环境不符合要求,脚本将跳过一些非必要的测试。我想通知用户跳过了一些测试 我尝试将一些.PHONY目标添加到测试数组中。例如: if HAVE_PYTHON # something to do with python else #HAVE_PYTHON TESTS += skip-python-test .PHONY: skip-python-test skip-python-test: @echo "Python is not detecte

我正在完善我的
Makefile.am
文件。如果环境不符合要求,脚本将跳过一些非必要的测试。我想通知用户跳过了一些测试

我尝试将一些
.PHONY
目标添加到
测试
数组中。例如:

if HAVE_PYTHON
# something to do with python
else #HAVE_PYTHON
TESTS += skip-python-test
.PHONY: skip-python-test
skip-python-test:
    @echo "Python is not detected"
    @echo "Will skip some test"
endif #HAVE_PYTHON
但是,
测试驱动程序
会检查这些目标是否存在,而不管
.PHONY
设置如何。
测试套件.log
如下:

FAIL: skip-python-test
======================

./test-driver: line 95: ./skip-python-test: No such file or directory

如何优化我的
Makefile.am
?或者最好的方法是什么?

您可以添加一个有条件地检查本地的
目标-有关详细信息,请参阅。基本上,您可以将其设置为有条件的,这样您就可以得到:

if HAVE_PYTHON
  …
else
  check-local: skip-python-test
endif

skip-python-test:
    @echo "Python not detected, will skip some tests."
这应该行得通;或者,您可以在
configure.ac
中执行此操作,以便用户可以立即注意到,他们应该安装更多的依赖项以实现完整的测试覆盖