Skip to content
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

machine.board: Introduce .board property #66

Merged
merged 2 commits into from
Feb 10, 2022
Merged

machine.board: Introduce .board property #66

merged 2 commits into from
Feb 10, 2022

Conversation

Rahix
Copy link
Owner

@Rahix Rahix commented Feb 1, 2022

Add a new protocol for all machines which were "derived" from a board.Board at some point. These should all implement the BoardMachineBase protocol which demands a .board property for accessing the original board.

This is useful because the board.Board machine might be used to define some parameters for this specific physical hardware, like an IP address. A BoardUBoot or BoardLinux machine would then want to be generic over these parameters. To illustrate:

class MyBoard(..., board.Board):
    ip_address = "1.2.3.4"

@tbot.testcase
def foo_test():
    with tbot.ctx.request(tbot.role.BoardUBoot) as ub:
        ip_address = ub.board.ip_address

    with tbot.ctx.request(tbot.role.BoardLinux) as lnx:
        ip_address = lnx.board.ip_address

One could now define different configs with different settings while using the same BoardUBoot and BoardLinux implementations with all of them.

Add a new protocol for all machines which were "derived" from a
board.Board at some point.  These should all implement the
BoardMachineBase protocol which demands a `.board` property for
accessing the original board.

This is useful because the board.Board machine might be used to define
some parameters for this specific physical hardware, like an IP address.
A BoardUBoot or BoardLinux machine would then want to be generic over
these parameters.  To illustrate:

    class MyBoard(..., board.Board):
        ip_address = "1.2.3.4"

    @tbot.testcase
    def foo_test():
        with tbot.ctx.request(tbot.role.BoardUBoot) as ub:
            ip_address = ub.board.ip_address

        with tbot.ctx.request(tbot.role.BoardLinux) as lnx:
            ip_address = lnx.board.ip_address

One could now define different configs with different settings while
using the same BoardUBoot and BoardLinux implementations with all of
them.

Ref: #65
Signed-off-by: Harald Seiler <hws@denx.de>
@Rahix Rahix added the feature Enhancement/New feature label Feb 1, 2022
@Rahix Rahix merged commit 97a5b6e into master Feb 10, 2022
@Rahix Rahix deleted the board-access branch February 10, 2022 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Enhancement/New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant