Exit with code 1 if tests fail.

Fixes #621 and Travis.
Merge pull request #682 from kuyan/patch-1

Use correct exit code when running tests.