Convert run tests to python

Convert the run tests scripts fro shell to python, so it's easier to hack and extend,
Right now, it's meant to do exactly the same as the replaces shell code.
Generally speaking, you should avoid building command lines with string concatenation. The `subprocess` module allows passing lists of arguments to `call` / `Popen`, and this will make the code much clearer, and avoid funky issues with quoting and spaces.