mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-23 21:35:26 +03:00
335f914d48
Allow developers to override the default /var/tmp dir, which e.g. might be on overlayfs and thus produces reduced coverage. Closes: #1207 Approved by: cgwalters
40 lines
861 B
Bash
Executable File
40 lines
861 B
Bash
Executable File
#! /bin/bash
|
|
#
|
|
# Run a test in tap mode, ensuring we have a temporary directory. We
|
|
# always use /var/tmp becuase we might want to use user xattrs, which
|
|
# aren't available on tmpfs.
|
|
#
|
|
# The test binary is passed as $1
|
|
|
|
srcd=$(cd $(dirname $1) && pwd)
|
|
bn=$(basename $1)
|
|
TEST_TMPDIR=${TEST_TMPDIR:-/var/tmp}
|
|
tempdir=$(mktemp -d $TEST_TMPDIR/tap-test.XXXXXX)
|
|
touch ${tempdir}/.testtmp
|
|
function cleanup () {
|
|
if test -f ${tempdir}/.testtmp; then
|
|
rm "${tempdir}" -rf
|
|
fi
|
|
}
|
|
function skip_cleanup() {
|
|
echo "Skipping cleanup of ${tempdir}"
|
|
}
|
|
cd ${tempdir}
|
|
timeout \
|
|
--kill-after=60 \
|
|
--signal=ABRT \
|
|
$(( 600 * ${TEST_TIMEOUT_FACTOR:-1} )) \
|
|
${srcd}/${bn} -k --tap
|
|
rc=$?
|
|
case "${TEST_SKIP_CLEANUP:-}" in
|
|
no|"") cleanup ;;
|
|
err)
|
|
if test $rc != 0; then
|
|
skip_cleanup
|
|
else
|
|
cleanup
|
|
fi ;;
|
|
*) skip_cleanup ;;
|
|
esac
|
|
exit $rc
|