tap-test: fix typo and actually create .test marker

We have this chunk in tap-test:

    if test -f ${test_tmpdir}/.test; then
      rm "${tempdir}" -rf
    fi

But (1) we were never actually touching `.test` and (2), we were
checking in `test_tmpdir` instead of `tmpdir`. This meant that the test
dirs were never actually cleaned up.

Create the marker file and make sure we rm the right dir. Also re-indent
to remove tabs.

Closes: #854
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2017-06-28 14:52:22 -07:00 committed by Atomic Bot
parent 137271efee
commit 0fafd8ea18

View File

@ -1,19 +1,21 @@
#! /bin/bash
set -euo pipefail
# run a GTest in tap mode. The test binary is passed as $1
srcd=$(cd $(dirname $1) && pwd)
bn=$(basename $1)
tempdir=$(mktemp -d)
test_tmpdir=$(mktemp -d)
function cleanup () {
if test -z "${TEST_SKIP_CLEANUP:-}"; then
if test -f ${test_tmpdir}/.test; then
rm "${tempdir}" -rf
fi
else
echo "Skipping cleanup of ${test_tmpdir}"
if test -z "${TEST_SKIP_CLEANUP:-}"; then
if test -f ${test_tmpdir}/.test; then
rm "${test_tmpdir}" -rf
fi
else
echo "Skipping cleanup of ${test_tmpdir}"
fi
}
trap cleanup EXIT
cd ${tempdir}
cd ${test_tmpdir}
touch .test
${srcd}/${bn} -k --tap