test: add TAP output to the test runner

This is a back-port of commit 14ed173 from the master branch.