Improve build-test.sh for non-travis-ci usage