Fix test script to work in external build directory