From: Gabriele Monaco <gmonaco@redhat.com>
To: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Gabriele Monaco <gmonaco@redhat.com>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org
Cc: Nam Cao <namcao@linutronix.de>,
Thomas Weissschuh <thomas.weissschuh@linutronix.de>,
Tomas Glozar <tglozar@redhat.com>, John Kacur <jkacur@redhat.com>,
Wen Yang <wen.yang@linux.dev>
Subject: [PATCH v3 15/17] selftests/verification: Fix wrong errexit assumption
Date: Thu, 25 Jun 2026 14:14:37 +0200 [thread overview]
Message-ID: <20260625121440.116317-16-gmonaco@redhat.com> (raw)
In-Reply-To: <20260625121440.116317-1-gmonaco@redhat.com>
RV selftest rely on bash errexit (set -e) to terminate with error, when
a step is expected to return false, the following syntax is used:
! cmd
This however prevents the test from exiting when cmd is false (desired)
but doesn't exit if cmd is true, since commands prefixed with ! are
explicitly excluded from errexit.
Use the syntax
! cmd || false
Which ends up checking the exit value of ! cmd and supplies a false
command for errexit to evaluate.
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
---
.../verification/test.d/rv_monitor_enable_disable.tc | 10 +++++-----
.../verification/test.d/rv_monitor_reactor.tc | 4 ++--
.../selftests/verification/test.d/rv_wwnr_printk.tc | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tools/testing/selftests/verification/test.d/rv_monitor_enable_disable.tc b/tools/testing/selftests/verification/test.d/rv_monitor_enable_disable.tc
index f29236defb..61e2c8b54d 100644
--- a/tools/testing/selftests/verification/test.d/rv_monitor_enable_disable.tc
+++ b/tools/testing/selftests/verification/test.d/rv_monitor_enable_disable.tc
@@ -10,7 +10,7 @@ test_simple_monitor() {
grep -q "$monitor$" enabled_monitors
echo 0 > "monitors/$prefix$monitor/enable"
- ! grep -q "$monitor$" enabled_monitors
+ ! grep -q "$monitor$" enabled_monitors || false
echo "$monitor" >> enabled_monitors
grep -q 1 "monitors/$prefix$monitor/enable"
@@ -34,12 +34,12 @@ test_container_monitor() {
test -n "$nested"
echo 0 > "monitors/$monitor/enable"
- ! grep -q "^$monitor$" enabled_monitors
+ ! grep -q "^$monitor$" enabled_monitors || false
for nested_dir in "monitors/$monitor"/*; do
[ -d "$nested_dir" ] || continue
nested=$(basename "$nested_dir")
- ! grep -q "^$monitor:$nested$" enabled_monitors
+ ! grep -q "^$monitor:$nested$" enabled_monitors || false
done
echo "$monitor" >> enabled_monitors
@@ -71,5 +71,5 @@ for monitor_dir in monitors/*; do
fi
done
-! echo non_existent_monitor > enabled_monitors
-! grep -q "^non_existent_monitor$" enabled_monitors
+! echo non_existent_monitor > enabled_monitors || false
+! grep -q "^non_existent_monitor$" enabled_monitors || false
diff --git a/tools/testing/selftests/verification/test.d/rv_monitor_reactor.tc b/tools/testing/selftests/verification/test.d/rv_monitor_reactor.tc
index 2958bf8493..516a209713 100644
--- a/tools/testing/selftests/verification/test.d/rv_monitor_reactor.tc
+++ b/tools/testing/selftests/verification/test.d/rv_monitor_reactor.tc
@@ -64,5 +64,5 @@ done
monitor=$(ls /sys/kernel/tracing/rv/monitors -1 | head -n 1)
test -f "monitors/$monitor/reactors"
-! echo non_existent_reactor > "monitors/$monitor/reactors"
-! grep -q "\\[non_existent_reactor\\]" "monitors/$monitor/reactors"
+! echo non_existent_reactor > "monitors/$monitor/reactors" || false
+! grep -q "\\[non_existent_reactor\\]" "monitors/$monitor/reactors" || false
diff --git a/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc b/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
index 5a59432b1d..96de95edb5 100644
--- a/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
+++ b/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
@@ -17,13 +17,13 @@ echo printk > monitors/wwnr/reactors
load
echo 0 > monitoring_on
-! load
+! load || false
echo 1 > monitoring_on
load
echo 0 > reacting_on
-! load
+! load || false
echo 1 > reacting_on
echo nop > monitors/wwnr/reactors
--
2.54.0
next prev parent reply other threads:[~2026-06-25 12:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 12:14 [PATCH v3 00/17] rv: Add selftests to tools and KUnit tests Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 01/17] rv: Use generic rv_this for the rv_monitor variable in LTL Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 02/17] tools/rv: Fix exit status when monitor execution fails Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 03/17] verification/rvgen: Improve rv_dir discovery in RVGenerator Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 04/17] tools/rv: Add selftests Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 05/17] verification/rvgen: Add golden and spec folders for tests Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 06/17] verification/rvgen: Add selftests Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 07/17] rv: Add KUnit stub to rv_react() and rv_*_task_monitor_slot() Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 08/17] rv: Export task monitor slot and react symbols Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 09/17] rv: Add KUnit tests for some DA/HA monitors Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 10/17] rv: Add KUnit stub for current Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 11/17] rv: Prevent unintentional tracepoints during KUnit tests Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 12/17] rv: Add KUnit tests for some LTL monitors Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 13/17] verification/rvgen: Add the rvgen kunit subcommand Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 14/17] verification/rvgen: Add selftests for rvgen kunit Gabriele Monaco
2026-06-25 12:14 ` Gabriele Monaco [this message]
2026-06-25 12:14 ` [PATCH v3 16/17] selftests/verification: Rearrange the wwnr_printk test Gabriele Monaco
2026-06-25 12:14 ` [PATCH v3 17/17] selftests/verification: Add selftests for deadline and stall monitors Gabriele Monaco
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=20260625121440.116317-16-gmonaco@redhat.com \
--to=gmonaco@redhat.com \
--cc=jkacur@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=namcao@linutronix.de \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
--cc=tglozar@redhat.com \
--cc=thomas.weissschuh@linutronix.de \
--cc=wen.yang@linux.dev \
/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