Skip to contentSkip to conversation

support/testing: infra: add assertRunNotOk()

PATCH Applied Peter Korsgaard 2 participants 60 messages Jun 18 – Jun 26

lore
Share & tools
lore
#0 lore raw

PATCH 1/29 support/testing: infra: add assertRunNotOk()

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.

---
 support/testing/infra/basetest.py | 11 +++++++++++
 1 file changed, 11 insertions(+)
support/testing/infra/basetest.py +11 -0
index 5fa902a77f..9b3eef6fa8 100644
@@ -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))
+        )
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/29 support/testing: test_systemd.py: use assertRun{, Not}Ok()

Use the helpers to simplify the test.

---
 support/testing/tests/init/test_systemd.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
support/testing/tests/init/test_systemd.py +3 -6
index 472a65db57..60b9c3d032 100644
@@ -340,19 +340,16 @@ class InitSystemSystemdBaseOverlayfs():
 
         # /var/foo/bar is from the pre-populated /var, so it should
         # not be present in the upper of the overlay
-        _, exit_code = self.emulator.run("test -e /run/buildroot/mounts/var/upper/foo/bar")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("test -e /run/buildroot/mounts/var/upper/foo/bar")
 
         # We can write in /var/foo/bar
-        _, exit_code = self.emulator.run("echo barfoo >/var/foo/bar")
-        self.assertEqual(exit_code, 0)
+        self.assertRunOk("echo barfoo >/var/foo/bar")
         # ... and it contains the new content
         out, exit_code = self.emulator.run("cat /var/foo/bar")
         self.assertEqual(exit_code, 0)
         self.assertEqual(out[0], "barfoo")
         # ... and it to appears in the upper
-        _, exit_code = self.emulator.run("test -e /run/buildroot/mounts/var/upper/foo/bar")
-        self.assertEqual(exit_code, 0)
+        self.assertRunOk("test -e /run/buildroot/mounts/var/upper/foo/bar")
         # ... with the new content
         out, exit_code = self.emulator.run("cat /run/buildroot/mounts/var/upper/foo/bar")
         self.assertEqual(exit_code, 0)
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 02/29] support/testing: test_systemd.py: use assertRun{, Not}Ok()

In reply of:

Quoted 3 lines

Use the helpers to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 38 lines
---
 support/testing/tests/init/test_systemd.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
support/testing/tests/init/test_systemd.py +3 -6
index 472a65db57..60b9c3d032 100644
@@ -340,19 +340,16 @@ class InitSystemSystemdBaseOverlayfs():
 
         # /var/foo/bar is from the pre-populated /var, so it should
         # not be present in the upper of the overlay
-        _, exit_code = self.emulator.run("test -e /run/buildroot/mounts/var/upper/foo/bar")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("test -e /run/buildroot/mounts/var/upper/foo/bar")
 
         # We can write in /var/foo/bar
-        _, exit_code = self.emulator.run("echo barfoo >/var/foo/bar")
-        self.assertEqual(exit_code, 0)
+        self.assertRunOk("echo barfoo >/var/foo/bar")
         # ... and it contains the new content
         out, exit_code = self.emulator.run("cat /var/foo/bar")
         self.assertEqual(exit_code, 0)
         self.assertEqual(out[0], "barfoo")
         # ... and it to appears in the upper
-        _, exit_code = self.emulator.run("test -e /run/buildroot/mounts/var/upper/foo/bar")
-        self.assertEqual(exit_code, 0)
+        self.assertRunOk("test -e /run/buildroot/mounts/var/upper/foo/bar")
         # ... with the new content
         out, exit_code = self.emulator.run("cat /run/buildroot/mounts/var/upper/foo/bar")
         self.assertEqual(exit_code, 0)
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

PATCH 3/29 support/testing: test_acl.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_acl.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
support/testing/tests/package/test_acl.py +3 -6
index e4827c7bec..4511c6db5b 100644
@@ -52,8 +52,7 @@ class TestAcl(infra.basetest.BRTest):
 
         # Reading the file as the test user is expected to fail.
         test_read_cmd = f"su - {test_user} -c 'cat {test_file}'"
-        _, ret = self.emulator.run(test_read_cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(test_read_cmd)
 
         # We add a special read ACL for the test user.
         cmd = f"setfacl -m u:{test_user}:r {test_file}"
@@ -73,8 +72,7 @@ class TestAcl(infra.basetest.BRTest):
         # Attempting to write to the file as the test user is expected
         # to fail (since we put an ACL only for reading).
         cmd = f"su - {test_user} -c 'echo WriteTest > {test_file}'"
-        _, ret = self.emulator.run(cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(cmd)
 
         # Remove all ACLs. This could have been done with the command
         # "setfacl -b". Instead, we use the "chacl -B" command which
@@ -83,5 +81,4 @@ class TestAcl(infra.basetest.BRTest):
         self.assertRunOk(f"chacl -B {test_file}")
 
         # Reading the file as the test user is expected to fail again.
-        _, ret = self.emulator.run(test_read_cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(test_read_cmd)
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Re: [Buildroot] [PATCH 03/29] support/testing: test_acl.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 42 lines
---
 support/testing/tests/package/test_acl.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
support/testing/tests/package/test_acl.py +3 -6
index e4827c7bec..4511c6db5b 100644
@@ -52,8 +52,7 @@ class TestAcl(infra.basetest.BRTest):
 
         # Reading the file as the test user is expected to fail.
         test_read_cmd = f"su - {test_user} -c 'cat {test_file}'"
-        _, ret = self.emulator.run(test_read_cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(test_read_cmd)
 
         # We add a special read ACL for the test user.
         cmd = f"setfacl -m u:{test_user}:r {test_file}"
@@ -73,8 +72,7 @@ class TestAcl(infra.basetest.BRTest):
         # Attempting to write to the file as the test user is expected
         # to fail (since we put an ACL only for reading).
         cmd = f"su - {test_user} -c 'echo WriteTest > {test_file}'"
-        _, ret = self.emulator.run(cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(cmd)
 
         # Remove all ACLs. This could have been done with the command
         # "setfacl -b". Instead, we use the "chacl -B" command which
@@ -83,5 +81,4 @@ class TestAcl(infra.basetest.BRTest):
         self.assertRunOk(f"chacl -B {test_file}")
 
         # Reading the file as the test user is expected to fail again.
-        _, ret = self.emulator.run(test_read_cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(test_read_cmd)
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

PATCH 4/29 support/testing: test_audit.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_audit.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_audit.py +1 -2
index f68a4b6831..722542a845 100644
@@ -80,8 +80,7 @@ class TestAudit(infra.basetest.BRTest):
         # normal user. This command is expected to fail (as only root
         # can root is supposed to read this file).
         cmd = f"su - {user} -c 'cat /etc/shadow'"
-        _, ret = self.emulator.run(cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(cmd)
 
         # Our last failed read attempt is supposed to have generated
         # an event. We check we can see it in the log.
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Re: [Buildroot] [PATCH 04/29] support/testing: test_audit.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_audit.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_audit.py +1 -2
index f68a4b6831..722542a845 100644
@@ -80,8 +80,7 @@ class TestAudit(infra.basetest.BRTest):
         # normal user. This command is expected to fail (as only root
         # can root is supposed to read this file).
         cmd = f"su - {user} -c 'cat /etc/shadow'"
-        _, ret = self.emulator.run(cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(cmd)
 
         # Our last failed read attempt is supposed to have generated
         # an event. We check we can see it in the log.
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#7 lore raw

PATCH 5/29 support/testing: test_bitcoin.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_bitcoin.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_bitcoin.py +1 -2
index 186240b280..9a7d78e5e8 100644
@@ -108,8 +108,7 @@ class TestBitcoin(infra.basetest.BRTest):
         # The bitcoin daemon is not started. A client ping is expected
         # to fail.
         ping_cmd = f"{self.cli_cmd} ping"
-        _, ret = self.emulator.run(ping_cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(ping_cmd)
 
         # Start the daemon.
         cmd = f"bitcoind -regtest -daemonwait -fallbackfee={btc_fee:f}"
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

Re: [Buildroot] [PATCH 05/29] support/testing: test_bitcoin.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_bitcoin.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_bitcoin.py +1 -2
index 186240b280..9a7d78e5e8 100644
@@ -108,8 +108,7 @@ class TestBitcoin(infra.basetest.BRTest):
         # The bitcoin daemon is not started. A client ping is expected
         # to fail.
         ping_cmd = f"{self.cli_cmd} ping"
-        _, ret = self.emulator.run(ping_cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(ping_cmd)
 
         # Start the daemon.
         cmd = f"bitcoind -regtest -daemonwait -fallbackfee={btc_fee:f}"
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#9 lore raw

PATCH 6/29 support/testing: test_connman.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_connman.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_connman.py +1 -2
index 6fef95104c..2e53135208 100644
@@ -47,8 +47,7 @@ class TestConnMan(infra.basetest.BRTest):
 
         # If we try to ping again the qemu gateway,
         # it should now fail.
-        _, ret = self.emulator.run(ping_cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(ping_cmd)
 
         # We ask connman to re-enable Ethernet.
         self.assertRunOk("connmanctl enable ethernet")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw

Re: [Buildroot] [PATCH 06/29] support/testing: test_connman.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_connman.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_connman.py +1 -2
index 6fef95104c..2e53135208 100644
@@ -47,8 +47,7 @@ class TestConnMan(infra.basetest.BRTest):
 
         # If we try to ping again the qemu gateway,
         # it should now fail.
-        _, ret = self.emulator.run(ping_cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(ping_cmd)
 
         # We ask connman to re-enable Ethernet.
         self.assertRunOk("connmanctl enable ethernet")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#11 lore raw

PATCH 7/29 support/testing: test_cryptsetup.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_cryptsetup.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
support/testing/tests/package/test_cryptsetup.py +3 -6
index e409ea93e6..32a65210b5 100644
@@ -65,8 +65,7 @@ class TestCryptSetup(infra.basetest.BRTest):
         # Check the device is NOT detected as a LUKS volume, because
         # it is not formatted yet.
         is_luks_cmd = f"cryptsetup isLuks {dev}"
-        _, ret = self.emulator.run(is_luks_cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(is_luks_cmd)
 
         # Format the LUKS volume.
         cmd = f"echo {passkey} | cryptsetup luksFormat {dev}"
@@ -110,15 +109,13 @@ class TestCryptSetup(infra.basetest.BRTest):
 
         # We are NOT supposed to find our plain text message on the
         # encrypted storage device.
-        _, ret = self.emulator.run(f"grep -Fq '{msg}' {dev}", timeout=10)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(f"grep -Fq '{msg}' {dev}", timeout=10)
 
         # Try to open LUKS volume with a wrong password. This is
         # expected to fail.
         cmd = f"echo 'Wrong{passkey}' | "
         cmd += f"cryptsetup open --type luks {dev} {dm_name}"
-        _, ret = self.emulator.run(cmd, timeout=10)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(cmd, timeout=10)
 
         # Check the device-mapper device was NOT created (since we
         # tried to open it with a wrong password).
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#12 lore raw

Re: [Buildroot] [PATCH 07/29] support/testing: test_cryptsetup.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 43 lines
---
 support/testing/tests/package/test_cryptsetup.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
support/testing/tests/package/test_cryptsetup.py +3 -6
index e409ea93e6..32a65210b5 100644
@@ -65,8 +65,7 @@ class TestCryptSetup(infra.basetest.BRTest):
         # Check the device is NOT detected as a LUKS volume, because
         # it is not formatted yet.
         is_luks_cmd = f"cryptsetup isLuks {dev}"
-        _, ret = self.emulator.run(is_luks_cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(is_luks_cmd)
 
         # Format the LUKS volume.
         cmd = f"echo {passkey} | cryptsetup luksFormat {dev}"
@@ -110,15 +109,13 @@ class TestCryptSetup(infra.basetest.BRTest):
 
         # We are NOT supposed to find our plain text message on the
         # encrypted storage device.
-        _, ret = self.emulator.run(f"grep -Fq '{msg}' {dev}", timeout=10)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(f"grep -Fq '{msg}' {dev}", timeout=10)
 
         # Try to open LUKS volume with a wrong password. This is
         # expected to fail.
         cmd = f"echo 'Wrong{passkey}' | "
         cmd += f"cryptsetup open --type luks {dev} {dm_name}"
-        _, ret = self.emulator.run(cmd, timeout=10)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(cmd, timeout=10)
 
         # Check the device-mapper device was NOT created (since we
         # tried to open it with a wrong password).
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#13 lore raw

PATCH 8/29 support/testing: test_ddrescue.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_ddrescue.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_ddrescue.py +1 -2
index bd34694737..e7e71fefda 100644
@@ -70,8 +70,7 @@ class TestDdrescue(infra.basetest.BRTest):
 
         # A normal 'dd' is expected to fail with I/O error
         cmd = f"dd if={dm_dev} of=/dev/null bs=512"
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(cmd)
 
         # Where a normal 'dd' fails, 'ddrescue' is expected to succeed
         self.assertRunOk(f"ddrescue {dm_dev} {ddrescue_img}")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#14 lore raw

Re: [Buildroot] [PATCH 08/29] support/testing: test_ddrescue.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_ddrescue.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_ddrescue.py +1 -2
index bd34694737..e7e71fefda 100644
@@ -70,8 +70,7 @@ class TestDdrescue(infra.basetest.BRTest):
 
         # A normal 'dd' is expected to fail with I/O error
         cmd = f"dd if={dm_dev} of=/dev/null bs=512"
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(cmd)
 
         # Where a normal 'dd' fails, 'ddrescue' is expected to succeed
         self.assertRunOk(f"ddrescue {dm_dev} {ddrescue_img}")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#15 lore raw

PATCH 9/29 support/testing: test_dos2unix.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_dos2unix.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_dos2unix.py +1 -2
index af5850ae3e..1c0ecf5967 100644
@@ -32,8 +32,7 @@ class TestDos2Unix(infra.basetest.BRTest):
         self.assertRunOk("unix2dos -n original.txt dos.txt")
 
         # DOS file is expected to be different than the UNIX file
-        _, exit_code = self.emulator.run("cmp original.txt dos.txt")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("cmp original.txt dos.txt")
 
         # The "cat -A" command should print '^M$' for CR-LF
         self.assertRunOk("cat -A dos.txt | grep -Fq '^M$'")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#16 lore raw

Re: [Buildroot] [PATCH 09/29] support/testing: test_dos2unix.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_dos2unix.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_dos2unix.py +1 -2
index af5850ae3e..1c0ecf5967 100644
@@ -32,8 +32,7 @@ class TestDos2Unix(infra.basetest.BRTest):
         self.assertRunOk("unix2dos -n original.txt dos.txt")
 
         # DOS file is expected to be different than the UNIX file
-        _, exit_code = self.emulator.run("cmp original.txt dos.txt")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("cmp original.txt dos.txt")
 
         # The "cat -A" command should print '^M$' for CR-LF
         self.assertRunOk("cat -A dos.txt | grep -Fq '^M$'")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#17 lore raw

PATCH 10/29 support/testing: test_fping.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_fping.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_fping.py +1 -2
index 507c4ce73b..e8aba653f1 100644
@@ -41,5 +41,4 @@ class TestFping(infra.basetest.BRTest):
         self.assertRunOk("ip route add to prohibit 192.168.12.0/24")
 
         # We expect fping to fail when pinging the prohibited network.
-        _, ret = self.emulator.run("fping 192.168.12.34")
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk("fping 192.168.12.34")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#18 lore raw

Re: [Buildroot] [PATCH 10/29] support/testing: test_fping.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 22 lines
---
 support/testing/tests/package/test_fping.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_fping.py +1 -2
index 507c4ce73b..e8aba653f1 100644
@@ -41,5 +41,4 @@ class TestFping(infra.basetest.BRTest):
         self.assertRunOk("ip route add to prohibit 192.168.12.0/24")
 
         # We expect fping to fail when pinging the prohibited network.
-        _, ret = self.emulator.run("fping 192.168.12.34")
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk("fping 192.168.12.34")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#19 lore raw

PATCH 11/29 support/testing: test_gnupg2.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_gnupg2.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
support/testing/tests/package/test_gnupg2.py +3 -6
index 2b18f54fa3..6f862c31ce 100644
@@ -49,8 +49,7 @@ class TestGnupg2(infra.basetest.BRTest):
         # Test a failed decrypt with a bad password
         cmd = "gpg --batch --decrypt"
         cmd += " --passphrase 'A-Bad-Password' {}".format(gpg_file)
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(cmd)
 
         # Test the generation of an asymmetric key
         cmd = "gpg --batch --passphrase ''"
@@ -106,9 +105,7 @@ class TestGnupg2(infra.basetest.BRTest):
         self.assertRunOk(cmd)
 
         cmd = "gpg --verify {}".format(sig_file)
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(cmd)
 
         cmd = "gpg --armor --verify {}".format(asc_file)
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOK(cmd)
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#20 lore raw

Re: [Buildroot] [PATCH 11/29] support/testing: test_gnupg2.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 37 lines
---
 support/testing/tests/package/test_gnupg2.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
support/testing/tests/package/test_gnupg2.py +3 -6
index 2b18f54fa3..6f862c31ce 100644
@@ -49,8 +49,7 @@ class TestGnupg2(infra.basetest.BRTest):
         # Test a failed decrypt with a bad password
         cmd = "gpg --batch --decrypt"
         cmd += " --passphrase 'A-Bad-Password' {}".format(gpg_file)
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(cmd)
 
         # Test the generation of an asymmetric key
         cmd = "gpg --batch --passphrase ''"
@@ -106,9 +105,7 @@ class TestGnupg2(infra.basetest.BRTest):
         self.assertRunOk(cmd)
 
         cmd = "gpg --verify {}".format(sig_file)
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(cmd)
 
         cmd = "gpg --armor --verify {}".format(asc_file)
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOK(cmd)
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#21 lore raw

PATCH 12/29 support/testing: test_iproute2.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_iproute2.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
support/testing/tests/package/test_iproute2.py +2 -4
index 91d9006e23..78f8dc291e 100644
@@ -46,8 +46,7 @@ class TestIpRoute2(infra.basetest.BRTest):
         for addr in addrs:
             self.assertRunOk(f"{ping_cmd} {addr}")
         # ...but the IP outside is supposed to fail.
-        _, ret = self.emulator.run(f"{ping_cmd} 127.1.2.3")
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(f"{ping_cmd} 127.1.2.3")
 
         # We add a prohibited route.
         self.assertRunOk("ip route add prohibit 127.0.1.0/24")
@@ -57,8 +56,7 @@ class TestIpRoute2(infra.basetest.BRTest):
         # ...while the other IPs expected to fail.
         addrs = ["127.0.1.2", "127.1.2.3"]
         for addr in addrs:
-            _, ret = self.emulator.run(f"{ping_cmd} {addr}")
-            self.assertNotEqual(ret, 0)
+            self.assertRunNotOk(f"{ping_cmd} {addr}")
 
         # We should be able to see our prohibited route.
         out, ret = self.emulator.run("ip route list")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#22 lore raw

Re: [Buildroot] [PATCH 12/29] support/testing: test_iproute2.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 35 lines
---
 support/testing/tests/package/test_iproute2.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
support/testing/tests/package/test_iproute2.py +2 -4
index 91d9006e23..78f8dc291e 100644
@@ -46,8 +46,7 @@ class TestIpRoute2(infra.basetest.BRTest):
         for addr in addrs:
             self.assertRunOk(f"{ping_cmd} {addr}")
         # ...but the IP outside is supposed to fail.
-        _, ret = self.emulator.run(f"{ping_cmd} 127.1.2.3")
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(f"{ping_cmd} 127.1.2.3")
 
         # We add a prohibited route.
         self.assertRunOk("ip route add prohibit 127.0.1.0/24")
@@ -57,8 +56,7 @@ class TestIpRoute2(infra.basetest.BRTest):
         # ...while the other IPs expected to fail.
         addrs = ["127.0.1.2", "127.1.2.3"]
         for addr in addrs:
-            _, ret = self.emulator.run(f"{ping_cmd} {addr}")
-            self.assertNotEqual(ret, 0)
+            self.assertRunNotOk(f"{ping_cmd} {addr}")
 
         # We should be able to see our prohibited route.
         out, ret = self.emulator.run("ip route list")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#23 lore raw

PATCH 13/29 support/testing: test_iptables.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_iptables.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
support/testing/tests/package/test_iptables.py +2 -4
index 6e4db0ac06..72f2dd71a4 100644
@@ -68,8 +68,7 @@ class TestIptables(infra.basetest.BRTest):
         # A ping to 127.0.0.2 is expected to fail, because our rule is
         # supposed to drop it.
         ping_test_cmd = ping_cmd_prefix + "127.0.0.2"
-        _, exit_code = self.emulator.run(ping_test_cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_test_cmd)
 
         # Save the current rules to test the init script later.
         self.assertRunOk("/etc/init.d/S35iptables save")
@@ -85,8 +84,7 @@ class TestIptables(infra.basetest.BRTest):
         self.assertRunOk("/etc/init.d/S35iptables start")
 
         # Ping to 127.0.0.2 is expected to fail again.
-        _, exit_code = self.emulator.run(ping_test_cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_test_cmd)
 
         # And flush the rules again.
         self.assertRunOk("/etc/init.d/S35iptables stop")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#24 lore raw

Re: [Buildroot] [PATCH 13/29] support/testing: test_iptables.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2026.05.x. Thanks

Quoted 35 lines
---
 support/testing/tests/package/test_iptables.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
support/testing/tests/package/test_iptables.py +2 -4
index 6e4db0ac06..72f2dd71a4 100644
@@ -68,8 +68,7 @@ class TestIptables(infra.basetest.BRTest):
         # A ping to 127.0.0.2 is expected to fail, because our rule is
         # supposed to drop it.
         ping_test_cmd = ping_cmd_prefix + "127.0.0.2"
-        _, exit_code = self.emulator.run(ping_test_cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_test_cmd)
 
         # Save the current rules to test the init script later.
         self.assertRunOk("/etc/init.d/S35iptables save")
@@ -85,8 +84,7 @@ class TestIptables(infra.basetest.BRTest):
         self.assertRunOk("/etc/init.d/S35iptables start")
 
         # Ping to 127.0.0.2 is expected to fail again.
-        _, exit_code = self.emulator.run(ping_test_cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_test_cmd)
 
         # And flush the rules again.
         self.assertRunOk("/etc/init.d/S35iptables stop")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#25 lore raw

PATCH 14/29 support/testing: test_jq.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_jq.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_jq.py +1 -2
index 67420abb6b..ffa284ce31 100644
@@ -34,8 +34,7 @@ class TestJq(infra.basetest.BRTest):
 
         # Check the execution fails on a non JSON file.
         cmd = "jq -M '.' broken.json"
-        _, ret = self.emulator.run(cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(cmd)
 
         # Check an execution of a simple query. Note that output is a
         # JSON (quoted) string.
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#26 lore raw

Re: [Buildroot] [PATCH 14/29] support/testing: test_jq.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_jq.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_jq.py +1 -2
index 67420abb6b..ffa284ce31 100644
@@ -34,8 +34,7 @@ class TestJq(infra.basetest.BRTest):
 
         # Check the execution fails on a non JSON file.
         cmd = "jq -M '.' broken.json"
-        _, ret = self.emulator.run(cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(cmd)
 
         # Check an execution of a simple query. Note that output is a
         # JSON (quoted) string.
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#27 lore raw

PATCH 15/29 support/testing: test_kmod.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_kmod.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
support/testing/tests/package/test_kmod.py +2 -4
index 3c06589b2b..a88257ef57 100644
@@ -73,8 +73,7 @@ class TestKmod(infra.basetest.BRTest):
         # With this test configuration, we are not supposed to have an
         # eth0 Ethernet interface yet. Attempting to show info on this
         # interface is expected to fail .
-        _, ret = self.emulator.run("ip link show dev eth0")
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk("ip link show dev eth0")
 
         # We try to load the module.
         self.assertRunOk("modprobe virtio-net")
@@ -101,5 +100,4 @@ class TestKmod(infra.basetest.BRTest):
 
         # Now the driver is unloaded, we should no longer be able to
         # ping the emulator.
-        _, ret = self.emulator.run(ping_cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(ping_cmd)
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#28 lore raw

Re: [Buildroot] [PATCH 15/29] support/testing: test_kmod.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 32 lines
---
 support/testing/tests/package/test_kmod.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
support/testing/tests/package/test_kmod.py +2 -4
index 3c06589b2b..a88257ef57 100644
@@ -73,8 +73,7 @@ class TestKmod(infra.basetest.BRTest):
         # With this test configuration, we are not supposed to have an
         # eth0 Ethernet interface yet. Attempting to show info on this
         # interface is expected to fail .
-        _, ret = self.emulator.run("ip link show dev eth0")
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk("ip link show dev eth0")
 
         # We try to load the module.
         self.assertRunOk("modprobe virtio-net")
@@ -101,5 +100,4 @@ class TestKmod(infra.basetest.BRTest):
 
         # Now the driver is unloaded, we should no longer be able to
         # ping the emulator.
-        _, ret = self.emulator.run(ping_cmd)
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(ping_cmd)
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#29 lore raw

PATCH 16/29 support/testing: test_libgpgme.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_libgpgme.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
support/testing/tests/package/test_libgpgme.py +2 -4
index b497891249..5d0ee34aa6 100644
@@ -31,8 +31,7 @@ class TestLibGpgme(infra.basetest.BRTest):
         # We did not create a gpg key yet. We should not be able to
         # list our key.
         gpgme_listkey = f"echo LISTKEYS | gpgme-tool | grep '{gpg_userid}'"
-        _, exit_code = self.emulator.run(gpgme_listkey)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(gpgme_listkey)
 
         # We now create our gpg key.
         cmd = "gpg --batch --passphrase ''"
@@ -66,8 +65,7 @@ class TestLibGpgme(infra.basetest.BRTest):
 
         # The output encrypted file is also expected to be different
         # from the input plain text file.
-        _, exit_code = self.emulator.run(f"cmp {plain_file} {enc_file}")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(f"cmp {plain_file} {enc_file}")
 
         # We now decrypt the encrypted file using gpgme-tool commands.
         gpgme_dec_cmds = [
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#30 lore raw

Re: [Buildroot] [PATCH 16/29] support/testing: test_libgpgme.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 35 lines
---
 support/testing/tests/package/test_libgpgme.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
support/testing/tests/package/test_libgpgme.py +2 -4
index b497891249..5d0ee34aa6 100644
@@ -31,8 +31,7 @@ class TestLibGpgme(infra.basetest.BRTest):
         # We did not create a gpg key yet. We should not be able to
         # list our key.
         gpgme_listkey = f"echo LISTKEYS | gpgme-tool | grep '{gpg_userid}'"
-        _, exit_code = self.emulator.run(gpgme_listkey)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(gpgme_listkey)
 
         # We now create our gpg key.
         cmd = "gpg --batch --passphrase ''"
@@ -66,8 +65,7 @@ class TestLibGpgme(infra.basetest.BRTest):
 
         # The output encrypted file is also expected to be different
         # from the input plain text file.
-        _, exit_code = self.emulator.run(f"cmp {plain_file} {enc_file}")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(f"cmp {plain_file} {enc_file}")
 
         # We now decrypt the encrypted file using gpgme-tool commands.
         gpgme_dec_cmds = [
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#31 lore raw

PATCH 17/29 support/testing: test_lsof.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_lsof.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_lsof.py +1 -2
index b0478dfbb7..336a951549 100644
@@ -28,8 +28,7 @@ class TestLsof(infra.basetest.BRTest):
         self.assertRunOk("lsof")
 
         # Check lsof fails if requested file is not opened
-        _, exit_code = self.emulator.run("lsof {}".format(test_file))
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("lsof {}".format(test_file))
 
         # Open the test file from the shell on descriptor 10
         self.assertRunOk("exec 10> {}".format(test_file))
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#32 lore raw

Re: [Buildroot] [PATCH 17/29] support/testing: test_lsof.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_lsof.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_lsof.py +1 -2
index b0478dfbb7..336a951549 100644
@@ -28,8 +28,7 @@ class TestLsof(infra.basetest.BRTest):
         self.assertRunOk("lsof")
 
         # Check lsof fails if requested file is not opened
-        _, exit_code = self.emulator.run("lsof {}".format(test_file))
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("lsof {}".format(test_file))
 
         # Open the test file from the shell on descriptor 10
         self.assertRunOk("exec 10> {}".format(test_file))
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#33 lore raw

PATCH 18/29 support/testing: test_mariadb.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_mariadb.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_mariadb.py +1 -2
index 67ae61c3e1..9ffe6aa3b3 100644
@@ -179,8 +179,7 @@ class TestMariaDB(infra.basetest.BRTest):
         self.assertRunOk("/etc/init.d/S97mysqld stop")
 
         # Check the server is stopped.
-        _, exit_code = self.emulator.run("mariadb-admin ping")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("mariadb-admin ping")
 
         # Restart the server.
         self.assertRunOk("/etc/init.d/S97mysqld start")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#34 lore raw

Re: [Buildroot] [PATCH 18/29] support/testing: test_mariadb.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_mariadb.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_mariadb.py +1 -2
index 67ae61c3e1..9ffe6aa3b3 100644
@@ -179,8 +179,7 @@ class TestMariaDB(infra.basetest.BRTest):
         self.assertRunOk("/etc/init.d/S97mysqld stop")
 
         # Check the server is stopped.
-        _, exit_code = self.emulator.run("mariadb-admin ping")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("mariadb-admin ping")
 
         # Restart the server.
         self.assertRunOk("/etc/init.d/S97mysqld start")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#35 lore raw

PATCH 19/29 support/testing: test_mtools.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_mtools.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_mtools.py +1 -2
index 23ec08b6d6..8fc8766207 100644
@@ -29,8 +29,7 @@ class TestMtools(infra.basetest.BRTest):
         # Any Mtools command is expected to fail on an unformatted
         # partition.
         cmd = f"minfo {mtools_opts} ::"
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(cmd)
 
         # Now, let's format the partition file to FAT
         self.assertRunOk(f"mformat {mtools_opts} ::")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#36 lore raw

Re: [Buildroot] [PATCH 19/29] support/testing: test_mtools.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_mtools.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_mtools.py +1 -2
index 23ec08b6d6..8fc8766207 100644
@@ -29,8 +29,7 @@ class TestMtools(infra.basetest.BRTest):
         # Any Mtools command is expected to fail on an unformatted
         # partition.
         cmd = f"minfo {mtools_opts} ::"
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(cmd)
 
         # Now, let's format the partition file to FAT
         self.assertRunOk(f"mformat {mtools_opts} ::")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#37 lore raw

PATCH 20/29 support/testing: test_nftables.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_nftables.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
support/testing/tests/package/test_nftables.py +3 -6
index 2622c7e822..62e14d5d35 100644
@@ -69,8 +69,7 @@ class TestNftables(infra.basetest.BRTest):
         # A ping to 127.0.0.2 is expected to fail, because our rule is
         # supposed to drop it.
         ping_test_cmd = ping_cmd_prefix + "127.0.0.2"
-        _, exit_code = self.emulator.run(ping_test_cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_test_cmd)
 
         # We completely delete the table. This should also delete the
         # chain and the rule.
@@ -128,8 +127,7 @@ class TestNftablesInit(TestNftables):
         # should allow ping to 127.0.0.1, but not 127.0.0.2.
         ping_cmd_prefix = "ping -c 3 -i 0.5 -W 2 "
         self.assertRunOk(ping_cmd_prefix + "127.0.0.1")
-        _, exit_code = self.emulator.run(ping_cmd_prefix + "127.0.0.2")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_cmd_prefix + "127.0.0.2")
 
         # Stop should flush the rules, ping to both addresses should
         # work now.
@@ -140,5 +138,4 @@ class TestNftablesInit(TestNftables):
         # Start is essentially the same as reload, check that
         # 127.0.0.2 gets blocked again.
         self.assertRunOk("/etc/init.d/S35nftables start")
-        _, exit_code = self.emulator.run(ping_cmd_prefix + "127.0.0.2")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_cmd_prefix + "127.0.0.2")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Acked-by Fiona Klute on v1 20/29
#38 lore raw

Re: [Buildroot] [PATCH 20/29] support/testing: test_nftables.py: use assertRunNotOk()

Am 18.06.26 um 14:48 schrieb Peter Korsgaard:

Quoted 3 lines

Use the helper to simplify the test.

Quoted 29 lines
---
  support/testing/tests/package/test_nftables.py | 9 +++------
  1 file changed, 3 insertions(+), 6 deletions(-)
support/testing/tests/package/test_nftables.py +2 -4
index 2622c7e822..62e14d5d35 100644
@@ -69,8 +69,7 @@ class TestNftables(infra.basetest.BRTest):
          # A ping to 127.0.0.2 is expected to fail, because our rule is
          # supposed to drop it.
          ping_test_cmd = ping_cmd_prefix + "127.0.0.2"
-        _, exit_code = self.emulator.run(ping_test_cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_test_cmd)
 
          # We completely delete the table. This should also delete the
          # chain and the rule.
@@ -128,8 +127,7 @@ class TestNftablesInit(TestNftables):
          # should allow ping to 127.0.0.1, but not 127.0.0.2.
          ping_cmd_prefix = "ping -c 3 -i 0.5 -W 2 "
          self.assertRunOk(ping_cmd_prefix + "127.0.0.1")
-        _, exit_code = self.emulator.run(ping_cmd_prefix + "127.0.0.2")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_cmd_prefix + "127.0.0.2")
 
          # Stop should flush the rules, ping to both addresses should
          # work now.

support/testing/tests/package/test_nftables.py class TestNftablesInit(TestNftables): · line 141

Quoted 6 lines
support/testing/tests/package/test_nftables.py +1 -2
@@ -140,5 +138,4 @@ class TestNftablesInit(TestNftables):
          # Start is essentially the same as reload, check that
          # 127.0.0.2 gets blocked again.
          self.assertRunOk("/etc/init.d/S35nftables start")
-        _, exit_code = self.emulator.run(ping_cmd_prefix + "127.0.0.2")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_cmd_prefix + "127.0.0.2")

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#39 lore raw

Re: [Buildroot] [PATCH 20/29] support/testing: test_nftables.py: use assertRunNotOk()

In reply to Peter Korsgaard

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2026.05.x. Thanks

Quoted 42 lines
---
 support/testing/tests/package/test_nftables.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
support/testing/tests/package/test_nftables.py +3 -6
index 2622c7e822..62e14d5d35 100644
@@ -69,8 +69,7 @@ class TestNftables(infra.basetest.BRTest):
         # A ping to 127.0.0.2 is expected to fail, because our rule is
         # supposed to drop it.
         ping_test_cmd = ping_cmd_prefix + "127.0.0.2"
-        _, exit_code = self.emulator.run(ping_test_cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_test_cmd)
 
         # We completely delete the table. This should also delete the
         # chain and the rule.
@@ -128,8 +127,7 @@ class TestNftablesInit(TestNftables):
         # should allow ping to 127.0.0.1, but not 127.0.0.2.
         ping_cmd_prefix = "ping -c 3 -i 0.5 -W 2 "
         self.assertRunOk(ping_cmd_prefix + "127.0.0.1")
-        _, exit_code = self.emulator.run(ping_cmd_prefix + "127.0.0.2")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_cmd_prefix + "127.0.0.2")
 
         # Stop should flush the rules, ping to both addresses should
         # work now.
@@ -140,5 +138,4 @@ class TestNftablesInit(TestNftables):
         # Start is essentially the same as reload, check that
         # 127.0.0.2 gets blocked again.
         self.assertRunOk("/etc/init.d/S35nftables start")
-        _, exit_code = self.emulator.run(ping_cmd_prefix + "127.0.0.2")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(ping_cmd_prefix + "127.0.0.2")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#40 lore raw

PATCH 21/29 support/testing: test_octave.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_octave.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_octave.py +1 -2
index 5c0b26a5fd..ef6516939e 100644
@@ -51,8 +51,7 @@ class TestOctave(infra.basetest.BRTest):
 
         # Check octave can fail
         cmd = self.octave_cmd("assert(false)")
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(cmd)
 
         # Check string output
         string = "Hello World"
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#41 lore raw

PATCH 22/29 support/testing: test_polkit.py: use assertRun{, Not}Ok()

In reply to Peter Korsgaard

Use the helpers to simplify the test.

---
 support/testing/tests/package/test_polkit.py | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
support/testing/tests/package/test_polkit.py +6 -12
index 3414fd5159..8ff02d91df 100644
@@ -43,20 +43,16 @@ class TestPolkitSystemd(TestPolkitInfra):
         rule_file = "systemd-timesyncd-restart.rules"
         for rule_path in TestPolkitInfra.rule_paths:
             cmd = "su brtest -c '/bin/systemctl restart systemd-timesyncd.service'"
-            _, exit_code = self.emulator.run(cmd, 10)
-            self.assertNotEqual(exit_code, 0)
+            self.assertRunNotOk(cmd, 10)
 
             cmd = "cp /root/{file} {path}".format(file=rule_file, path=rule_path)
-            _, exit_code = self.emulator.run(cmd, 10)
-            self.assertEqual(exit_code, 0)
+            self.assertRunOk(cmd, 10)
 
             cmd = "su brtest -c '/bin/systemctl restart systemd-timesyncd.service'"
-            _, exit_code = self.emulator.run(cmd, 10)
-            self.assertEqual(exit_code, 0)
+            self.assertRunOk(cmd, 10)
 
             cmd = "rm {path}/{file}".format(file=rule_file, path=rule_path)
-            _, exit_code = self.emulator.run(cmd, 10)
-            self.assertEqual(exit_code, 0)
+            self.assertRunOk(cmd, 10)
 
 
 class TestPolkitInitd(TestPolkitInfra):
@@ -73,8 +69,7 @@ class TestPolkitInitd(TestPolkitInfra):
             self.assertEqual(output[0], "Error executing command as another user: Not authorized")
 
             cmd = "cp /root/{file} {path}/{file}".format(file=rule_file, path=rule_path)
-            _, exit_code = self.emulator.run(cmd, 10)
-            self.assertEqual(exit_code, 0)
+            self.assertRunOk(cmd, 10)
 
             cmd = "su brtest -c 'pkexec hello-polkit'"
             output, exit_code = self.emulator.run(cmd, 10)
@@ -82,5 +77,4 @@ class TestPolkitInitd(TestPolkitInfra):
             self.assertEqual(output[0], "Hello polkit!")
 
             cmd = "rm {path}/{file}".format(file=rule_file, path=rule_path)
-            _, exit_code = self.emulator.run(cmd, 10)
-            self.assertEqual(exit_code, 0)
+            self.assertRunOk(cmd, 10)
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#42 lore raw

Re: [Buildroot] [PATCH 22/29] support/testing: test_polkit.py: use assertRun{, Not}Ok()

In reply of:

Quoted 3 lines

Use the helpers to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 57 lines
---
 support/testing/tests/package/test_polkit.py | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
support/testing/tests/package/test_polkit.py +6 -12
index 3414fd5159..8ff02d91df 100644
@@ -43,20 +43,16 @@ class TestPolkitSystemd(TestPolkitInfra):
         rule_file = "systemd-timesyncd-restart.rules"
         for rule_path in TestPolkitInfra.rule_paths:
             cmd = "su brtest -c '/bin/systemctl restart systemd-timesyncd.service'"
-            _, exit_code = self.emulator.run(cmd, 10)
-            self.assertNotEqual(exit_code, 0)
+            self.assertRunNotOk(cmd, 10)
 
             cmd = "cp /root/{file} {path}".format(file=rule_file, path=rule_path)
-            _, exit_code = self.emulator.run(cmd, 10)
-            self.assertEqual(exit_code, 0)
+            self.assertRunOk(cmd, 10)
 
             cmd = "su brtest -c '/bin/systemctl restart systemd-timesyncd.service'"
-            _, exit_code = self.emulator.run(cmd, 10)
-            self.assertEqual(exit_code, 0)
+            self.assertRunOk(cmd, 10)
 
             cmd = "rm {path}/{file}".format(file=rule_file, path=rule_path)
-            _, exit_code = self.emulator.run(cmd, 10)
-            self.assertEqual(exit_code, 0)
+            self.assertRunOk(cmd, 10)
 
 
 class TestPolkitInitd(TestPolkitInfra):
@@ -73,8 +69,7 @@ class TestPolkitInitd(TestPolkitInfra):
             self.assertEqual(output[0], "Error executing command as another user: Not authorized")
 
             cmd = "cp /root/{file} {path}/{file}".format(file=rule_file, path=rule_path)
-            _, exit_code = self.emulator.run(cmd, 10)
-            self.assertEqual(exit_code, 0)
+            self.assertRunOk(cmd, 10)
 
             cmd = "su brtest -c 'pkexec hello-polkit'"
             output, exit_code = self.emulator.run(cmd, 10)
@@ -82,5 +77,4 @@ class TestPolkitInitd(TestPolkitInfra):
             self.assertEqual(output[0], "Hello polkit!")
 
             cmd = "rm {path}/{file}".format(file=rule_file, path=rule_path)
-            _, exit_code = self.emulator.run(cmd, 10)
-            self.assertEqual(exit_code, 0)
+            self.assertRunOk(cmd, 10)
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#43 lore raw

PATCH 23/29 support/testing: test_postgresql.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_postgresql.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_postgresql.py +1 -2
index bd41fc3f1b..08926b0ffc 100644
@@ -180,8 +180,7 @@ class TestPostgreSQL(infra.basetest.BRTest):
         self.assertRunOk(cmd)
 
         # Check the server is no longer ready.
-        _, exit_code = self.emulator.run("pg_isready")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("pg_isready")
 
         # Restart the server.
         cmd = f"su - {self.db_admin} -c 'pg_ctl start -D {self.pgdata_dir}'"
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#44 lore raw

Re: [Buildroot] [PATCH 23/29] support/testing: test_postgresql.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_postgresql.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_postgresql.py +1 -2
index bd41fc3f1b..08926b0ffc 100644
@@ -180,8 +180,7 @@ class TestPostgreSQL(infra.basetest.BRTest):
         self.assertRunOk(cmd)
 
         # Check the server is no longer ready.
-        _, exit_code = self.emulator.run("pg_isready")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("pg_isready")
 
         # Restart the server.
         cmd = f"su - {self.db_admin} -c 'pg_ctl start -D {self.pgdata_dir}'"
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#45 lore raw

PATCH 24/29 support/testing: test_rasdaemon.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_rasdaemon.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_rasdaemon.py +1 -2
index ec29f1785b..2ae6fd2c28 100644
@@ -43,5 +43,4 @@ class TestRasdaemon(infra.basetest.BRTest):
         self.assertRunOk("/etc/init.d/S95rasdaemon restart")
         self.assertRunOk("pidof /usr/sbin/rasdaemon")
         self.assertRunOk("/etc/init.d/S95rasdaemon stop")
-        _, ret = self.emulator.run("pidof /usr/sbin/rasdaemon")
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk("pidof /usr/sbin/rasdaemon")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#46 lore raw

Re: [Buildroot] [PATCH 24/29] support/testing: test_rasdaemon.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2026.05.x. Thanks

Quoted 22 lines
---
 support/testing/tests/package/test_rasdaemon.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_rasdaemon.py +1 -2
index ec29f1785b..2ae6fd2c28 100644
@@ -43,5 +43,4 @@ class TestRasdaemon(infra.basetest.BRTest):
         self.assertRunOk("/etc/init.d/S95rasdaemon restart")
         self.assertRunOk("pidof /usr/sbin/rasdaemon")
         self.assertRunOk("/etc/init.d/S95rasdaemon stop")
-        _, ret = self.emulator.run("pidof /usr/sbin/rasdaemon")
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk("pidof /usr/sbin/rasdaemon")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#47 lore raw

PATCH 25/29 support/testing: test_screen.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_screen.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
support/testing/tests/package/test_screen.py +2 -4
index b6264d34df..977aa5b59a 100644
@@ -27,8 +27,7 @@ class TestScreen(infra.basetest.BRTest):
 
         # There is no "screen" running yet. Listing sessions is
         # expected to fail.
-        _, exit_code = self.emulator.run("screen -ls")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("screen -ls")
 
         # We now start a detached and named session.
         self.assertRunOk(f"screen -dmS {session_name}")
@@ -57,5 +56,4 @@ class TestScreen(infra.basetest.BRTest):
 
         # Since the session is supposed to be terminated, listing
         # sessions is expected to fail (again).
-        _, exit_code = self.emulator.run("screen -ls")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("screen -ls")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#48 lore raw

Re: [Buildroot] [PATCH 25/29] support/testing: test_screen.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 32 lines
---
 support/testing/tests/package/test_screen.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
support/testing/tests/package/test_screen.py +2 -4
index b6264d34df..977aa5b59a 100644
@@ -27,8 +27,7 @@ class TestScreen(infra.basetest.BRTest):
 
         # There is no "screen" running yet. Listing sessions is
         # expected to fail.
-        _, exit_code = self.emulator.run("screen -ls")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("screen -ls")
 
         # We now start a detached and named session.
         self.assertRunOk(f"screen -dmS {session_name}")
@@ -57,5 +56,4 @@ class TestScreen(infra.basetest.BRTest):
 
         # Since the session is supposed to be terminated, listing
         # sessions is expected to fail (again).
-        _, exit_code = self.emulator.run("screen -ls")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("screen -ls")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#49 lore raw

PATCH 26/29 support/testing: test_swipl.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_swipl.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_swipl.py +1 -2
index 0f317bb617..4005e02e5b 100644
@@ -27,8 +27,7 @@ class TestSWIPL(infra.basetest.BRTest):
 
         # Check swipl fails when goal is false.
         cmd = "swipl -g false"
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(cmd)
 
         # Test output.
         string = "Hello Buildroot !"
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#50 lore raw

Re: [Buildroot] [PATCH 26/29] support/testing: test_swipl.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_swipl.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_swipl.py +1 -2
index 0f317bb617..4005e02e5b 100644
@@ -27,8 +27,7 @@ class TestSWIPL(infra.basetest.BRTest):
 
         # Check swipl fails when goal is false.
         cmd = "swipl -g false"
-        _, exit_code = self.emulator.run(cmd)
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk(cmd)
 
         # Test output.
         string = "Hello Buildroot !"
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#51 lore raw

PATCH 27/29 support/testing: test_usbip.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_usbip.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_usbip.py +1 -2
index da94d6f92c..2fae8f7f6a 100644
@@ -56,8 +56,7 @@ class TestUsbIp(infra.basetest.BRTest):
 
         # The daemon is not running yet. Listing remote devices is
         # expected to fail.
-        _, ret = self.emulator.run("usbip list --remote=127.0.0.1")
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk("usbip list --remote=127.0.0.1")
 
         # We start the USBIP daemon.
         self.assertRunOk("usbipd -D")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#52 lore raw

Re: [Buildroot] [PATCH 27/29] support/testing: test_usbip.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_usbip.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_usbip.py +1 -2
index da94d6f92c..2fae8f7f6a 100644
@@ -56,8 +56,7 @@ class TestUsbIp(infra.basetest.BRTest):
 
         # The daemon is not running yet. Listing remote devices is
         # expected to fail.
-        _, ret = self.emulator.run("usbip list --remote=127.0.0.1")
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk("usbip list --remote=127.0.0.1")
 
         # We start the USBIP daemon.
         self.assertRunOk("usbipd -D")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#53 lore raw

PATCH 28/29 support/testing: test_weston.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_weston.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_weston.py +1 -2
index c8b243a6a7..737015f8c4 100644
@@ -150,5 +150,4 @@ class TestWeston(infra.basetest.BRTest, GraphicsBase):
 
         # Now weston is supposed to be stopped,
         # a simple client is expected to fail.
-        _, exit_code = self.emulator.run("wayland-info")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("wayland-info")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#54 lore raw

Re: [Buildroot] [PATCH 28/29] support/testing: test_weston.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 22 lines
---
 support/testing/tests/package/test_weston.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_weston.py +1 -2
index c8b243a6a7..737015f8c4 100644
@@ -150,5 +150,4 @@ class TestWeston(infra.basetest.BRTest, GraphicsBase):
 
         # Now weston is supposed to be stopped,
         # a simple client is expected to fail.
-        _, exit_code = self.emulator.run("wayland-info")
-        self.assertNotEqual(exit_code, 0)
+        self.assertRunNotOk("wayland-info")
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#55 lore raw

PATCH 29/29 support/testing: test_which.py: use assertRunNotOk()

In reply to Peter Korsgaard

Use the helper to simplify the test.

---
 support/testing/tests/package/test_which.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_which.py +1 -2
index 38f528aa7f..05ed56ccb4 100644
@@ -33,8 +33,7 @@ class TestWhich(infra.basetest.BRTest):
 
         # We check "which" returns an error when the program is not
         # found.
-        _, ret = self.emulator.run(f"which {alias_name}")
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(f"which {alias_name}")
 
         # We define a shell alias.
         alias_cmd = "/bin/true"
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#56 lore raw

Re: [Buildroot] [PATCH 29/29] support/testing: test_which.py: use assertRunNotOk()

In reply of:

Quoted 3 lines

Use the helper to simplify the test.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 25 lines
---
 support/testing/tests/package/test_which.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
support/testing/tests/package/test_which.py +1 -2
index 38f528aa7f..05ed56ccb4 100644
@@ -33,8 +33,7 @@ class TestWhich(infra.basetest.BRTest):
 
         # We check "which" returns an error when the program is not
         # found.
-        _, ret = self.emulator.run(f"which {alias_name}")
-        self.assertNotEqual(ret, 0)
+        self.assertRunNotOk(f"which {alias_name}")
 
         # We define a shell alias.
         alias_cmd = "/bin/true"
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Reviewed-by Fiona Klute on v1 1/29
#57 lore raw
In reply to Peter Korsgaard

Am 18.06.26 um 14:47 schrieb Peter Korsgaard:

Quoted 5 lines

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.

Looks good to me!

Quoted 13 lines
---
  support/testing/infra/basetest.py | 11 +++++++++++
  1 file changed, 11 insertions(+)
support/testing/infra/basetest.py +1 -0
index 5fa902a77f..9b3eef6fa8 100644
@@ -150,3 +150,14 @@ class BRTest(BRConfigTest):
              0,
              "\nFailed to run: {}\noutput was:\n{}".format(cmd, '  '+'\n  '.join(out))
          )
+

support/testing/infra/basetest.py class BRTest(BRConfigTest): · line 163

Quoted 10 lines
support/testing/infra/basetest.py +10 -0
+    # 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))
+        )

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#58 lore raw
In reply to Peter Korsgaard
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

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.

Committed series, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#59 lore raw
In reply to Peter Korsgaard

In reply of:

Quoted 5 lines

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.

Applied to 2025.02.x & 2026.05.x. Thanks

Quoted 30 lines
---
 support/testing/infra/basetest.py | 11 +++++++++++
 1 file changed, 11 insertions(+)
support/testing/infra/basetest.py +11 -0
index 5fa902a77f..9b3eef6fa8 100644
@@ -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))
+        )
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot