Instead of assuming tmp is clear and safe for our use do something like:

    AUTOTEST_DIR=$(mktemp -d)
    trap 'cd /; rm -rf "${AUTOTEST_DIR}"' EXIT
    cd "${AUTOTEST_DIR}"

That will ensure you don't conflict with sutff left in /tmp by other people and you'll clean up after yourself too!