.\" Man page generated from reStructuredText. . .TH "PLAINBOX-RUN" "1" "January 05, 2016" "0.25" "Plainbox" .SH NAME plainbox-run \- run a test job . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C plainbox run [\-h] [\-\-non\-interactive] [\-n] [\-\-dont\-suppress\-output] [\-f FORMAT] [\-p OPTIONS] [\-o FILE] [\-t TRANSPORT] [\-\-transport\-where WHERE] [\-\-transport\-options OPTIONS] [\-T TEST\-PLAN\-ID] [\-i PATTERN] [\-x PATTERN] [\-w WHITELIST] .ft P .fi .UNINDENT .UNINDENT .SH DESCRIPTION .sp Run a test job .sp This command runs zero or more Plainbox jobs as a part of a single session and saves the test results. Plainbox will follow the following high\-level algorithm during the execution of this command. .INDENT 0.0 .IP 1. 3 Parse command line arguments and look if there\(aqs a session that can be resumed (see \fBRESUMING\fP below). If so, offer the user a choice to resume that session. If the resume operation fails move to the next qualifying session. Finally offer to create a new session. .IP 2. 3 If the session is being resumed, replay the effects of the session execution from the on\-disk state. This recreates generated jobs and re\-introduces the same resources into the session state. In other words, no jobs that have run in the past are re\-ran. .sp If the resumed session was about to execute a job then offer to skip the job. This allows test operators to skip jobs that have caused the system to crash in the past (e.g. system suspend tests) .sp If the session is not being resumed (a new session was created), set the \fIincomplete\fP flag. .IP 3. 3 Use the job selection (see \fBSELECTING JOBS\fP below) to derive the run list. This step involves resolving job dependencies and reordering jobs if required. .IP 4. 3 Follow the run list, executing each job in sequence if possible. Jobs can be inhibited from execution by failed dependencies or failed (evaluating to non\-True result) resource expressions. .sp If at any time a new job is being re\-introduced into the system (see \fBGENERATED JOBS\fP below) then the loop is aborted and control jumps back to step 3 to re\-select jobs. Existing results are not discarded so jobs that already have some results are not executed again. .sp Before and after executing any job the session state is saved to disk to allow resuming from a job that somehow crashes the system or crashes Plainbox itself. .IP 5. 3 Remove the \fIincomplete\fP flag. .IP 6. 3 Export the state of the session to the desired format (see \fBEXPORTING RESULTS\fP) and use the desired transport to send the results (see \fBTRANSPORTING RESULTS\fP). .IP 7. 3 Set the \fIsubmitted\fP flag. .UNINDENT .SS SELECTING JOBS .sp Plainbox offers two mechanisms for selecting jobs. Both can be used at the same time, both can be used multiple times. .SS Selecting jobs with patterns .sp The first mechanism is exposed through the \fB\-\-include\-pattern PATTERN\fP command\-line option. It instructs Plainbox to \fIselect\fP any job whose fully\-qualified identifier matches the regular expression \fBPATTERN\fP\&. .sp Jobs selected this way will be, if possible, ordered according to the order of command line arguments. For example, having the following command line would run the job \fIfoo\fP before running the job \fIbar\fP: .INDENT 0.0 .INDENT 3.5 plainbox run \-i \(aq.*::foo\(aq \-i \(aq.*::bar\(aq .UNINDENT .UNINDENT .SS Selecting jobs with whitelists .sp The second mechanism is the \fB\-\-whitelist WHITELIST\fP command\-line option. WhiteLists (or test plans, which is somewhat easier to relate to). Whitelists are simple text files composed of a list of regular expressions, identical to those that may be passed with the \fB\-i\fP option. .sp Unlike the \fB\-i\fP option though, there are two kinds of whitelists. Standalone whitelists are not associated with any Plainbox Provider. Such whitelists can be distributed entirely separately from any other component and thus have no association with any namespace. .sp Therefore, be fully qualified, each pattern must include both the namespace and the partial identifier components. For example, this is a valid, fully quallified whitelist: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C 2013.com.canonical.plainbox::stub/.* .ft P .fi .UNINDENT .UNINDENT .sp It will unambiguously select some of the jobs from the special, internal StubBox provider that is built into Plainbox. It can be saved under any filename and stored in any directory and it will always select the same set of jobs. .sp In contrast, whitelists that are associated with a particular provider, by being stored in the per\-provider \fBwhitelists/\fP directory, carry an implicit namespace. Such whitelists are typically written without mentioning the namespace component. .sp For example, the same "stub/.*" pattern can be abbreviated to: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C stub/.* .ft P .fi .UNINDENT .UNINDENT .sp Typically this syntax is used in all whitelists specific to a particular provider unless the provider maintainer explicitly wants to include a job from another namespace (for example, one of the well\-known Checkbox job definitions). .SS GENERATED JOBS .sp Plainbox offers a way to generate jobs at runtime. There are two motivations for this feature. .SS Instantiating Tests for Multiple Devices .sp The classic example is to probe the hardware (for example, to enumerate all storage devices) and then duplicate each of the store specific tests so that all devices are tested separately. .sp At this time jobs can be generated only from jobs using the plugin type \fIlocal\fP\&. Jobs of this kind are expected to print fully conforming job definitions on stdout. Generated jobs cause a few complexities and one limitation that is currently enforced is that generated jobs cannot generate additional jobs if any of the affected jobs need to run as another user. .sp Another limitation is that jobs cannot override existing definitions. .SS Creating Parent\-Child Association .sp A relatively niche and legacy feature of generated jobs is to print a verbatim copy of existing job definitions from a \fBlocal\fP job definition named afer a generic testing theme or category. For example the Checkbox job definition \fB__wireless__\fP prints, with the help of \fBcat\fP (1), all of the job definitions defined in the file \fBwireless.txt\fP\&. .sp This behavior is special\-cased not to cause redefinition errors. Instead, existing definitions gain the \fBvia\fP attribute that links them to the generator job. This feature is used by derivative application such as Checkbox. Plainbox is not using it at this time. .SS RESUMING .sp Plainbox offers a session resume functionality whereas a session that was interrupted (either purposefully or due to a malfunction) can be resumed and effectively continued where it was left off. .sp When resuming a session you may be given an option to either re\-run, pass, fail or skip the test job that was being executed before the session was interrupted. This is intended to handle both normal situations, such as a "system reboot test" where it is perfectly fine to "pass" the test without re\-running the command. In addition it can be used to handle anomalous cases where the machine misbehaves and re\-running the same test would cause the problem to occur again indefinitely. .SS Limitations .sp This functionality does not allow to interrupt and resume a test job that is already being executed. Such job will be restarted from scratch. .sp Plainbox tries to ensure that a single session is consistent and the assumptions that held at the start of the session are maintained at the end. To that end, Plainbox will try to ensure that job definitions have not changed between two separate invocations that worked with a single session. If such a situation is detected the session will not be resumed. .SS EXPORTING RESULTS .sp Plainbox offers a way to export the internal state of the session into a more useful format for further processing. .SS Selecting Exporters .sp The exporter can be selected using the \fB\-\-output\-format FORMAT\fP command\-line option. A list of available exporters (which may include 3rd party exporters) can be obtained by passing the \fB\-\-output\-format ?\fP option. .sp Some formats are more useful than others in that they are capable of transferring more of the internal state. Depending on your application you may wish to choose the most generic format (json) and process it further with additional tools, choose the most basic format (text) just to get a simple summary of the results or lastly choose one of the two specialized formats (xml and html) that are specific to the Checkbox workflow. .sp Out of the box the following exporters are supported: .SS html .sp This exporter creates a static HTML page with human\-readable test report. It is useful for communicating with other humans and since it is entirely standalone and off\-line it can be sent by email or archived. .SS json .sp This exporter creates a JSON document with the internal representation of the session state. It is the most versatile exporter and it is useful and easy for further processing. It is not particularly human\-readable but can be quite useful for high\-level debugging without having to use pdb and know the internals of Plainbox. .SS rfc822 .sp This exporter creates quasi\-RFC822 documents. It is rather limited and not used much. Still, it can be useful in some circumstances. .SS text .sp This is the default exporter. It simply prints a human\-readable representation of test results without much detail. It discards nearly all of the internal state though. .SS xlsx .sp This exporter creates a standalone .xlsx (XML format for Microsoft Excel) file that contains a human\-readable test report. It is quit similar to the HTML report but it is easier to edit. It is useful for communicating with other humans and since it is entirely standalone and off\-line it can be sent by email or archived. .sp It depends on python3\-xlsxwriter package .SS hexr .sp This exporter creates a rather confusingly named XML document only applicable for internal Canonical Hardware Certification Team workflow. .sp It is not a generic XML representation of test results and instead it carries quite a few legacy constructs that are only retained for compatibility with other internal tools. If you want generic processing look for JSON instead. .SS Selecting Exporter Options .sp Certain exporters offer a set of options that can further customize the exported data. A full list of options available for each exporter can be obtained by passing the \fB\-\-output\-options ?\fP command\-line option. .sp Options may be specified as a comma\-separated list. Some options act as simple flags, other options can take an argument with the \fBoption=value\fP syntax. .sp Known exporter options are documented below: .SS json .INDENT 0.0 .TP .B with\-io\-log: Exported data will include the input/output log associated with each job result. The data is included in its native three\-tuple form unless one of the \fIsquash\-io\-log\fP or \fIflatten\-io\-log\fP options are used as well. .sp IO logs are representations of the data produced by the process created from the shell command associated with some jobs. .TP .B squash\-io\-log: When used together with \fIwith\-io\-log\fP option it causes Plainbox to discard the stream name and time\-stamp and just include a list of base64\-encoded binary strings. This option is more useful for reconstructing simple "log files" .TP .B flatten\-io\-log: When used together with \fIwith\-io\-log\fP option it causes Plainbox to concatenate all of the separate base64\-encoded records into one large base64\-encoded binary string representing the whole communication that took place. .TP .B with\-run\-list: Exported data will include the run list (sequence of jobs computed from the desired job list). .TP .B with\-job\-list: Exported data will include the full list of jobs known to the system .TP .B with\-resource\-map: Exported data will include the full resource map. Resources are records of key\-value sets that are associated with each job result for jobs that have plugin type \fIresource\fP\&. They are expected to be printed to \fIstdout\fP by such \fIresource jobs\fP and are parsed and stored by Plainbox. .TP .B with\-job\-defs: Exported data will include some of the properties of each job definition. Currently this set includes the following fields: \fIplugin\fP, \fIrequires\fP, \fIdepends\fP, \fIcommand\fP and \fIdescription\fP\&. .TP .B with\-attachments: Exported data will include attachments. Attachments are created from \fIstdout\fP stream of each job having plugin type \fIattachment\fP\&. The actual attachments are base64\-encoded. .TP .B with\-comments: Exported data will include comments added by the test operator to each job result that has them. .TP .B with\-job\-via: Exported data will include the \fBvia\fP attribute alongside each job result. The via attribute contains the checksum of the job definition that generated a particular job definition. This is useful for tracking jobs generated by jobs with the plugin type \fIlocal\fP\&. .TP .B with\-job\-hash: Exported data will include the \fBhash\fP attribute alongside each job result. The hash attribute is the checksum of the job definition\(aqs data. It can be useful alongside with \fIwith\-job\-via\fP\&. .TP .B machine\-json: The generated JSON document will be minimal (devoid of any optional whitespace). This option is best to be used if the result is not intended to be read by humans as it saves some space. .UNINDENT .SS rfc822 .sp All of the options have the same meaning as for the \fIjson\fP exporter: \fIwith\-io\-log\fP, \fIsquash\-io\-log\fP, \fIflatten\-io\-log\fP, \fIwith\-run\-list\fP, \fIwith\-job\-list\fP, \fIwith\-resource\-map\fP, \fIwith\-job\-defs\fP, \fIwith\-attachments\fP, \fIwith\-comments\fP, \fIwith\-job\-via\fP, \fIwith\-job\-hash\fP\&. The only exception is the \fImachine\-json\fP option which doesn\(aqt exist for this exporter. .SS text .sp Same as with rfc822. .SS xlsx .INDENT 0.0 .TP .B with\-sys\-info: Exported spreadsheet will include a worksheet detailing the hardware devices based on lspci, lsusb, udev, etc. .TP .B with\-summary: Exported spreadsheet will include test figures. This includes the percentage of tests that have passed, have failed, have been skipped and the total count. .TP .B with\-job\-description: Exported spreadsheet will include job descriptions on a separate sheet .TP .B with\-text\-attachments: Exported spreadsheet will include text attachments on a separate sheet .UNINDENT .SS xml .INDENT 0.0 .TP .B client\-name: This option allows clients to override the name of the application generating the XML document. By default that name is \fIplainbox\fP\&. To use this option pass \fB\-\-output\-options client\-name=other\-name\fP command\-line option. .UNINDENT .SS TRANSPORTING RESULTS .sp Exported results can be either saved to a file (this is the most basic, default transport) or can be handed to one of the transport systems for further processing. The idea is that specialized users can provide their own transport systems (often coupled with a specific exporter) to move the test results from the system\-under\-test to a central testing result repository. .sp Transport can be selected with the \fB\-\-transport\fP option. Again, as with exporters, a list of known transports can be obtained by passing the \fB\-\-transport ?\fP option. Transports need a destination URL which can be specified with the \fB\-\-transport\-where=\fP option. The syntax of the URL varies by transport type. .sp Plainbox comes equipped with the following transports: .SS launchpad .sp This transport can send the results exported using \fBxml\fP exporter to the Launchpad Hardware Database. This is a little\-known feature offered by the \fI\%https://launchpad.net/\fP website. .SS certification .sp This transport can send the results exported using the \fBxml\fP exporter to the Canonical Certification Website (\fI\%https://certification.canonical.com\fP). .sp This transport is of little use to anyone but the Canonical Hardware Certification Team that also maintains Plainbox and Checkbox but it is mentioned here for completeness. .SH OPTIONS .sp \fBOptional arguments:\fP .PP .INDENT 0.0 .TP .B \-\-non\-interactive skip tests that require interactivity .TP .B \-n\fP,\fB \-\-dry\-run don\(aqt really run most jobs .TP .B \-\-dont\-suppress\-output don\(aqt suppress the output of certain job plugin types .TP .B \-f\fP,\fB \-\-output\-format save test results in the specified FORMAT (pass ? for a list of choices) .TP .B \-p\fP,\fB \-\-output\-options comma\-separated list of options for the export mechanism (pass ? for a list of choices) .TP .B \-o\fP,\fB \-\-output\-file save test results to the specified FILE (or to stdout if FILE is \-) .TP .B \-t\fP,\fB \-\-transport use TRANSPORT to send results somewhere (pass ? for a list of choices) .sp Possible choices: ? .TP .B \-\-transport\-where where to send data using the selected transport .TP .B \-\-transport\-options comma\-separated list of key\-value options (k=v) to be passed to the transport .TP .B \-T\fP,\fB \-\-test\-plan load the specified test plan .TP .B \-i\fP,\fB \-\-include\-pattern include jobs matching the given regular expression .TP .B \-x\fP,\fB \-\-exclude\-pattern exclude jobs matching the given regular expression .TP .B \-w\fP,\fB \-\-whitelist load whitelist containing run patterns .UNINDENT .SH SEE ALSO .sp \fBplainbox\-dev\-analyze\fP .SH AUTHOR Zygmunt Krynicki & Checkbox Contributors .SH COPYRIGHT 2012-2014 Canonical Ltd .\" Generated by docutils manpage writer. .