Skip to content

Commit

Permalink
tests: Work around corrupted UBI volume on partial write.
Browse files Browse the repository at this point in the history
Corrupting the volume when the write doesn't write everything it's
supposed to, is an intentional security feature of UBI, and it can
trigger when we do checksum mismatch tests, which suddenly stop
writing when they discover that the checksum is wrong. This apparently
is checked more rigorously in recent kernels, so accept a non-readable
volume when performing UBI tests.

Changelog: None

Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
  • Loading branch information
kacf committed Nov 22, 2018
1 parent 85a9bf5 commit 8aa96d7
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tests/acceptance/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,25 @@ def test_signed_updates(self, sig_case, bitbake_path, bitbake_variables):
else:
expected_content = old_content

content = run("dd if=%s bs=%d count=1"
% (passive, len(expected_content)))
assert content == expected_content, "Case: %s" % sig_case.label
try:
content = run("dd if=%s bs=%d count=1"
% (passive, len(expected_content)))
assert content == expected_content, "Case: %s" % sig_case.label

# In Fabric context, SystemExit means CalledProcessError. We should
# not catch all exceptions, because we want to leave assertions
# alone.
except SystemExit:
if "mender-ubi" in bitbake_variables['DISTRO_FEATURES'].split():
# For UBI volumes specifically: The UBI_IOCVOLUP call which
# Mender uses prior to writing the data, takes a size
# argument, and if you don't write that amount of bytes, the
# volume is marked corrupted as a security measure. This
# sometimes triggers in our checksum mismatch tests, so
# accept the volume being unreadable in that case.
pass
else:
raise

finally:
# Reset environment to what it was.
Expand Down

0 comments on commit 8aa96d7

Please sign in to comment.