Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 01/29] support/testing: infra: add assertRunNotOk()
@ 2026-06-18 12:47 Peter Korsgaard
  2026-06-18 12:47 ` [Buildroot] [PATCH 02/29] support/testing: test_systemd.py: use assertRun{, Not}Ok() Peter Korsgaard
                   ` (29 more replies)
  0 siblings, 30 replies; 32+ messages in thread
From: Peter Korsgaard @ 2026-06-18 12:47 UTC (permalink / raw)
  To: buildroot; +Cc: Ricardo Martincoski

There are a number of runtime tests that checks that a command fails as
expected, so add an assertRunNotOk() similar to the existing assertRunOk()
to handle that instead of open coding it everywhere.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 support/testing/infra/basetest.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/support/testing/infra/basetest.py b/support/testing/infra/basetest.py
index 5fa902a77f..9b3eef6fa8 100644
--- a/support/testing/infra/basetest.py
+++ b/support/testing/infra/basetest.py
@@ -150,3 +150,14 @@ class BRTest(BRConfigTest):
             0,
             "\nFailed to run: {}\noutput was:\n{}".format(cmd, '  '+'\n  '.join(out))
         )
+
+    # Run the given 'cmd' with a 'timeout' on the target and
+    # assert that the command fails; on success, print the
+    # faulty command and its output
+    def assertRunNotOk(self, cmd, timeout=-1):
+        out, exit_code = self.emulator.run(cmd, timeout)
+        self.assertNotEqual(
+            exit_code,
+            0,
+            "\nUnexpected success: {}\noutput was:\n{}".format(cmd, '  '+'\n  '.join(out))
+        )
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2026-06-19  9:03 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-18 12:47 [Buildroot] [PATCH 01/29] support/testing: infra: add assertRunNotOk() Peter Korsgaard
2026-06-18 12:47 ` [Buildroot] [PATCH 02/29] support/testing: test_systemd.py: use assertRun{, Not}Ok() Peter Korsgaard
2026-06-18 12:47 ` [Buildroot] [PATCH 03/29] support/testing: test_acl.py: use assertRunNotOk() Peter Korsgaard
2026-06-18 12:47 ` [Buildroot] [PATCH 04/29] support/testing: test_audit.py: " Peter Korsgaard
2026-06-18 12:47 ` [Buildroot] [PATCH 05/29] support/testing: test_bitcoin.py: " Peter Korsgaard
2026-06-18 12:47 ` [Buildroot] [PATCH 06/29] support/testing: test_connman.py: " Peter Korsgaard
2026-06-18 12:47 ` [Buildroot] [PATCH 07/29] support/testing: test_cryptsetup.py: " Peter Korsgaard
2026-06-18 12:47 ` [Buildroot] [PATCH 08/29] support/testing: test_ddrescue.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 09/29] support/testing: test_dos2unix.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 10/29] support/testing: test_fping.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 11/29] support/testing: test_gnupg2.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 12/29] support/testing: test_iproute2.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 13/29] support/testing: test_iptables.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 14/29] support/testing: test_jq.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 15/29] support/testing: test_kmod.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 16/29] support/testing: test_libgpgme.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 17/29] support/testing: test_lsof.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 18/29] support/testing: test_mariadb.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 19/29] support/testing: test_mtools.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 20/29] support/testing: test_nftables.py: " Peter Korsgaard
2026-06-18 21:24   ` Fiona Klute via buildroot
2026-06-18 12:48 ` [Buildroot] [PATCH 21/29] support/testing: test_octave.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 22/29] support/testing: test_polkit.py: use assertRun{, Not}Ok() Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 23/29] support/testing: test_postgresql.py: use assertRunNotOk() Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 24/29] support/testing: test_rasdaemon.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 25/29] support/testing: test_screen.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 26/29] support/testing: test_swipl.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 27/29] support/testing: test_usbip.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 28/29] support/testing: test_weston.py: " Peter Korsgaard
2026-06-18 12:48 ` [Buildroot] [PATCH 29/29] support/testing: test_which.py: " Peter Korsgaard
2026-06-18 21:23 ` [Buildroot] [PATCH 01/29] support/testing: infra: add assertRunNotOk() Fiona Klute via buildroot
2026-06-19  9:02 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox