From 8a21f2dfe13bb850d771aef6429f0584e07795a2 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Thu, 28 Aug 2025 15:58:46 +0200 Subject: [PATCH] tests/test-http-utils.sh: Only use have_xattr if we have setfattr Otherwise we try to call setfattr which fails and have_xattr reports that there is no xattr support. This might then obviously be wrong and the test can fail because of that. --- tests/test-http-utils.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test-http-utils.sh b/tests/test-http-utils.sh index ede32621..1d27f8d8 100755 --- a/tests/test-http-utils.sh +++ b/tests/test-http-utils.sh @@ -128,14 +128,15 @@ ok 'compress after download' # Testing that things work without xattr support -if have_xattrs $test_tmpdir ; then - ok "no-xattrs # skip /tmp doesn't have user xattr support" -else +if command -v setfattr >/dev/null && + ! have_xattrs $test_tmpdir ; then assert_ok "/?etag&no-cache" $test_tmpdir/output assert_has_file $test_tmpdir/output.flatpak.http assert_304 "/?etag&no-cache" $test_tmpdir/output rm -f $test_tmpdir/output* ok "no-xattrs" +else + ok "no-xattrs # skip No setfattr or /tmp doesn't have user xattr support" fi # Testing with xattr support @@ -147,12 +148,13 @@ xattrs_cleanup () { } trap xattrs_cleanup EXIT -if have_xattrs $xattrs_tempdir ; then +if command -v setfattr >/dev/null && + 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* ok "xattrs" else - ok "xattrs # skip /var/tmp has user no xattr support" + ok "xattrs # skip No setfattr or /var/tmp has user no xattr support" fi