mlafeldt/sharness — pull request #13 by grondo (2014-10-14 17:15:25+00:00)
Title: enhancements to ease integration of sharness into other projects

This pull request makes a few minor changes to `sharness.sh` making it slightly easier
to integrate sharness into projects without requiring much modification of the source.
It also enables sharness to work easily for projects where the directory of the sources
(i.e. the tests themselves) and the directory of the build products (and thus the directory in which
the tests are *run* during `make check`) are different.

The changes are pretty simple:

- Fix some assumptions that the directory in which tests are being run is the same as the
directory with the sources of the tests (and thus sharness.sh itself). With these fixes, it
is now possible to replace `. ./sharness.sh` with `. $(dirname $0)/sharness.sh` and then
run tests from an alternate directory. Test results and trash directories still go in the
current working directory. This may be required for projects using VPATH builds.
- Add a hook near the end of `sharness.sh` to load site or project specific extensions from
`$SHARNESS_TEST_SRCDIR/sharness.d/*.sh`. This allows per-project customization,
new test functions, etc to be added without modification of the sharness.sh itself.

There is also some simple tests for these new features added to `sharness.t`.

I understand if these changes are a bit too disruptive to accept. However, I decided to
propose them anyway, just in case they are useful for others.