tests: Refactor testlib to simplify and fix Cygwin build

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
5 files changed