All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roberto Sassu <roberto.sassu@huaweicloud.com>
To: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com
Cc: linux-integrity@vger.kernel.org, vt@altlinux.org, pvorel@suse.cz,
	stefanb@linux.ibm.com, Roberto Sassu <roberto.sassu@huawei.com>
Subject: [PATCH ima-evm-utils v4 08/11] Adapt fsverity.test to be able to run in a new testing environment
Date: Thu, 26 Jan 2023 14:58:04 +0100	[thread overview]
Message-ID: <20230126135807.1848668-9-roberto.sassu@huaweicloud.com> (raw)
In-Reply-To: <20230126135807.1848668-1-roberto.sassu@huaweicloud.com>

From: Roberto Sassu <roberto.sassu@huawei.com>

Adapt fsverity.test by adding calls to the testing environment API in
functions.sh. If TST_ENV is set, create a new environment and run the
kernel specified with the TST_KERNEL environment variable. Otherwise, keep
the current behavior.

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
---
 tests/fsverity.test | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/fsverity.test b/tests/fsverity.test
index be9594010de5..8261de4ea3c9 100755
--- a/tests/fsverity.test
+++ b/tests/fsverity.test
@@ -47,7 +47,7 @@ FSVERITY="$(which fsverity)"
 _require dd mkfs blkid e2fsck tune2fs evmctl setfattr
 ./gen-keys.sh >/dev/null 2>&1
 
-trap '_report_exit_and_cleanup cleanup' SIGINT SIGTERM EXIT
+trap '_report_exit_and_cleanup _cleanup_env cleanup' SIGINT SIGTERM EXIT
 
 cleanup() {
         if [ -e $TST_MNT ]; then
@@ -308,6 +308,15 @@ measure-ima() {
 	return "$error"
 }
 
+# Run in the new environment if TST_ENV is set.
+_run_env "$TST_KERNEL" "$PWD/$(basename "$0")" "TST_ENV=$TST_ENV TST_KERNEL=$TST_KERNEL PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH VERBOSE=$VERBOSE"
+
+# Exit from the creator of the new environment.
+_exit_env "$TST_KERNEL"
+
+# Mount filesystems in the new environment.
+_init_env
+
 # Dependency on being able to read and write the IMA policy file.
 # Requires both CONFIG_IMA_WRITE_POLICY, CONFIG_IMA_READ_POLICY be
 # enabled.
-- 
2.25.1


  parent reply	other threads:[~2023-01-26 13:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 13:57 [PATCH ima-evm-utils v4 00/11] Support testing in new enviroments Roberto Sassu
2023-01-26 13:57 ` [PATCH ima-evm-utils v4 01/11] Fix error messages and vars in calc_evm_hmac() Roberto Sassu
2023-01-26 13:57 ` [PATCH ima-evm-utils v4 02/11] Add kernel configuration for tests Roberto Sassu
2023-01-26 15:41   ` Stefan Berger
2023-01-26 13:57 ` [PATCH ima-evm-utils v4 03/11] Compile the UML kernel and download it in Github Actions Roberto Sassu
2023-01-26 13:58 ` [PATCH ima-evm-utils v4 04/11] Pass cleanup function and its arguments to _report_exit_and_cleanup() Roberto Sassu
2023-01-26 13:58 ` [PATCH ima-evm-utils v4 05/11] Add support for creating a new testing environment in functions.sh Roberto Sassu
2023-01-26 15:55   ` Stefan Berger
2023-01-26 13:58 ` [PATCH ima-evm-utils v4 06/11] Introduce TST_LIST variable to select a test to execute Roberto Sassu
2023-01-26 13:58 ` [PATCH ima-evm-utils v4 07/11] Add tests for EVM portable signatures Roberto Sassu
2023-01-26 13:58 ` Roberto Sassu [this message]
2023-01-26 13:58 ` [PATCH ima-evm-utils v4 09/11] Use in-place built fsverity binary instead of installing it Roberto Sassu
2023-01-26 13:58 ` [PATCH ima-evm-utils v4 10/11] ci: haveged requires EPEL on CentOS stream:8 Roberto Sassu
2023-01-26 13:58 ` [PATCH ima-evm-utils v4 11/11] Temporarily remove CONFIG_DEBUG_SG to test portable signatures Roberto Sassu

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=20230126135807.1848668-9-roberto.sassu@huaweicloud.com \
    --to=roberto.sassu@huaweicloud.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=pvorel@suse.cz \
    --cc=roberto.sassu@huawei.com \
    --cc=stefanb@linux.ibm.com \
    --cc=vt@altlinux.org \
    --cc=zohar@linux.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.