summaryrefslogtreecommitdiff
path: root/buildutil/tap-test
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2016-04-27 16:31:27 +0200
committerAlexander Larsson <alexl@redhat.com>2016-04-27 16:37:15 +0200
commit3d3ebf814dc714a06793696bb21190fa2815ebca (patch)
tree26490725bdfe1b0c2590731c8d6c998869ec243a /buildutil/tap-test
parentbc7bfeef6fc2f49c19ed94e91b903b0b454820b5 (diff)
downloadxdg-app-3d3ebf814dc714a06793696bb21190fa2815ebca.tar.gz
Support installed tests
Diffstat (limited to 'buildutil/tap-test')
-rwxr-xr-xbuildutil/tap-test23
1 files changed, 23 insertions, 0 deletions
diff --git a/buildutil/tap-test b/buildutil/tap-test
new file mode 100755
index 0000000..6b2eb5c
--- /dev/null
+++ b/buildutil/tap-test
@@ -0,0 +1,23 @@
+#! /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)
+tempdir=$(mktemp -d /var/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}
+${srcd}/${bn} -k --tap