Make sure the test target exits with an appropriate error code.
Fix a few tests, and fix the expansion of '%' to be relative rather than
an absolute path.