mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-08 00:20:38 -09:00
support/testing: test_cryptsetup.py: use assertRunNotOk()
Use the helper to simplify the test.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
(cherry picked from commit 69948ba028)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
committed by
Thomas Perale
parent
4f342f960d
commit
1035f0dfad
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user