How's this look? I've only tested it lightly, but it should be pretty close; with this, "make test" ought to recurse down into programs/cmd/tests and run the cmd tests, too.
Shortcomings: - I don't think I need chomp() in tests/cmd.c anymore, that was a workaround - I think I can turn on echo again in tests/*.cmd, that was another workaround - I have yet to add a way to specify that a test is todo_wine
Feedback welcome. I'll try to submit something tomorrow that takes care of the above known issues and any issues anyone else points out.
(I'm actually kind of amazed the build machinery changes work, I didn't really take the time to understand all of the gears and pulleys.)