Refactor tests for better portability, other fixes

* added test.utils.which to determine PATH of standard utilities
* added missing "." in test build script
* now using os.path.realpath on run_job tmp directory