build.sh: Improve support for building for testing