Commit 624cec63 authored by Dean Birch's avatar Dean Birch
Browse files

Musca support tweaks



Changes for discussions in code review:
* Removing run method not required.
* Tweak url deploy schema
* Add in shell support in case it is used.
* Using more appropriate os.path methods.
* Removing unneeded file handle variable

Change-Id: Ib8c603e7c8d9ee0ae154f779599fd6abbe3cd5fe
Signed-off-by: default avatarDean Birch <dean.birch@arm.com>
parent 0b2cf695
......@@ -29,9 +29,7 @@ def schema():
base = {
Required("to"): "musca",
Required("images"): {
Required("test_binary", "'images' has no 'test_binary' entry"): {
**deploy.url()
}
Required("test_binary", "'images' has no 'test_binary' entry"): deploy.url()
},
}
return {**deploy.schema(), **base}
......@@ -19,11 +19,16 @@
# with this program; if not, see <http://www.gnu.org/licenses>.
from lava_dispatcher.action import Pipeline
from lava_dispatcher.actions.boot import BootAction
from lava_dispatcher.actions.boot import (
BootAction,
OverlayUnpack,
ExportDeviceEnvironment,
)
from lava_dispatcher.actions.boot import AutoLoginAction
from lava_dispatcher.connections.serial import ConnectDevice
from lava_dispatcher.logical import Boot
from lava_dispatcher.power import ResetDevice
from lava_dispatcher.shell import ExpectShellSession
from lava_dispatcher.utils.udev import WaitUSBSerialDeviceAction
......@@ -64,13 +69,8 @@ class MuscaBoot(BootAction):
self.pipeline.add_action(ConnectDevice())
if self.has_prompts(parameters):
self.pipeline.add_action(AutoLoginAction())
def run(self, connection, max_end_time):
connection = self.get_namespace_data(
action="shared", label="shared", key="connection", deepcopy=False
)
connection = super().run(connection, max_end_time)
self.set_namespace_data(
action="shared", label="shared", key="connection", value=connection
)
return connection
if self.test_has_shell(parameters):
self.pipeline.add_action(ExpectShellSession())
if "transfer_overlay" in parameters:
self.pipeline.add_action(OverlayUnpack())
self.pipeline.add_action(ExportDeviceEnvironment())
......@@ -230,9 +230,7 @@ class DeployMuscaTestBinary(Action):
mount_point = self.get_namespace_data(
action="mount-musca-usbmsd", label="musca-usb", key="mount-point"
)
try:
os.path.realpath(mount_point)
except OSError:
if not os.path.exists(mount_point):
raise InfrastructureError("Unable to locate mount point: %s" % mount_point)
test_binary = self.get_namespace_data(
......@@ -271,16 +269,14 @@ class DeployMuscaAutomationAction(Action):
mount_point = self.get_namespace_data(
action="mount-musca-usbmsd", label="musca-usb", key="mount-point"
)
try:
os.path.realpath(mount_point)
except OSError:
if not os.path.exists(mount_point):
raise InfrastructureError("Unable to locate mount point: %s" % mount_point)
dest = os.path.join(mount_point, self.automation_filename)
self.logger.debug("Creating empty file %s", dest)
try:
automation_file = open(dest, "w")
automation_file.close()
with open(dest, "w"):
pass
except IOError:
raise InfrastructureError("Unable to write to %s" % dest)
......@@ -301,9 +297,7 @@ class CheckMuscaFlashAction(Action):
mount_point = self.get_namespace_data(
action="mount-musca-usbmsd", label="musca-usb", key="mount-point"
)
try:
os.path.realpath(mount_point)
except OSError:
if not os.path.realpath(mount_point):
raise InfrastructureError("Unable to locate mount point: %s" % mount_point)
fail_file = os.path.join(mount_point, "FAIL.TXT")
......
Supports Markdown
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