-
Notifications
You must be signed in to change notification settings - Fork 199
driver/bareboxdriver.py: Add parameter 'boot_command' #1071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -29,6 +29,7 @@ class BareboxDriver(CommandMixin, Driver, CommandProtocol, LinuxBootProtocol): | |||
interrupt (str): optional, string to interrupt autoboot (use "\x03" for CTRL-C) | ||||
bootstring (regex): optional, regex indicating that the Linux Kernel is booting | ||||
password (str): optional, password to use for access to the shell | ||||
boot_command (str): optional, boot command to boot target | ||||
login_timeout (int): optional, timeout for access to the shell | ||||
""" | ||||
bindings = {"console": ConsoleProtocol, } | ||||
|
@@ -37,6 +38,7 @@ class BareboxDriver(CommandMixin, Driver, CommandProtocol, LinuxBootProtocol): | |||
interrupt = attr.ib(default="\n", validator=attr.validators.instance_of(str)) | ||||
bootstring = attr.ib(default=r"Linux version \d", validator=attr.validators.instance_of(str)) | ||||
password = attr.ib(default="", validator=attr.validators.instance_of(str)) | ||||
boot_command = attr.ib(default="boot -v", validator=attr.validators.instance_of(str)) | ||||
login_timeout = attr.ib(default=60, validator=attr.validators.instance_of(int)) | ||||
|
||||
def __attrs_post_init__(self): | ||||
|
@@ -198,12 +200,12 @@ def await_boot(self): | |||
self.console.expect(self.bootstring) | ||||
|
||||
@Driver.check_active | ||||
def boot(self, name: str): | ||||
def boot(self, name: str = ""): | ||||
"""Boot the default or a specific boot entry | ||||
|
||||
Args: | ||||
name (str): name of the entry to boot""" | ||||
if name: | ||||
self.console.sendline(f"boot -v {name}") | ||||
else: | ||||
self.console.sendline("boot -v") | ||||
self.console.sendline(self.boot_command) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After looking at this again: I think this can be quite confusing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For me, it's like: With There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Letting name default to an empty string looks good to me and should be adopted also by the UBootDriver. Is setting In general: I don't really understand why you'd want to set a custom boot command and use the boot method, neither in barebox nor in U-Boot (and I know that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Think we have 2 usecases:
Is there a prefer Way to select the boot_command? Should we get rid of the Driver.boot functions and set the drivers boot source only via strategy? The difference between the barebox "boot -v NAME" and uboot "COMMAND" was choosen because we consider the barebox interface to be more stable. If needed we could remove the "run" from the uboot boot_command and also select a target (environment script). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This does not really answer my question, does it? I see the boot methods as a convenience feature to boot the regular way (i.e.
I think for the regular case, they are convenient, see above. Everything else could be handled in a strategy.
I don't really understand this. Don't get me wrong here, I'm not strictly against the PR, especially since we have the same in the UBootDriver, but I'd like to prevent implementing special cases and overcomplicating the code if the alternative has no obvious downside and does not involve patching the driver. I guess @Emantor and @jluebbe should weigh in because they reviewed #621. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We currently work with a static strategy for most tests, like
The idea was to handle the boot source via the driver. def boot seams to be place to do this.Adding it as a strategy parameter would also work. I would be nice to have the same API for barebox and u-boot driver.
This was mostly about #1082
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.