Products › lamco-dbus-tools › Docs
The dbusdo chain: D-Bus commands run in order
The dbusdo chain: How commands that call, start or load a D-Bus bus run in order, with pause, soft and retry, its flags, JSON and JUnit output, and its files.
Describes version 0.4.1. The source of truth is src/chain.rs, and dbusdo help prints the
same from the registry.
dbusdo takes its flags first and then a chain: Commands that run in order, left to right, in one run.
It's the model of rdpdo.
dbusdo [FLAGS] <command> [arguments] [<command> [arguments]]...
Commands in this version
These shape a chain, and need no bus:
| Command | Arguments | What it does |
|---|---|---|
pause |
<seconds>, a number, 0 or more, a fraction allowed |
Waits. The wait counts against the time limit |
session (also repl, interactive) |
None | Reads chains from standard input, one on each line, until exit, quit or the end of input |
run |
<script> |
Runs a script: A file of chains, one on each line |
play |
<recording> [speed] |
Plays a recording back with its timing, at a speed (default 1) |
convert |
<input> <output> |
Writes a recording as a script, or a script as a recording |
help |
Everything after it, to the end of the chain | Every command, or one command or group in full |
These act on a bus, and each is recorded as an act (captures, driver-acts):
| Command | Arguments | What it does |
|---|---|---|
call |
[--repeat <n>] [--interval <seconds>] [--timeout <seconds>] [--no-auto-start] [--max-p99 <ms>] <destination> <path> <interface.member> [<signature> <values>...] |
Calls a method, once or repeated, and gives its answer or the distribution at the caller. Fails on an error or no answer, and with --max-p99 when the 99th percentile at the caller is over that many milliseconds |
emit |
<destination or -> <path> <interface.member> [<signature> <values>...] |
Sends a signal to one connection, or with - to everyone listening |
set |
<destination> <path> <interface.property> <signature> <value> |
Sets a property through Properties.Set |
own |
[--replace] <name> <seconds> |
Takes a name without queueing, holds it, and gives it up. Fails when it wasn't taken |
start |
<name> |
Starts a service by its name, and times it to the bus's answer and to the name having an owner |
replay |
[--speed <factor>] [--service <name>] <capture> |
Sends a recording's calls again and says which ended differently. Fails when any did |
load |
[--size <bytes>] <per-second> <seconds> |
Broadcasts signals at a stated rate and size |
relay |
[--bodies <length,hash,decoded,raw>] [--] <program> [<arguments>...] |
Runs one program behind a recording relay. Takes the rest of the chain, so it's the last link |
sandbox probe |
[--app <id> | --instance <id>] [--no-names] [--stand-in <names>]... [--proxy <path>] [--] [<proxy options>...] |
Asks the host's xdg-dbus-proxy what a grant allows, in front of a private bus of stand-ins, holds every decision to the evaluator, and probes the proxy for its three known flaws. Takes the rest of the chain |
policy probe |
[--base open|system] [--implementation daemon|broker|both] [--probe <probe>]... [--probes <file>] <policy file> |
Gives a policy file to each real daemon on a private bus, sends call and own probes, and holds every answer to the evaluator |
Arguments are given by their signature as busctl call takes them: s hello, u 7, as 2 a b,
a{sv} 1 key s value, v i 3, (si) x 1. A method's interface and member are one word, split at its
last dot. The commands that act on a bus share one connection for the whole chain, opened by the first
of them.
Modifiers
A modifier isn't a command. It changes the next command and no other. Both can be given, in either order.
| Modifier | Arguments | Effect |
|---|---|---|
retry |
<count>, a whole number, at least 1 |
The next command is run up to that many times, the first included, until it succeeds. Half a second passes between attempts |
soft |
None | The next command may fail without ending the chain |
How a chain ends
- Each command runs to its end before the next starts.
- A command that fails ends the chain, and
dbusdoexits 1. A command markedsoftdoesn't. - When the time limit runs out, the chain ends between two commands, or a
pauseis cut short, anddbusdoexits 2. - A chain that can't be read (an unknown command, a missing argument, a modifier with no command after
it) is refused before anything runs, and
dbusdoexits 2.
Flags
Beside the flags every program takes (exit codes and flags):
| Flag | Default | Meaning |
|---|---|---|
--timeout <seconds> |
30 | The time limit for the whole run. 0 is no limit. Time a session spends waiting for a line isn't counted |
--junit <path> |
None | A JUnit report of the chain is written to this file |
--record <path> |
None | The commands of the run, each with the moment it started, are written to this file as a recording |
--bus <session,system> |
session |
The bus the acts go to |
--address <address> |
None | A bus by its address instead, such as unix:path=/run/user/1000/bus |
--out <path> |
None | Every act of the run is written to this file as a capture, with its stamps |
The flags come before the chain. A word after the chain's first command is read as part of the chain.
Output
Each command says what it has to say. A failure is reported on standard error with the command it
belongs to. With --verbose, each command that succeeds is reported with its length.
With --json, one object is printed on standard output when the chain ends:
{
"schema_version": "v1",
"outcome": "ok",
"steps": [
{ "command": "pause 0.1", "at": 0.000012, "outcome": "ok", "attempts": 1, "seconds": 0.100081643 },
{ "command": "help nosuch", "at": 0.100101, "outcome": "failed_allowed", "attempts": 1, "seconds": 0.000063999,
"message": "no help for 'nosuch'" }
]
}
| Member | Values |
|---|---|
outcome of the chain |
ok, failed, timed_out |
outcome of a step |
ok, failed, failed_allowed (it was marked soft), timed_out (the step that was next when the time ran out) |
at |
When the step started, in seconds from the start of the run |
attempts |
How many times the step was run |
seconds |
How long the step took, on the monotonic clock, waits for a person left out |
message |
Present on a step that failed |
The JUnit report
It holds one test case for each step that ran, named by the command as written. A failed step has a failure.
A step that failed and was marked soft has a skipped whose message starts "allowed to fail".
Examples
dbusdo pause 2
dbusdo retry 3 pause 1
dbusdo --timeout 5 --junit report.xml soft pause 1 pause 2
dbusdo session
Files
Two kinds of file hold chains. Both are text.
A script (by convention .dbusdo-script) is written by hand. Each line is a chain. Empty lines and
lines that start with # are passed over. A part in double quotes is one word, and inside quotes a
backslash keeps the next character as it is. {env:NAME} in a word is replaced with that environment
variable; a variable that isn't set is an error.
# setup.dbusdo-script
pause 1
soft retry 3 pause 0.5
A recording (by convention .dbusdo) is what --record writes. Its first line is
# dbusdo recording, version 1, and each line after it is @<seconds> and a command with its
modifiers: The moment the command started, from the start of the run, to the millisecond.
# dbusdo recording, version 1
@0.000 pause 0.2
@0.200 soft retry 2 pause 0.1
run takes either kind and ignores the times. play waits for each line's time, divided by the speed,
or runs the line at once when the line before it ended later than that. A line with no time runs at
once.
convert reads the direction from the two names. A script made from a recording loses the timing. A
recording made from a script has every line at 0, so it plays back with no waits.
A script or a recording can't open a session, another script or another recording. The first line that
fails ends it, and the run or play that ran it fails with the file and the line number.
What a recording holds: The commands on the command line that ran. Commands entered in a session, and the lines of a script that was run, aren't written into the recording of the run that ran them.
Not in this version
--fail-capture isn't in this version. --out is written when the chain ends, whether it succeeded or not, so the capture of a
failed run holds every act up to the one that failed, that one included. A flag of its own for it isn't
built.