Returning failure exit code for test scripts.

Tests run within scripts were failing silently. I added bash logic after
test runs to check previous exit status and exit the script with a
failure code if the test commands failed.
Updating exit logic with something much simpler.
Merge pull request #1294 from rhyolight/fix-script-exit-codes-failure

Returning failure exit code for test scripts.