Giter Club home page Giter Club logo

tbot's Introduction

tbot
Python 3.6 Checked with mypy Code style: black tbot selftest CI
Embedded Test & Automation Tool

Welcome to tbot! tbot automates the development workflow for embedded systems software. This automation can then also be used for running tests against real hardware, even in CI.

At its core, tbot is a library for interacting with remote hosts over various connections. For example, a target board can be accessed via serial console. Or a TFTP-server via SSH. tbot allows managing all these connections in "parallel". This means, you can orchestrate complex sequences of interaction between them.

At the moment, the main focus of tbot lies in embedded Linux systems. Support for other systems is definitely intended to be added, too.

Most info about tbot can be found in its documentation at https://tbot.tools. You can also join our mailing list, tbot AT lists.denx.de.


Installation

pip3 install --user -U git+https://github.com/rahix/[email protected]

If you haven't done it already, you need to add ~/.local/bin to your $PATH.

Completions

tbot supports command line completions. Install them with the following commands:

curl --create-dirs -L -o ~/.local/lib/tbot/completions.sh https://github.com/Rahix/tbot/raw/master/completions.sh
echo "source ~/.local/lib/tbot/completions.sh" >>~/.bashrc

Usecase Examples

To show what tbot can help you with, here are a few simple example usecases:

Boot into Linux and run a few commands over serial console

@tbot.testcase
def test_linux_simple():
    # request serial connection to Linux on the board
    with tbot.ctx.request(tbot.role.BoardLinux) as lnx:
        # now we can run commands
        lnx.exec0("uname", "-a")

        # or, for example, read a file from the target
        cmdline = (lnx.fsroot / "proc" / "cmdline").read_text()

Define custom bootloader commands to boot Linux

class CustomBoardLinux(board.LinuxUbootConnector, board.LinuxBootLogin, linux.Bash):
    username = "root"
    password = None

    def do_boot(self, uboot):
        # set `autoload` env-var to false to prevent automatic DHCP-boot
        uboot.env("autoload", "false")

        # get an IP-address
        uboot.exec0("dhcp")

        # download kernel + initramfs from TFTP server
        loadaddr = 0x82000000
        uboot.exec0("tftp", hex(loadaddr), f"{tftp_ip}:{kernel_image_path}")

        # and boot it!
        return uboot.boot("bootm", hex(loadaddr))

Network speed test between a board and server

@tbot.testcase
def test_ethernet_speed():
    with tbot.ctx() as cx:
        # boot into Linux on the board and acquire a shell-session
        lnx = cx.request(tbot.role.BoardLinux)

        # use ssh to connect to a network server to test against
        lh = cx.request(tbot.role.LabHost)

        # start iperf server
        with lh.run("iperf", "-s") as iperf_server:
            # and display its output while waiting for startup
            iperf_server.read_until_timeout(2)

            # now run iperf client on DUT
            tx_report = lnx.exec0("iperf", "-c", server_ip)

            # exit the server with CTRL-C
            tbot.log.message("Server Output:")
            iperf_server.sendcontrol("C")
            iperf_server.terminate0()

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.

tbot's People

Contributors

rahix avatar hsdenx avatar demonpo avatar sjg20 avatar cmhe avatar jneuhauser avatar saimen avatar offdroid avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.