tests: Run in /tmp

These days we don't really need xattrs for the tests to run,
so move the test runs to /tmp, which brings down make check time
from 5 to 3.5 minutes on my machine.

Closes: #2170
Approved by: alexlarsson
This commit is contained in:
Alexander Larsson 2018-10-02 16:45:38 +02:00 committed by Atomic Bot
parent 5fa3fbf19e
commit 5ab1b99d62
3 changed files with 26 additions and 28 deletions

View File

@ -1,14 +1,12 @@
#! /bin/bash
#
# Run a test in tap mode, ensuring we have a temporary directory. We
# always use /var/tmp because we might want to use user xattrs, which
# aren't available on tmpfs.
# 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)
tempdir=$(mktemp -d /var/tmp/tap-test.XXXXXX)
tempdir=$(mktemp -d /tmp/tap-test.XXXXXX)
touch ${tempdir}/.testtmp
function cleanup () {
if test -n "${TEST_SKIP_CLEANUP:-}"; then

View File

@ -128,33 +128,33 @@ rm -f $test_tmpdir/output*
echo 'ok compress after download'
# Testing that things work with without xattr support
# Testing that things work without xattr support
if have_xattrs $test_tmpdir ; then
echo "ok no-xattrs # skip /tmp doesn't have user xattr support"
else
assert_ok "/?etag&no-cache" $test_tmpdir/output
assert_not_has_file $test_tmpdir/output.flatpak.http
assert_has_file $test_tmpdir/output.flatpak.http
assert_304 "/?etag&no-cache" $test_tmpdir/output
rm -f $test_tmpdir/output*
echo "ok with-xattrs"
else
echo "ok with-xattrs # skip /var/tmp doesn't have user xattr support"
fi
# Testing fallback without xattr support
no_xattrs_tempdir=`mktemp -d /tmp/test-flatpak-XXXXXX`
no_xattrs_cleanup () {
rm -rf test_tmpdir
cleanup
}
trap no_xattrs_cleanup EXIT
if have_xattrs $no_xattrs_tempdir ; then
echo "ok no-xattrs # skip /tmp has user xattr support"
else
assert_ok "/?etag&no-cache" $no_xattrs_tempdir/output
assert_has_file $no_xattrs_tempdir/output.flatpak.http
assert_304 "/?etag&no-cache" $no_xattrs_tempdir/output
rm -f $no_xattrs_tempdir/output*
echo "ok no-xattrs"
fi
# Testing with xattr support
xattrs_tempdir=`mktemp -d /var/tmp/test-flatpak-XXXXXX`
xattrs_cleanup () {
rm -rf xattrs_tempdir
cleanup
}
trap xattrs_cleanup EXIT
if have_xattrs $xattrs_tempdir ; then
assert_ok "/?etag&no-cache" $xattrs_tempdir/output
assert_not_has_file $xattrs_tempdir/output.flatpak.http
assert_304 "/?etag&no-cache" $xattrs_tempdir/output
rm -f $xattrs_tempdir/output*
echo "ok xattrs"
else
echo "ok xattrs # skip /var/tmp has user no xattr support"
fi

View File

@ -1141,7 +1141,7 @@ global_setup (void)
g_autofree char *datadir = NULL;
g_autofree char *homedir = NULL;
testdir = g_strdup ("/var/tmp/flatpak-test-XXXXXX");
testdir = g_strdup ("/tmp/flatpak-test-XXXXXX");
g_mkdtemp (testdir);
g_test_message ("testdir: %s", testdir);