tests: assorted fixes
Fixes developed while working on making tests run in gitlab CI:
- make tests work in out-of-tree builds
- Fix failure to make distcheck
- report failure if stderr has unexpected output
Fixes developed while working on making tests run in gitlab CI: