Automation/Testing tool for Embedded Linux Development
Clone or download
Rahix Release 0.6.4
Changes:
    Claudius Heine (2):
          linux.auth: Refactor Authenticator class
          linux.auth: Add NoneAuthenticator

    Heiko Schocher (1):
          doc: module-linux.rst: fix typo Backround

    Rahix (16):
          doc: Add flags documentation
          Update pre-commit config
          main: Add -C parameter
          completions: Add -C
          main: Add TBOTPATH environment variable
          doc: Rewrite board-init recipe section
          channel: Fix timeout sometimes going negative
          board.uboot: Fix bootlog missing if not autobooting
          Add contribution guidelines
          Add developer certificate of origin
          tc.git: Add GitRepository.apply()
          Add selftest_tc to travis config
          selftest: Add BuildMachine test
          linux.shell: Use new Shell.command instead of name
          lab.ssh: Fix tbot ignoring host aliases

Signed-off-by: Harald Seiler <hws@denx.de>
Latest commit 981af89 Dec 5, 2018

README.md

tbot
Python 3.6 Checked with mypy Code style: black Build Status
Embedded Test/Automation Tool

tbot is a testing/automation tool that is focused on usage in embedded development. At its core tbot just provides utilities for interaction with remote hosts/targets and an extensive library of routines that are common in embedded development/testing.

tbot aims to be a support for the developer while working on a project and without much modification also allow running tests in an automated setting (CI).

Most info about tbot can be found in its documentation. You can also join our mailing list at lists.denx.de.

tbot Architecture

Note that the tbot and Lab host can be the same machine. Same with Lab and Build host.

Installation

python3 setup.py install --user

Also, if you haven't done this already, you need to add ~/.local/bin to your $PATH.

Completions

tbot supports command line completions. Enable them by adding

source /path/to/tbot/completions.sh

to your .bashrc or equivalent.

Example

Blinks a GPIO Led on your selected target.

import contextlib
import typing
import time
import tbot
from tbot.machine import linux


@tbot.testcase
def blink(
    mach: typing.Optional[linux.LinuxMachine] = None,
    pin: int = 18,
) -> None:
    """Blink the led on pin ``pin``."""
    with contextlib.ExitStack() as cx:
        if mach is None:
            lh = cx.enter_context(tbot.acquire_lab())
            b = cx.enter_context(tbot.acquire_board(lh))
            lnx = cx.enter_context(tbot.acquire_linux(b))
        else:
            lnx = mach

        sys_gpio = linux.Path(lnx, "/sys/class/gpio")
        gpio_n = sys_gpio / f"gpio{pin}"
        try:
            lnx.exec0("echo", str(pin), stdout=sys_gpio / "export")

            # Wait for the gpio pin to be initialized
            time.sleep(0.5)
            lnx.exec0("echo", "out", stdout=gpio_n / "direction")
            for _ in range(5):
                lnx.exec0("echo", "1", stdout=gpio_n / "value")
                time.sleep(0.5)
                lnx.exec0("echo", "0", stdout=gpio_n / "value")
                time.sleep(0.5)
        finally:
            lnx.exec0("echo", str(pin), stdout=sys_gpio / "unexport")

Credits

Contributing

Help is really appreciated! Please take a look at tbot's contribution guidelines for more info. If you are unsure about anything, please open an issue or consult the mailing list first!

License

tbot is licensed under the GNU General Public License v3.0 or later. See LICENSE for more info.