I am refining my Makefile.am
file now. The script would skip some non-essential test if the environment does not match the requirement. I want to notify the user that some tests are skipped.
I have tried to add some .PHONY
target to TESTS
array. Such as:
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
However, the test-driver
checks the existence of those target regardless .PHONY
setting. The test-suite.log
will be like this:
FAIL: skip-python-test
======================
./test-driver: line 95: ./skip-python-test: No such file or directory
How to refine my Makefile.am
? Or what is the best way to do it?
You can add a check-local
target conditionally — see Extending Automake for the details. Basically you can make it conditional so that you'd end up with:
if HAVE_PYTHON
…
else
check-local: skip-python-test
endif
skip-python-test:
@echo "Python not detected, will skip some tests."
and that should work; alternatively you can do that in configure.ac
so that the user can notice right away that they should install more dependencies to have full test coverage.