Checkbox launchers¶
Checkbox launchers are INI files that customize checkbox experience. The customization includes:
choosing what jobs will be run
how to handle machine restart
what type of UI to use
how to handle the results
Each section in the launcher is optional, when not supplied, the default values will be used.
This document describes Launchers version 1.
External configuration files¶
Launcher can specify external file(s) to load values from.
[config]Beginning of the configuration section.
config_filenameName of the configuration file to look for. The value may be a file name or an absolute path, and may use environment variables. If no directory is specified, the default directories where the file will be searched for are
/etc/xdg/and~/.config/.Default value:
checkbox.conf
Examples:
# Looks for ``/etc/xdg/testing.conf`` and ``~/.config/testing.conf``
[config]
config_filename = testing.conf
# Use an environment variable
[config]
config_filename = $MYCONFIGS/testing.conf
# Use an absolute path
[config]
config_filename = /home/ubuntu/next-testing.conf
For more details about value resolution order, see Checkbox configs.
Launcher meta-information¶
Launcher meta-information helps to provide consistent checkbox behavior in the future.
[launcher]Beginning of the launcher meta-information section.
app_idThis fields helps to differentiate between checkbox front-ends. This way sessions started with launcher with one
app_idwon’t interfere with sessions started with a different launcher (provided it hasapp_idset to other value). The app_id should be in a IQN form. Default value:com.canonical:checkbox-cliapp_versionThis field is purely informational.
launcher_versionVersion of the launcher language syntax and semantics to use.
api_flagsAPI flags variable determines optional feature set. List of API flags that this launcher requires. Items should be separated by spaces or commas. The default value is an empty list.
api_versionAPI version determines the behavior of the launcher. Each checkbox feature is added at a specific API version. Default behaviors don’t change silently; explicit launcher change is required. Default value:
0.99session_titleA title to be applied to the sessions created using this launcher. This can be be used to identify a stored sessions and can be used in report generation.
session_descA string that can be applied to sessions created using this launcher. Useful for storing some contextual information about the session.
stock_reportsStock reports are shortcuts in creating common reports. Instead of having to specify exporter, transport and a report section in a launcher, you can use any number of the stock ones. In launchers version 1 there are 4 stock reports you may use:
text: Print results as text on standard outputsubmission_files: Writehtml,jsonandtar.xzfiles to$XDG_DATA_HOMEdirectory (or to~/.local/share/if$XDG_DATA_HOMEis not defined)certification: Send results to certification sitecertification-staging: Send results to staging version of certification sitesubmission_json: Writes thesubmission.jsonto$XDG_DATA_HOME(or~/.local/shareif it is not defined)
If you don’t want to have any stock report automatically generated use
noneas the value.This field is a list; use commas or spaces to separate stock reports. The default value:
text, certification, submission_files.When using
certificationstock report, thesecure_idvariable may be overridden by the launcher. To do this definesecure_idin atransport:c3section (this is the transport that’s used by thecertificationstock reports).
Launcher section example:
[launcher]
app_id = com.foobar:system-testing
launcher_version = 1
stock_reports = text
session_title = MegaCorp Thingy Alpha-1
session_desc = Testing the alpha-1 release of MegaCorp Thingy including feature X
Launcher using all defaults with overridden secure_id:
[transport:c3]
secure_id = 001122334455667788
Launcher that disables all stock reports:
[launcher]
app_id = com.foobar:system-testing
launcher_version = 1
stock_reports = none
Test plan section¶
This section provides control over which test plans are visible in the menus and optionally forces the app to use particular one.
[test plan]Beginning of the test plan section.
unitAn ID of a test plan that should be selected by default. By default nothing is selected.
filterGlob that test plan IDs have to match in order to be visible. Default value:
*forcedIf set to
yes, test plan selection screen will be skipped. Requiresunitfield to be set. Default value:no.
Test selection section¶
This section provides control over test selection.
[test selection]Beginning of the test selection section
forcedIf set to
yes, test selection screen will be skipped and all test specified in the test plan will be selected. Default value:noexcludeList of regex patterns that job ids will be matched against. The matched jobs will be excluded from running in both stages of the session: bootstrapping and normal stage. Note that if you specify a pattern that matches a resource job that is used to instantiate template units those units won’t get generated. The patterns should be separated with whitespace. Examples:
Exclude all jobs containing ‘bluetooth’ in their id:
[test selection]
exclude = .*bluetooth.*
Exclude all jobs containing bluetooth in their id, or having ids starting
with com.canonical.certification::dock/wireless:
[test selection]
exclude = .*bluetooth.* com.canonical.certification::dock/wireless.*
Note: Exclude field set in launcher can be overridden in a config, following Checkbox values resolution order. See configs for more info.
Note: To clear the exclude list use…
exclude =
…in your ‘last’ config.
matchList of regex patterns that job ids and template ids will be matched against. Checkbox will only run the matching jobs, their dependencies and any job included in the testplan bootstrap section. This is useful to re-run the failing subset of jobs included in a test plan.
Only run bluetooth jobs and their dependencies:
[test selection]
match = .*bluetooth.*
Note
exclude takes precedence over match.
Note
You can use match only to select jobs already included in a test
plan. You can not use it to include additional tests in a test plan.
User Interface section¶
This section controls which type of UI to use.
[ui]Beginning of the user interface section
typeType of UI to use:
interactiveruns the standard Checkbox command line version that prompts user in non-automated tests.silentskips the tests that would require human interaction. This UI type requires forcing test selection and test plan selection. It’s not ‘silent’ in the traditional command-line tool sense.convergedlaunches the QML interface. It requirescheckbox-convergedto be installed on your system.converged-silentlaunches the QML interface and skips the tests that would require human interaction. It requirescheckbox-convergedto be installed on your system. This UI type requires forcing test selection and test plan selection.
Default value:
interactive.dont_suppress_outputWarning
This field is deprecated, use ‘output’ to specify which jobs should have their output printed to the screen.
Setting this field to
yesdisables hiding of command output for jobs of typeresourceandattachment. Default value:no.outputThis setting lets you hide output of commands run by checkbox. It can be set to one of the following values:
show- output of all jobs will be printedhide-resource-and-attachment- output of resource and attachment jobs will be hidden, output of other job types will be printedhide-automated- output of shell jobs as well as attachment and resource jobs will be hidden. Only interactive job command’s output will be shownhide- same ashide-automated. This value is deprecated, usehide-automated
Default value:
showNote
Individual jobs can have their output hidden by specifying ‘suppress-output’ in their definition.
verbosityThis setting makes checkbox report more information from checkbox internals. Possible values are:
normal- report only warnings and errors.verbose- report important events that take place during execution (E.g. adding units, starting jobs, changing the state of the session)debug- print out everything
Default value:
normalNote
You can also change this behavior when invoking Checkbox by using
--verboseand--debugoptions respectively.auto_retryIf set to
yes, all failed jobs will automatically be retried at the end of the testing session. In addition, the re-run screen (where user can select failed and skipped jobs to re-run) will not be shown. Default value:no.Note
You can use
auto-retry=noinline in the test plan to exclude a job from auto-retrying. For more details, see Configuring auto-retry for failing tests.max_attemptsDefines the maximum number of times a job should be run in auto-retry mode. If the job passes, it won’t be retried even if the maximum number of attempts have not been reached. Default value:
3.delay_before_retryThe number of seconds to wait before retrying the failed jobs at the end of the testing session. This can be useful when the jobs rely on external factors (e.g. a WiFi access point) and you want to wait before retrying the same job. Default value:
1.
Restart section¶
This section enables fine control over how checkbox is restarted.
[restart]Beginning of the restart section
strategyOverride the restart strategy that should be used. Currently supported strategies are
XDGandSnappy. By default the best strategy is determined at runtime.
Environment section¶
[environment]Beginning of the environment section
Each variable present in the
environmentsection will be present as environment variable for all jobs run.
Example:
[environment]
TESTING_HOST = 192.168.0.100
Daemon-specific configuration¶
[agent]Warning
This section was previously called
[daemon]. This term has been deprecated as of Checkbox 2.9 and is planned for removal.Beginning of the agent-specific section.
Settings in this section only apply to sessions that are run by Checkbox Agent spawned as Systemd service.
normal_userUsername to use when job doesn’t specify which user to run as.
The systemd service run on the agent is run by root so in order to run some jobs as an unprivileged user this variable can be used.
Manifest section¶
[manifest]Beginning of the manifest section.
Each variable present in the
manifestsection will be used as a preset value for the system manifest, taking precedence over the disk cache.
Example:
[manifest]
com.canonical.certification::has_touchscreen = yes
com.canonical.certification::has_usb_type_c = true
com.canonical.certification::foo = 23
Generating reports¶
Creation of reports is governed by three sections: report, exporter, and
transport. Each of those sections might be specified multiple times to
provide more than one report.
Exporter¶
[exporter:exporter_name]Beginning of an exporter declaration. Note that
exporter_nameshould be replaced with something meaningful, likehtml.unitID of an exporter to use. To get the list of available exporters on your system run
$ checkbox-cli list exporter.optionsA list of options that will be supplied to the exporter. Items should be separated by spaces or commas.
Example:
[exporter:html]
unit = com.canonical.plainbox::html
Transport¶
[transport:transport_name]Beginning of a transport declaration. Note that
transport_nameshould be replaced with something meaningful, likestandard_out.typeType of a transport to use. Allowed values are:
stream,file, andsubmission-service.
Depending on the type of transport there might be additional fields.
transport type |
variables |
meaning |
example |
|---|---|---|---|
|
|
which stream to
use |
|
|
|
where to save the file |
|
|
|
secure-id to use when uploading to certification sites |
|
|
determines if
staging site
should be used
Default:
|
Report¶
[report:report_name]Beginning of a report declaration. Note that
report_nameshould be replaced with something meaningful, liketo_screen.exporterName of the exporter to use
transportName of the transport to use
forcedIf set to
yeswill make checkbox always produce the report (skipping the prompt). Default value:no.
Example of all three sections working to produce a report:
[exporter:text]
unit = com.canonical.plainbox::text
[transport:out]
type = stream
stream = stdout
[report:screen]
exporter = text
transport = out
forced = yes
Launcher examples¶
1) Fully automatic run of all tests from ‘com.canonical.certification::smoke’ test plan concluded by producing text report to standard output.
#!/usr/bin/env checkbox-cli
[launcher]
launcher_version = 1
app_id = com.canonical.certification:smoke-test
stock_reports = text
[test plan]
unit = com.canonical.certification::smoke
forced = yes
[test selection]
forced = yes
[ui]
type = silent
[transport:outfile]
type = stream
stream = stdout
[exporter:text]
unit = com.canonical.plainbox::text
[report:screen]
transport = outfile
exporter = text
2) Interactive testing of FooBar project. Report should be uploaded to the staging version of certification site and saved to /tmp/submission.tar.xz
#!/usr/bin/env checkbox-cli
[launcher]
launcher_version = 1
app_id = com.foobar:system-testing
[providers]
use = com.megacorp.foo::bar*
[test plan]
unit = com.megacorp.foo::bar-generic
[ui]
type = silent
output = hide
[transport:certification]
type = certification
secure-id = 00112233445566
staging = yes
[transport:local_file]
type = file
path = /tmp/submission.tar.xz
[report:c3-staging]
transport = certification
exporter = tar
[report:file]
transport = local_file
exporter = tar
3) A typical launcher to run a desktop SRU test plan automatically.
The launcher will automatically retry the failed test jobs. Besides,
this launcher includes another launcher launcher.conf as its
customized environment configuration.
The launcher
#!/usr/bin/env checkbox-cli
[launcher]
launcher_version = 1
[config]
config_filename = $HOME/launcher.conf
[test plan]
unit = com.canonical.certification::sru
forced = yes
[test selection]
forced = yes
[ui]
type = silent
auto_retry = yes
max_attempts = 3
delay_before_retry = 15
The launcher configuration launcher.conf
#!/usr/bin/env checkbox-cli
[launcher]
launcher_version = 1
stock_reports = text, submission_files, certification
[transport:c3]
secure_id = <your secure ID>
[transport:local_file]
type = file
path = /home/ubuntu/c3-local-submission.tar.xz
[exporter:example_tar]
unit = com.canonical.plainbox::tar
[report:file]
transport = local_file
exporter = tar
forced = yes
[environment]
ROUTERS = multiple
WPA_BG_SSID = foo-bar-bg-wpa
WPA_BG_PSK = foo-bar
WPA_N_SSID = foo-bar-n-wpa
WPA_N_PSK = foobar
WPA_AC_SSID = foo-bar-ac-wpa
WPA_AC_PSK = foobar
OPEN_BG_SSID = foo-bar-bg-open
OPEN_N_SSID = foo-bar-n-open
OPEN_AC_SSID = foo-bar-ac-open
BTDEVADDR = ff:oo:oo:bb:aa:rr
TRANSFER_SERVER = cdimage.ubuntu.com