Skip to content

Commit

Permalink
fix test failed issue while rpmsg is running (Bugfix) (#1692)
Browse files Browse the repository at this point in the history
fix test failed issue while rpmsg is running by default
  • Loading branch information
stanley31huang authored Jan 22, 2025
1 parent 119a1f7 commit a680960
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,18 @@ def _setup(self):

def _teardown(self):
self.rpmsg_state = "stop"
for key in self.properties:
if getattr(self, key) != self._previous_config[key]:
setattr(self, key, self._previous_config[key])
self.firmware_path = self._previous_config["firmware_path"]
self.firmware_file = self._previous_config["firmware_file"]
if (
self.firmware_file.strip() != "(null)"
and self._previous_config["rpmsg_state"].strip() == "running"
):
# start RPMSG again when firmware file been configured
self.rpmsg_state = "start"

@property
def firmware_path(self) -> str:
return self._firmware_path.read_text()
return self._firmware_path.read_text().strip()

@firmware_path.setter
def firmware_path(self, value: str) -> None:
Expand All @@ -81,10 +86,51 @@ def firmware_file(self, value: str) -> None:

@property
def rpmsg_state(self) -> str:
"""
Reports the state of the remote processor, which will be one of:
- "offline"
- "suspended"
- "running"
- "crashed"
- "invalid"
"offline" means the remote processor is powered off.
"suspended" means that the remote processor is suspended and
must be woken to receive messages.
"running" is the normal state of an available remote processor
"crashed" indicates that a problem/crash has been detected on
the remote processor.
"invalid" is returned if the remote processor is in an
unknown state.
Returns:
str: remote processor state
"""
return self._rpmsg_state.read_text()

@rpmsg_state.setter
def rpmsg_state(self, value: str) -> None:
"""
Writing this file controls the state of the remote processor.
The following states can be written:
- "start"
- "stop"
Writing "start" will attempt to start the processor running the
firmware indicated by, or written to,
/sys/class/remoteproc/.../firmware. The remote processor should
transition to "running" state.
Writing "stop" will attempt to halt the remote processor and
return it to the "offline" state.
Returns:
None
"""
if value not in ["start", "stop"]:
raise ValueError("Unsupported value for remote processor state")
self._rpmsg_state.write_text(value)

@property
Expand Down Expand Up @@ -169,7 +215,11 @@ def load_firmware_test(args) -> None:
with RpmsgLoadFirmwareTest(remote_proc_dev) as rpmsg_handler:
rpmsg_handler.search_pattern = search_patterns
rpmsg_handler._init_logger()
if rpmsg_handler.rpmsg_state == "online":
if rpmsg_handler.rpmsg_state.strip() in [
"running",
"suspended",
"invalid",
]:
logging.info("Stop the Remote processor")
rpmsg_handler.rpmsg_state = "stop"
logging.info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ _summary: Reload Remote Processor firmware to {firmware} via RPMSG {device}
id: ce-oem-rpmsg/reload-rp-firmware-test-{firmware}-{device}
category_id: rpmsg
estimated_duration: 60
requires: manifest.has_rpmsg == 'True'
requires:
manifest.has_rpmsg == 'True'
manifest.has_rpmsg_firmware_load == 'True'
imports: from com.canonical.plainbox import manifest
flags: also-after-suspend
user: root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ unit: manifest entry
id: has_rpmsg
_name: Remote Processor Messaging (rpmsg) framework supported?
value-type: bool

unit: manifest entry
id: has_rpmsg_firmware_load
_name: Change the RPMSG running firmware is supported?
value-type: bool

0 comments on commit a680960

Please sign in to comment.