Quick Start
Please read also chapters configuration and requirements for lab host and to get a rough overview for the lab setup check lab setup
To get fast a working setup you can use the script:
https://github.com/hsdenx/tbottest/tree/master/scripts/create_setup.sh
which will create you a complete base setup, as described in configuration.
With --inter it asks for the console access and the power control of
the board and their settings. The generated tbot.ini holds only the
selected console and power control section, so tbot finds exactly one of
each. A unique prefix of a choice is enough (tm for tm021), the
full name always selects (shell although shelly starts with it).
Without --inter it creates the setup the github CI uses: board
foo, picocom and sispmctrl. --ci also copies the testcases the
github CI of tbottest runs to tbotconfig/ci; a normal setup does not
need them. --json sets the configuration up as tbot.json and
<board>.json instead of tbot.ini, <board>.ini and
boardspecific.py, see JSON configuration and expressions; only one of the two
is copied, and the argument file argsbase names the JSON files.
JSON is the preferred format for a new setup, so start it with
--json:
$ ./create_setup.sh --inter --json
tbot reads the JSON files as they are. There are no modified copies, no
@@...@@ placeholders and no boardspecific.py; what depends on a
flag or on the environment is written in the file as an expression such
as ${flag:NAME:-default}. The ini files keep working, and
generic_config_to_json turns the configuration of an ini setup into
JSON files, see JSON configuration and expressions.
Lab setup
How the tbot host, the lab host, the board (DUT) and a build machine are connected is shown in lab setup. Get more info here: tbottest.generic.
Example run
$ wget -q https://github.com/hsdenx/tbottest/raw/master/scripts/create_setup.sh
$ chmod 777 create_setup.sh
$ ./create_setup.sh --inter
Cloning into 'tbot'...
[...]
Cloning into 'tbottest'...
[...]
Check that ssh login without password works!
Name of the lab: foolabname
Hostname of the lab: 192.168.1.113
Username for login into lab: pi
Name of the board in your lab: foobar
Vendor of the board (used in the aliases of setup.sh): foovendor
Select console access for the board (picocom|kermit|scriptcom|telnet): picocom
picocom baudrate: 115200
picocom device: /dev/ttyUSB0
picocom delay after exit: 3
picocom noreset (True|False): True
Select power switch method for the board (gpio|sispmctrl|shell|shelly|tinkerforge|tbox|tbox-hwdaemon|tm021): sispmctrl
Sispmctl MAC: 01:01:4f:09:5b
Sispmctl Port: 1
Created picocom console and sispmctrl powerctrl setup
add commandline completions with:
source tbottest/completions.sh
add the aliases for starting tbot with:
source setup.sh
start tbot with the aliases from setup.sh:
tbfoobar <testcase>
Now edit lab config in tbotconfig/foobar/tbot.ini
check that 'ssh pi@192.168.1.113' works without typing password
than interactive lab should work:
tbfoobarnoeth $conint.lab
edit and adapt U-Boot settings in tbotconfig/foobar/foobar.ini and interactive U-Boot should work
tbfoobarnoeth $conint.uboot
edit linux settings in tbotconfig/foobar/foobar.ini and interactive Linux should work
tbfoobarnoeth $conint.linux
start CI tests with
tbfoobarnoeth $con.ci.tests.all
Aliases for starting tbot
create_setup.sh also writes setup.sh next to tbot,
tbottest and tbotconfig, from the example
tbottest/tbotconfig/setup.sh, with the board name and the vendor
filled in. An existing setup.sh is left alone; if it has no aliases
for the board, create_setup.sh warns and prints the two commands that
write one. Source it in that directory:
$ source setup.sh
For the example run above it defines:
tbtbottest/newtbot_starter.pytbfoobartbwithtbotconfig/foobar/args/argsfoobartbfoobarnoethtbwithargsfoobar-noeth, which adds-fnoethinit -fnoboardethinittbfoobarsshtbwithargsfoobar-noeth-ssh, which adds-fnopoweroff -falways-on -fssh -fnoubootto thattbfoovendorfoobar,tbfoovendorfoobar-noeth,tbfoovendorfoobar-sshthe three above with
-f boardname:foobaradded$con,$conint,$tbtcthe module paths
tbotconfig,tbotconfig.interactiveandtbottest.tc$foobarthe testcase module of the board,
tbotconfig.tc_foobar
The commands the script prints at the end use these aliases.
The board name becomes a shell variable, so it must be a valid shell
variable name (no -).
Test your new config and setup with:
$ source setup.sh
$ tbfoobarnoeth $conint.lab
tbot starting ...
├─TBOT.FLAGS {'boardfile:tbotconfig/foobar/foobar.ini', 'noethinit', 'picocom', 'inifile:tbotconfig/foobar/tbot.ini', 'do_power', 'useifconfig'}
├─boardname now foobar
├─Using kas file kas-denx-withdldir.yml
FILENAME ~/temp/tbotconfig/foobar/tbot.ini-modified
├─Calling lab ...
│ ├─[local] ssh -o BatchMode=yes -i /home/pi/.ssh/id_rsa -p 22 pi@192.168.1.113
│ ├─Entering interactive shell ...
│ ├─Press CTRL+] three times within 1 second to exit.
foolabname: ~> exit
│ ├─Exiting interactive shell ...
│ └─Done. (3.496s)
├─────────────────────────────────────────
└─SUCCESS (3.576s)
$
To be independent of the installed tbot on the system, you can use the tbot starter script:
https://github.com/hsdenx/tbottest/blob/master/newtbot_starter.py