Also enables the packages' tests. The tests need a few patches to fix runtime generated script's shebangs. There is also a fix to pass PATH environment variable to subprocess' calls so that they can find some binaries (like xterm).