Made run_tests work on mac as well as linux

The previous version only worked on Linux.

This version uses Python instead of readlink.

Change-Id: If4e85b0f3b56b16a9fed3034a1d205b3cbf7dfae