views:

89

answers:

3

There is a number of unit test frameworks for most of the languages, but I haven't come across a unit test for GNU make. It has conditionals, loops (the $(foreach ...) statement), and allows to write pretty sophisticated code. The examples might be things like BSD ports, GARNOME, and OpenCSW GAR.

There's also a debugger for GNU make. However, I've never come across a unit test framework for it. Is there anything like this in existence?

A: 

The makefiles for Perl, PHP, Python, GHC and GCC (amongst open source projects I could think of off the top of my head and had lying around on my machine) all have 'test' targets, which I think would make interesting reading.

Andrew McGregor
-1 He's not talking about using make to test other stuff. He's talking about testing the makefiles.
Tomas
D'oh! Missed the point. There *is* some code in autotools that tests if make is sane... but that doesn't amount to a unit testing framework.
Andrew McGregor
+1  A: 

Unit-tests usually assumes that the language has some form of mechanism for modularization, which GNU make really doesn't have. What would be the "units" you would be testing? Individual targets? How would you set up the inputs/outputs of each test?

Also, since makefiles are executed during build, one could argue that the makefiles "test themselves", leaving little room for explicit "makefile test suites" to do any good.

JesperE
A: 

I would also see the build itself as the integration-test.

Usually problems with the build pop up early, especially if you have a working continous integration setup. In our case we have all possible build-paths run regularly run on our ci-servers (the software is constantly built and deployed).

As far as I remember if there was a problem with a build-script ci showed us a crash instantly, for instance because tar-ball could not be built, or application couldn't be started due to missing artifacts.

For above reasons, I think trying to unit-test the build-files itself involves too much effort, which could be spent better in setting up or extending continous integration.

manuel aldana