support/testing: infra: add assertRunNotOk()
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
@@ -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
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
@@ -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
Thomas Perale via buildroot
AppliedRe: [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.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 3/29 support/testing: test_acl.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 03/29] support/testing: test_acl.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 4/29 support/testing: test_audit.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 04/29] support/testing: test_audit.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 5/29 support/testing: test_bitcoin.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 05/29] support/testing: test_bitcoin.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 6/29 support/testing: test_connman.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 06/29] support/testing: test_connman.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 7/29 support/testing: test_cryptsetup.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 07/29] support/testing: test_cryptsetup.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 8/29 support/testing: test_ddrescue.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 08/29] support/testing: test_ddrescue.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 9/29 support/testing: test_dos2unix.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 09/29] support/testing: test_dos2unix.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 10/29 support/testing: test_fping.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 10/29] support/testing: test_fping.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 11/29 support/testing: test_gnupg2.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 11/29] support/testing: test_gnupg2.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 12/29 support/testing: test_iproute2.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 12/29] support/testing: test_iproute2.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 13/29 support/testing: test_iptables.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 13/29] support/testing: test_iptables.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 14/29 support/testing: test_jq.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 14/29] support/testing: test_jq.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 15/29 support/testing: test_kmod.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 15/29] support/testing: test_kmod.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 16/29 support/testing: test_libgpgme.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 16/29] support/testing: test_libgpgme.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 17/29 support/testing: test_lsof.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 17/29] support/testing: test_lsof.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 18/29 support/testing: test_mariadb.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 18/29] support/testing: test_mariadb.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 19/29 support/testing: test_mtools.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 19/29] support/testing: test_mtools.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 20/29 support/testing: test_nftables.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
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.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 20/29] support/testing: test_nftables.py: use assertRunNotOk()
In reply to Peter KorsgaardIn reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 21/29 support/testing: test_octave.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
PATCH 22/29 support/testing: test_polkit.py: use assertRun{, Not}Ok()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [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.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 23/29 support/testing: test_postgresql.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 23/29] support/testing: test_postgresql.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 24/29 support/testing: test_rasdaemon.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 24/29] support/testing: test_rasdaemon.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 25/29 support/testing: test_screen.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 25/29] support/testing: test_screen.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 26/29 support/testing: test_swipl.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 26/29] support/testing: test_swipl.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 27/29 support/testing: test_usbip.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 27/29] support/testing: test_usbip.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 28/29 support/testing: test_weston.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 28/29] support/testing: test_weston.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
PATCH 29/29 support/testing: test_which.py: use assertRunNotOk()
In reply to Peter KorsgaardUse 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
@@ -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
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 29/29] support/testing: test_which.py: use assertRunNotOk()
In reply of:
Quoted 3 lines
Use the helper to simplify the test.
Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
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 existingassertRunOk()to handle that instead of open coding it everywhere.Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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
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 existingassertRunOk()to handle that instead of open coding it everywhere.Signed-off-by Peter Korsgaard <[email protected]>
Committed series, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Perale via buildroot
AppliedIn 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 existingassertRunOk()to handle that instead of open coding it everywhere.Signed-off-by Peter Korsgaard <[email protected]>
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@@ -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