Skip to content

Commit

Permalink
Add B4 Tool
Browse files Browse the repository at this point in the history
  • Loading branch information
adityagesh committed Nov 12, 2024
1 parent 681f5bd commit 3a8e360
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lisa/tools/b4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pathlib
import re
from lisa.executable import Tool
from lisa.operating_system import Posix
from lisa.util import get_matched_str


class B4(Tool):
_output_file_pattern = re.compile(r"[\w-]+\.mbx")

@property
def command(self) -> str:
return "b4"

@property
def can_install(self) -> bool:
return True

def _install(self) -> bool:
if isinstance(self.node.os, Posix):
self.node.os.install_packages("b4")
return self._check_exists()

def am(self, message_id: str, output_dir: pathlib.PurePath) -> pathlib.PurePath:
result = self.run(
f"am -o '{output_dir}' '{message_id}'", force_run=True, expected_exit_code=0
)
path_str = get_matched_str(result.stdout, self._output_file_pattern)
return pathlib.PurePath(output_dir, path_str)

0 comments on commit 3a8e360

Please sign in to comment.