On 02/28/2012 05:41 AM, Tim Landscheidt wrote:
Hi,
suppose I have a Makefile:
...
As in real-life scenarios there is seldomly a sleep 3 and
the bug will thus only show very randomly, I'm looking for a
way to smoke out such errors with a higher probability. One
idea would be to reverse the order of execution for targets
"on the same level": As the test suite will usually trigger
first generation of a.out, then b.out, if instead first
b.out was generated, the bug would surface.
Is there a way in GNU make to do this?
Another option is to use ElectricMake, which dynamically monitors
filesystem accesses to determine when commands have been run
out-of-order (with respect to a serial build), and reruns those commands
once it is safe to do so. After the build finishes, you can look at the
_history file_ that emake generated, which shows all the missing
dependencies (not just those that actually caused something to run
out-of-order in that particular run). Here's how that looks with your
example makefile:
$ emake --emake-localagents=y c.out
Starting build: local-build-id
sleep 3
touch a.out a1
cat a1 > b.out
cat a.out b.out > c.out
Finished build: local-build-id Duration: 0.03 (m:s)
$ showhist emake.data
(0 0 1) (0 0 0 b.out):
(0 0 1) (0 0 0 a.out)
emake will use the additional dependency information in the history file
to avoid making the same mistakes on the next run of the build
automatically, or if you like, you can take the information from the
history file and incorporate it back into your makefiles. ElectricMake
is GNU make compatible, so you don't have to change to a whole new build
system as you do with tup.
You can download ElectricMake here:
http://www.electric-cloud.com/products/electricaccelerator-dev.php?promo=help-make
Or read more about how emake detects and corrects out-of-order execution
in parallel builds:
http://blog.melski.net/2011/07/05/how-electricmake-guarantees-reliable-parallel-builds/
Disclaimer: I'm the architect of ElectricMake.
Best regards,
Eric Melski
_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make