linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roberto Sassu <roberto.sassu@huawei.com>
To: <zohar@linux.ibm.com>
Cc: <pvorel@suse.cz>, <vt@altlinux.org>,
	<linux-integrity@vger.kernel.org>,
	Roberto Sassu <roberto.sassu@huawei.com>
Subject: [RFC][PATCH ima-evm-utils 6/7] Introduce TST_LIST variable to select a test to execute
Date: Thu, 22 Jul 2021 19:34:13 +0200	[thread overview]
Message-ID: <20210722173414.1738041-7-roberto.sassu@huawei.com> (raw)
In-Reply-To: <20210722173414.1738041-1-roberto.sassu@huawei.com>

It might be desirable, due to restrictions in the testing environment, to
execute tests individually. This patch introduces 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 9f05429d47ce..2602b4699f5c 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:[~2021-07-22 17:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22 17:34 [RFC][PATCH ima-evm-utils 0/7] ima-evm-utils: Add UML support and tests for EVM portable signatures Roberto Sassu
2021-07-22 17:34 ` [RFC][PATCH ima-evm-utils 1/7] Download UML kernel and signing key Roberto Sassu
2021-07-22 17:34 ` [RFC][PATCH ima-evm-utils 2/7] Download mount-idmapped Roberto Sassu
2021-07-22 17:34 ` [RFC][PATCH ima-evm-utils 3/7] Add additional options to the container engine Roberto Sassu
2021-07-22 17:34 ` [RFC][PATCH ima-evm-utils 4/7] Add functions to the testing library to run a test script with UML Roberto Sassu
2021-07-22 17:34 ` [RFC][PATCH ima-evm-utils 5/7] Signal failures of tests executed by UML kernel with unclean shutdown Roberto Sassu
2021-07-22 17:34 ` Roberto Sassu [this message]
2021-07-22 17:34 ` [RFC][PATCH ima-evm-utils 7/7] Add tests for EVM 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=20210722173414.1738041-7-roberto.sassu@huawei.com \
    --to=roberto.sassu@huawei.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=pvorel@suse.cz \
    --cc=vt@altlinux.org \
    --cc=zohar@linux.ibm.com \
    --subject='Re: [RFC][PATCH ima-evm-utils 6/7] Introduce TST_LIST variable to select a test to execute' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).