add bin/test

Runs tests and sets up rootfs. Intended for use on Travis but also works
locally.

Added some linux flags for files that cannot be compiled on other systems.