Take the 2-minute tour ×

I have a ZF2 application that I've setup to be built using a Makefile with various options. The issue at hand is that the /vendors/ directory can contain an assortment of dependencies that are installed/updated via composer. Each dependency may, or may not contain unit tests, and the location of the tests are arbitrary.

When make test is run, I would like the Makefile to search through the /vendors/ directory for any folders named /tests/ and perform unit testing accordingly.

What would be the most optimal way to iterate through the vendors and locate any /tests/ directories to be able to perform unit testing?

share|improve this question
Just a side-note: It should not be necessary to unit-test the vendors. Since pretty much all of the Modules are run automatically over github via TravisCI. All running those tests does is: it costs you time and memory :P –  Sam Jan 16 '13 at 6:41
This would be true if we weren't using our own internal vendors that are not public repos. Support for private repositories is still currently in closed beta and we need a stable solution immediately. –  deo Jan 18 '13 at 13:46

1 Answer 1

up vote 1 down vote accepted

Use the wildcard function:

LIST_OF_TESTS:=$(wildcard vendors/*/tests)
share|improve this answer
Is there a way to make the wildcard function recursive? Using vendors/*/tests doesn't work, but vendors/*/*/tests does work for some reason. –  deo Jan 15 '13 at 14:45
I do not know your exact project layout... I guessed/hoped you had a vendors/*/tests layout (where the * is used to match any vendor name). I do not understand want you mean with 'Is there a way to make the wildcard function recursive?'... It is recursive and should find all matches. –  Veger Jan 15 '13 at 14:54
I thought that it would be recursive, but by using vendors/*/tests alone, it did not succeed in finding any tests directories within the vendors. The directory structure is arbitrary, the vendors directory contains libraries and modules created by 3rd parties, so there's no definitive tests directory locations, hence my request for a recursive version. Using vendors/*/*/tests appears to work correctly though. Thanks for your help, very much appreciated. –  deo Jan 15 '13 at 16:07

Your Answer


