public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: fstests@vger.kernel.org
Cc: linux-fscrypt@vger.kernel.org, Andrey Albershteyn <aalbersh@redhat.com>
Subject: [xfstests PATCH v2 3/3] tests: fix some tests for systems with fs.verity.require_signatures=1
Date: Fri,  4 Nov 2022 13:58:30 -0700	[thread overview]
Message-ID: <20221104205830.130132-4-ebiggers@kernel.org> (raw)
In-Reply-To: <20221104205830.130132-1-ebiggers@kernel.org>

From: Eric Biggers <ebiggers@google.com>

Some of the newer verity tests don't work properly on systems where
fs.verity.require_signatures is enabled, either because they forget to
disable it at the beginning of the test, or they forget to re-enable it
afterwards, or both.  Fix this.

Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 tests/btrfs/290   | 9 +++++++++
 tests/btrfs/291   | 2 ++
 tests/generic/624 | 8 ++++++++
 tests/generic/692 | 8 ++++++++
 4 files changed, 27 insertions(+)

diff --git a/tests/btrfs/290 b/tests/btrfs/290
index b7254c5e..06a58f47 100755
--- a/tests/btrfs/290
+++ b/tests/btrfs/290
@@ -15,6 +15,14 @@ _begin_fstest auto quick verity
 . ./common/filter
 . ./common/verity
 
+# Override the default cleanup function.
+_cleanup()
+{
+	cd /
+	_restore_fsverity_signatures
+	rm -f $tmp.*
+}
+
 # real QA test starts here
 _supported_fs btrfs
 _require_scratch_verity
@@ -24,6 +32,7 @@ _require_xfs_io_command "falloc"
 _require_xfs_io_command "pread"
 _require_xfs_io_command "pwrite"
 _require_btrfs_corrupt_block
+_disable_fsverity_signatures
 
 get_ino() {
 	local file=$1
diff --git a/tests/btrfs/291 b/tests/btrfs/291
index bbdd183d..c5947133 100755
--- a/tests/btrfs/291
+++ b/tests/btrfs/291
@@ -23,6 +23,7 @@ _cleanup()
 	rm -f $img
 	$LVM_PROG vgremove -f -y $vgname >>$seqres.full 2>&1
 	losetup -d $loop_dev >>$seqres.full 2>&1
+	_restore_fsverity_signatures
 }
 
 # Import common functions.
@@ -43,6 +44,7 @@ _require_command $LVM_PROG lvm
 _require_scratch_verity
 _require_btrfs_command inspect-internal dump-tree
 _require_test_program "log-writes/replay-log"
+_disable_fsverity_signatures
 
 sync_loop() {
 	i=$1
diff --git a/tests/generic/624 b/tests/generic/624
index 89fbf256..7c447289 100755
--- a/tests/generic/624
+++ b/tests/generic/624
@@ -10,6 +10,14 @@
 . ./common/preamble
 _begin_fstest auto quick verity
 
+# Override the default cleanup function.
+_cleanup()
+{
+	cd /
+	_restore_fsverity_signatures
+	rm -f $tmp.*
+}
+
 . ./common/filter
 . ./common/verity
 
diff --git a/tests/generic/692 b/tests/generic/692
index 0bb1fd33..d6da734b 100644
--- a/tests/generic/692
+++ b/tests/generic/692
@@ -15,6 +15,13 @@
 . ./common/preamble
 _begin_fstest auto quick verity
 
+# Override the default cleanup function.
+_cleanup()
+{
+	cd /
+	_restore_fsverity_signatures
+	rm -f $tmp.*
+}
 
 # Import common functions.
 . ./common/filter
@@ -26,6 +33,7 @@ _require_test
 _require_math
 _require_scratch_verity
 _require_fsverity_max_file_size_limit
+_disable_fsverity_signatures
 
 _scratch_mkfs_verity &>> $seqres.full
 _scratch_mount
-- 
2.38.1


      parent reply	other threads:[~2022-11-04 20:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04 20:58 [xfstests PATCH v2 0/3] Fix test bugs related to fs.verity.require_signatures Eric Biggers
2022-11-04 20:58 ` [xfstests PATCH v2 1/3] common/verity: fix _fsv_have_hash_algorithm() with required signatures Eric Biggers
2022-11-04 20:58 ` [xfstests PATCH v2 2/3] generic/577: add missing file removal before empty file test Eric Biggers
2022-11-04 20:58 ` Eric Biggers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221104205830.130132-4-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=aalbersh@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox