Commit a70b0ac5 authored by Christian Kellner's avatar Christian Kellner

test: integration: trailing '\n' for sysfs 'key'

The kernel ends the contents of 'key' with '\n', for non-zero but
also empty key-files. Our code should thus too.
parent faf7522a
......@@ -597,7 +597,8 @@ class Device(object):
bed.uevent(self.syspath, "remove")
self.authorized = 0
self.key = ""
if hasattr(self, 'key') and self.key is not None:
self.key = "\n"
self.syspath = None
self.testbed = None
......@@ -625,7 +626,7 @@ class TbDevice(Device):
self.vendor_name = vendor or ''
self.vendor = self._make_id(self.vendor_name)
self.authorized = authorized
self.key = ""
self.key = "\n"
def _make_id(self, name):
return '0x%X' % binascii.crc32(name.encode('utf-8'))
......@@ -1079,6 +1080,9 @@ class BoltTest(dbusmock.DBusTestCase):
'unique_id', uid]
if key is not None:
# The kernel always returns the key with trailing `\n`
if not key.endswith('\n'):
key += '\n'
props += ['key', key]
if boot is not None:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment