From 5ab1b99d6276af9b1ac9b77bff03601bea242b32 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Tue, 2 Oct 2018 16:45:38 +0200 Subject: [PATCH] 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 --- buildutil/tap-test | 6 ++---- tests/test-http-utils.sh | 46 ++++++++++++++++++++-------------------- tests/testlibrary.c | 2 +- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/buildutil/tap-test b/buildutil/tap-test index fd77f53d..2eacde52 100755 --- a/buildutil/tap-test +++ b/buildutil/tap-test @@ -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 diff --git a/tests/test-http-utils.sh b/tests/test-http-utils.sh index 45c2c9d3..c4107eae 100755 --- a/tests/test-http-utils.sh +++ b/tests/test-http-utils.sh @@ -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 diff --git a/tests/testlibrary.c b/tests/testlibrary.c index ecd21eec..f16025ca 100644 --- a/tests/testlibrary.c +++ b/tests/testlibrary.c @@ -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);