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

Use the helpers to simplify the test.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Peter Korsgaard
2026-06-18 14:47:53 +02:00
parent 03783de150
commit 8c301eed0e

View File

@@ -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)