Make tests more unit test like, abort when one fails.

This allows for better integration with continuous integration, as well
as making the test.c source code a bit more modular.
Add noreturn attribute to thrd_exit on GCC.