Add test for LoadComponentAtPath.
Adds a test for the new LoadComponentAtPath method which supports
loading a component from a path outside of the /var/lib/imageloader
reserved storage.
BUG=chromium:728856
CQ-DEPEND=CL:538924
TEST=test_that -b ${BOARD} platform_ImageLoaderServer
Change-Id: I00a99980a8536e1e4bbbc44028c17f3d051c8560
Reviewed-on: https://chromium-review.googlesource.com/549218
Commit-Ready: Greg Kerr <kerrnel@chromium.org>
Tested-by: Greg Kerr <kerrnel@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
diff --git a/client/site_tests/platform_ImageLoader/platform_ImageLoader.py b/client/site_tests/platform_ImageLoader/platform_ImageLoader.py
index 619b872..26063d2 100644
--- a/client/site_tests/platform_ImageLoader/platform_ImageLoader.py
+++ b/client/site_tests/platform_ImageLoader/platform_ImageLoader.py
@@ -25,6 +25,7 @@
GET_COMPONENT_VERSION = 'GetComponentVersion'
REGISTER_COMPONENT = 'RegisterComponent'
LOAD_COMPONENT = 'LoadComponent'
+ LOAD_COMPONENT_AT_PATH = 'LoadComponentAtPath'
BAD_RESULT = ''
USER = 'chronos'
COMPONENT_NAME = 'TestFlashComponent'
@@ -65,6 +66,17 @@
user=self.USER,
args=args).response
+ def _load_component_at_path(self, name, path):
+ args = [dbus.String(name), dbus.String(path)]
+ return dbus_send.dbus_send(
+ self.BUS_NAME,
+ self.BUS_INTERFACE,
+ self.BUS_PATH,
+ self.LOAD_COMPONENT_AT_PATH,
+ timeout_seconds=20,
+ user=self.USER,
+ args=args).response
+
def _corrupt_and_load_component(self, component, iteration, target, offset):
"""Registers a valid component and then corrupts it by writing
a random byte to the target file at the given offset.
@@ -143,6 +155,12 @@
component1):
raise error.TestError('ImageLoader allowed a rollback')
+ # Test loading a component that lives at an arbitrary path.
+ mnt_path = self._load_component_at_path('FlashLoadedAtPath', component1)
+ if mnt_path == self.BAD_RESULT:
+ raise error.TestError('LoadComponentAtPath failed')
+ self._paths_to_unmount.append(mnt_path)
+
known_mount_path = '/run/imageloader/TestFlashComponent_testing'
# Now test loading the component on the command line.
if subprocess.call([