File: tap-test

package info (click to toggle)
flatpak 1.17.3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 13,508 kB
  • sloc: ansic: 104,079; xml: 12,184; sh: 5,297; python: 2,315; yacc: 1,236; makefile: 84; csh: 20
file content (25 lines) | stat: -rwxr-xr-x 583 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /bin/bash
#
# Run a test in tap mode, ensuring we have a temporary directory.
#
# The test binary is passed as $1

srcd=$(cd $(dirname $1) && pwd)
bn=$(basename $1)
shift
tempdir=$(mktemp -d /tmp/tap-test.XXXXXX)
touch ${tempdir}/.testtmp
function cleanup () {
    if test -n "${TEST_SKIP_CLEANUP:-}"; then
        echo "Skipping cleanup of ${tempdir}"
    else if test -f ${tempdir}/.testtmp; then
        rm "${tempdir}" -rf
    fi
    fi
}
trap cleanup EXIT
cd ${tempdir}
if [[ $bn == *.wrap ]]; then
    WRAPPER=${srcd}/test-wrapper.sh
fi
$WRAPPER ${srcd}/${bn} -k --tap "$@"