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,
	Roberto Sassu <roberto.sassu@huawei.com>
Subject: [PATCH ima-evm-utils 5/8] Introduce TST_LIST variable to select a test to execute
Date: Mon,  9 Jan 2023 17:55:49 +0100	[thread overview]
Message-ID: <20230109165552.3409716-6-roberto.sassu@huaweicloud.com> (raw)
In-Reply-To: <20230109165552.3409716-1-roberto.sassu@huaweicloud.com>

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

It might be desirable, due to restrictions in the testing environment, to
execute tests individually. Introduce the TST_LIST variable, which can be
set with the name of the test to execute. If the variable is set,
expect_pass and expect_fail automatically skip the tests when the first
argument of those functions does not match the value of TST_LIST.

TST_LIST can be also used in conjunction with the UML kernel. It is
sufficient to add it to the kernel command line.

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
 tests/functions.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/functions.sh b/tests/functions.sh
index 98829d94fae1..298c30393ce6 100755
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -72,6 +72,12 @@ declare -i TNESTED=0 # just for sanity checking
 expect_pass() {
   local -i ret
 
+  if [ -n "$TST_LIST" ] && [ "${TST_LIST/$1/}" = $TST_LIST ]; then
+    [ "$VERBOSE" -gt 1 ] && echo "____ SKIP test: $*"
+    testsskip+=1
+    return $SKIP
+  fi
+
   if [ $TNESTED -gt 0 ]; then
     echo $RED"expect_pass should not be run nested"$NORM
     testsfail+=1
@@ -98,6 +104,12 @@ expect_pass() {
 expect_fail() {
   local ret
 
+  if [ -n "$TST_LIST" ] && [ "${TST_LIST/$1/}" = $TST_LIST ]; then
+    [ "$VERBOSE" -gt 1 ] && echo "____ SKIP test: $*"
+    testsskip+=1
+    return $SKIP
+  fi
+
   if [ $TNESTED -gt 0 ]; then
     echo $RED"expect_fail should not be run nested"$NORM
     testsfail+=1
-- 
2.25.1


  parent reply	other threads:[~2023-01-09 16:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 16:55 [PATCH ima-evm-utils 0/8] Support testing with UML kernel Roberto Sassu
2023-01-09 16:55 ` [PATCH ima-evm-utils 1/8] Fix error messages and mdlen init in calc_evm_hmac() Roberto Sassu
2023-01-09 16:55 ` [PATCH ima-evm-utils 2/8] Add config for UML kernel Roberto Sassu
2023-01-09 16:55 ` [PATCH ima-evm-utils 3/8] Compile the UML kernel and download it in Github Actions Roberto Sassu
2023-01-10 15:14   ` Mimi Zohar
2023-01-10 15:23     ` Roberto Sassu
2023-01-09 16:55 ` [PATCH ima-evm-utils 4/8] Add support for UML in functions.sh Roberto Sassu
2023-01-09 16:55 ` Roberto Sassu [this message]
2023-01-09 16:55 ` [PATCH ima-evm-utils 6/8] Add tests for EVM portable signatures Roberto Sassu
2023-01-09 16:55 ` [PATCH ima-evm-utils 7/8] Adapt fsverity.test to work with UML kernel Roberto Sassu
2023-01-09 16:55 ` [PATCH ima-evm-utils 8/8] Use in-place built fsverity binary instead of installing it 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=20230109165552.3409716-6-roberto.sassu@huaweicloud.com \
    --to=roberto.sassu@huaweicloud.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=roberto.sassu@huawei.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.