Then I don't know what to do here, because realpath isn't on my system (CentOS 6). I originally had:

    TEST_ROOT=$(cd $( dirname $0 ) && pwd)

Is that better?