avocado.rst 25.6 KB
Newer Older
C
Cleber Rosa 已提交
1 2 3 4 5 6 7 8
:title: avocado
:subtitle: test runner command line tool
:title_upper: AVOCADO
:manual_section: 1

SYNOPSIS
========

9
 avocado [-h] [-v] [--config CONFIG_FILE]
10
 {run,list,sysinfo,multiplex,plugins,datadir} ...
C
Cleber Rosa 已提交
11 12 13 14

DESCRIPTION
===========

15
Avocado is a modern test framework that is built on the experience
C
Cleber Rosa 已提交
16 17
accumulated with `autotest` (`http://autotest.github.io`).

18 19 20 21 22
`avocado` is also the name of its test runner command line tool, described in
this man page.

For more information about the Avocado project, please check its website:
http://avocado-framework.github.io/
C
Cleber Rosa 已提交
23 24 25 26

OPTIONS
=======

27 28 29
The following list of options are builtin, application level `avocado`
options. Most other options are implemented via plugins and will depend
on them being loaded::
C
Cleber Rosa 已提交
30

31
 -h, --help             show this help message and exit
C
Cleber Rosa 已提交
32
 -v, --version          show program's version number and exit
33
 --config CONFIG_FILE   Use custom configuration from a file
C
Cleber Rosa 已提交
34

35 36 37
Real use of avocado depends on running avocado subcommands. This a typical list
of avocado subcommands::

38
 run         Run one or more tests (native test, test alias, binary or script)
39 40
 list        List available test modules
 sysinfo     Collect system information
41
 multiplex   Generate a list of dictionaries with params from multiplex file(s)
42
 plugins     List all plugins loaded
43
 distro      Shows detected Linux distribution
44 45
 datadir     List all relevant directories used by avocado

46
To get usage instructions for a given subcommand, run it with `--help`. Example::
47 48

 $ avocado multiplex --help
49 50 51
 usage: avocado multiplex [-h] [--filter-only [FILTER_ONLY [FILTER_ONLY ...]]]
                          [--filter-out [FILTER_OUT [FILTER_OUT ...]]] [-t]
                          [-c]
52
                          multiplex_files [multiplex_files ...]
53 54

 positional arguments:
55
   multiplex_files       Path(s) to a multiplex file(s)
56 57

 optional arguments:
58 59 60 61 62 63 64
   -h, --help            show this help message and exit
   --filter-only [FILTER_ONLY [FILTER_ONLY ...]]
                         Filter only path(s) from multiplexing
   --filter-out [FILTER_OUT [FILTER_OUT ...]]
                         Filter out path(s) from multiplexing
   -t, --tree            Shows the multiplex tree structure
   -c, --contents        Shows the variant's content (variables)
65 66


C
Cleber Rosa 已提交
67 68 69 70 71 72 73 74 75 76 77 78 79 80
RUNNING A TEST
==============

The most common use of the `avocado` command line tool is to run a test::

 $ avocado run sleeptest

This command will run the `sleeptest` test, as found on the standard test
directories. The output should be similar to::

 JOB ID    : <id>
 JOB LOG   : /home/<user>/avocado/job-results/job-<date>-<shortid>/job.log
 TESTS     : 1
 (1/1) sleeptest.py: PASS (1.00 s)
81
 RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0
82
 TESTS TIME : 1.00 s
C
Cleber Rosa 已提交
83 84 85 86 87

The test directories will vary depending on you system and
installation method used. Still, it's pretty easy to find that out as shown
in the next section.

88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
DEBUGGING TESTS
===============

When you are developing new tests, frequently you want to look at the straight
output of the job log in the stdout, without having to tail the job log.
In order to do that, you can use --show-job-log to the avocado test runner::

    $ scripts/avocado run examples/tests/sleeptest.py --show-job-log
    Not logging /proc/slabinfo (lack of permissions)
    START examples/tests/sleeptest.py

    Test instance parameters:
        id = examples/tests/sleeptest.py

    Default parameters:
        sleep_length = 1.0

    Test instance params override defaults whenever available

    Sleeping for 1.00 seconds
    Not logging /var/log/messages (lack of permissions)
    PASS examples/tests/sleeptest.py

    Not logging /proc/slabinfo (lack of permissions)

113 114
Let's say you are debugging a test particularly large, with lots of debug
output and you want to reduce this output to only messages with level 'INFO'
115
and higher. You can set job-log-level to info to reduce the amount of output.
116

117 118 119 120 121 122 123 124
Edit your `~/.config/avocado/avocado.conf` file and add::

    [job.output]
    loglevel = info

Running the same example with this option will give you::

    $ scripts/avocado run sleeptest --show-job-log
125 126 127 128 129 130 131 132
    START sleeptest.py
    PASS sleeptest.py

The levels you can choose are the levels available in the python logging system
`https://docs.python.org/2/library/logging.html#logging-levels`, translated
to lowercase strings, so 'notset', 'debug', 'info', 'warning', 'error',
'critical', in order of severity.

133 134 135
As you can see, the UI output is suppressed and only the job log goes to
stdout, making this a useful feature for test development/debugging.

136 137 138 139 140 141 142 143
SILENCING RUNNER STDOUT
=======================

You may specify --silent, that means avocado will turn off all runner
stdout. Even if you specify things like --show-job-log in the CLI, --silent
will have precedence and you will not get application stdout. Note that --silent
does not affect on disk job logs, those continue to be generated normally.

144 145 146 147 148
SILENCING SYSINFO REPORT
========================

You may specify --sysinfo=off and avocado will not collect profilers,
hardware details and other system information, inside the job result directory.
149

C
Cleber Rosa 已提交
150 151 152 153
LISTING TESTS
=============

The `avocado` command line tool also has a `list` command, that lists the
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
known tests in a given path, be it a path to an individual test, or a path
to a directory. If no arguments provided, avocado will inspect the contents
of the test location being used by avocado (if you are in doubt about which
one is that, you may use `avocado config --datadir`). The output looks like::

    $ avocado list
    INSTRUMENTED /usr/share/avocado/tests/abort.py
    INSTRUMENTED /usr/share/avocado/tests/datadir.py
    INSTRUMENTED /usr/share/avocado/tests/doublefail.py
    INSTRUMENTED /usr/share/avocado/tests/doublefree.py
    INSTRUMENTED /usr/share/avocado/tests/errortest.py
    INSTRUMENTED /usr/share/avocado/tests/failtest.py
    INSTRUMENTED /usr/share/avocado/tests/fiotest.py
    INSTRUMENTED /usr/share/avocado/tests/gdbtest.py
    INSTRUMENTED /usr/share/avocado/tests/gendata.py
    INSTRUMENTED /usr/share/avocado/tests/linuxbuild.py
    INSTRUMENTED /usr/share/avocado/tests/multiplextest.py
    INSTRUMENTED /usr/share/avocado/tests/passtest.py
    INSTRUMENTED /usr/share/avocado/tests/skiptest.py
    INSTRUMENTED /usr/share/avocado/tests/sleeptenmin.py
    INSTRUMENTED /usr/share/avocado/tests/sleeptest.py
    INSTRUMENTED /usr/share/avocado/tests/synctest.py
    INSTRUMENTED /usr/share/avocado/tests/timeouttest.py
    INSTRUMENTED /usr/share/avocado/tests/trinity.py
    INSTRUMENTED /usr/share/avocado/tests/warntest.py
    INSTRUMENTED /usr/share/avocado/tests/whiteboard.py

Here, `INSTRUMENTED` means that the files there are python files with an avocado
test class in them, therefore, that they are what we call instrumented tests.
This means those tests can use all avocado APIs and facilities. Let's try to
list a directory with a bunch of executable shell scripts::

    $ avocado list examples/wrappers/
    SIMPLE examples/wrappers/dummy.sh
    SIMPLE examples/wrappers/ltrace.sh
    SIMPLE examples/wrappers/perf.sh
    SIMPLE examples/wrappers/strace.sh
    SIMPLE examples/wrappers/time.sh
    SIMPLE examples/wrappers/valgrind.sh

Here, `SIMPLE` means that those files are executables, that avocado will simply
execute and return PASS or FAIL depending on their return codes (PASS -> 0,
FAIL -> any integer different than 0). You can also provide the `--verbose`,
or `-V` flag to display files that were detected but are not avocado tests,
along with summary information::

    $ avocado list examples/gdb-prerun-scripts/ -V
    Type       file
    NOT_A_TEST examples/gdb-prerun-scripts/README
    NOT_A_TEST examples/gdb-prerun-scripts/pass-sigusr1

    SIMPLE: 0
    INSTRUMENTED: 0
    MISSING: 0
    NOT_A_TEST: 2

That summarizes the basic commands you should be using more frequently when
you start with avocado. Let's talk now about how avocado stores test results.
C
Cleber Rosa 已提交
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248

EXPLORING RESULTS
=================

When `avocado` runs tests, it saves all its results on your system::

 JOB ID    : <id>
 JOB LOG   : /home/<user>/avocado/job-results/job-<date>-<shortid>/job.log

For your convenience, `avocado` maintains a link to the latest job run
(an `avocado run` command in this context), so you can always use `"latest"`
to browse your test results::

 $ ls /home/<user>/avocado/job-results/latest
 id
 job.log
 results.json
 results.xml
 sysinfo
 test-results

The main log file is `job.log`, but every test has its own results directory::

 $ ls -1 ~/avocado/job-results/latest/test-results/
 sleeptest.py

Since this is a directory, it should have content similar to::

 $ ls -1 ~/avocado/job-results/latest/test-results/sleeptest.py/
 data
 debug.log
 sysinfo

MULTIPLEX
=========

Avocado has a powerful tool that enables multiple test scenarios to be run
249 250 251
using a single, unmodified test. This mechanism uses a YAML file called the
'multiplex file', that tells avocado how to multiply all possible test scenarios
automatically.
C
Cleber Rosa 已提交
252 253 254 255 256

A command by the same name, `multiplex`, is available on the `avocado`
command line tool, and enables you to see all the test scenarios that can
be run::

257
 $ avocado multiplex -c examples/tests/sleeptest.py.data/sleeptest.yaml
258
 Variants generated:
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278

 Variant 1:    /run/short
     /run/short:sleep_length => 0.5

 Variant 2:    /run/medium
     /run/medium:sleep_length => 1

 Variant 3:    /run/long
     /run/long:sleep_length => 5

 Variant 4:    /run/longest
     /run/longest:sleep_length => 10

This is a sample that varies the parameter `sleep_length` through the scenarios
``/run/short`` (sleeps for 0.5 s), ``/run/medium`` (sleeps for 1 s),
``/run/long`` (sleeps for 5s), ``/run/longest`` (sleeps for 10s). The YAML
file (multiplex file) that produced the output above is::

 !mux
 short:
279
     sleep_length: 0.5
280
 medium:
281
     sleep_length: 1
282
 long:
283
     sleep_length: 5
284
 longest:
285
     sleep_length: 10
C
Cleber Rosa 已提交
286

287 288
You can execute `sleeptest` in all variations exposed above with:

289
 $ avocado run sleeptest --multiplex examples/tests/sleeptest.py.data/sleeptest.yaml
C
Cleber Rosa 已提交
290 291 292

And the output should look like::

293 294 295 296 297 298 299 300 301 302 303 304 305
 JOB ID     : <id>
 JOB LOG    : /home/<user>/avocado/job-results/job-<date-<shortid>/job.log
 TESTS      : 4
 (1/4) sleeptest.py: PASS (0.50 s)
 (2/4) sleeptest.py.1: PASS (1.00 s)
 (3/4) sleeptest.py.2: PASS (5.01 s)
 (4/4) sleeptest.py.3: PASS (10.01 s)
 PASS       : 4
 ERROR      : 0
 FAIL       : 0
 SKIP       : 0
 WARN       : 0
 INTERRUPT  : 0
306
 TESTS TIME : 16.52 s
307 308 309 310 311 312

The `multiplex` plugin and the test runner supports two kinds of global
filters, through the command line options `--filter-only` and `--filter-out`.
The `filter-only` exclusively includes one or more paths and
the `filter-out` removes one or more paths from being processed.

313 314
From the previous example, if we are interested to use the variants `/run/medium`
and `/run/longest`, we do the following command line::
315

316
 $ avocado run sleeptest --multiplex examples/tests/sleeptest.py.data/sleeptest.yaml \
317
       --filter-only /run/medium /run/longest
318 319 320 321

And if you want to remove `/small` from the variants created,
we do the following::

322
 $ avocado run sleeptest --multiplex examples/tests/sleeptest.py.data/sleeptest.yaml \
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
       --filter-out /run/medium

Note that both `--filter-only` and `--filter-out` filters can be arranged in
the same command line.

The multiplexer also supports default paths. The base path is ``/run/*`` but it
can be overridden by ``--mux-path``, which accepts multiple arguments. What it
does: it splits leaves by the provided paths. Each query goes one by one through
those sub-trees and first one to hit the match returns the result. It might not
solve all problems, but it can help to combine existing YAML files with your
ones::

    qa:         # large and complex read-only file, content injected into /qa
        tests:
            timeout: 10
        ...
    my_variants: !mux        # your YAML file injected into /my_variants
        short:
            timeout: 1
        long:
            timeout: 1000

You want to use an existing test which uses ``params.get('timeout', '*')``.  Then you
can use ``--mux-path '/my_variants/*' '/qa/*'`` and it'll first look in your
variants. If no matches are found, then it would proceed to ``/qa/*``

Keep in mind that only slices defined in mux-path are taken into account for
relative paths (the ones starting with ``*``).
C
Cleber Rosa 已提交
351

352 353
DEBUGGING EXECUTABLES RUN AS PART OF A TEST
===========================================
354 355

One interesting avocado feature is the ability to automatically and
356
transparently run executables that are used on a given test inside the
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
GNU debugger.

Suppose you are running a test that uses an external, compiled, image
converter. Now suppose you're feeding it with different types of images,
including broken image files, and it fails at a given point. You wish
you could connect to the debugger at that given source location while
your test is running. This is how to do just that with avocado::

 $ avocado run --gdb-run-bin=convert:convert_ppm_to_raw converttest

The job starts running just as usual, and so does your test::

 JOB ID    : <id>
 JOB LOG   : /home/<user>/avocado/job-results/job-<date>-<shortid>/job.log
 TESTS     : 1
 (1/1) converttest.py: /

374
The `convert` executable though, automatically runs inside GDB. Avocado will
375 376 377 378 379 380 381 382 383 384 385
stop when the given breakpoint is reached::

 TEST PAUSED because of debugger breakpoint. To DEBUG your application run:
 /home/<user>/avocado/job-results/job-<date>-<shortid>/test-results/converttest.py/data/convert.gdb.sh

 NOTE: please use *disconnect* command in gdb before exiting, or else the debugged process will be KILLED

From this point, you can run the generated script (`convert.gdb.sh`) to
debug you application.

As noted, it is strongly recommended that you *disconnect* from gdb while
386
your executable is still running. That is, if the executable finished running
387 388 389 390 391
while you are debugging it, avocado has no way to know about its status.

Avocado will automatically send a `continue` command to the debugger
when you disconnect from and exit gdb.

392 393
If, for some reason you have a custom GDB, or your system does not put
GDB on what avocado believes to be the standard location (`/usr/bin/gdb`),
394
you can override that in the section `gdb.paths` of your documentation::
395

396 397 398
    [gdb.paths]
    gdb = /usr/bin/gdb
    gdbserver = /usr/bin/gdbserver
399

400 401
So running avocado after setting those will use the appropriate gdb/gdbserver
path.
402

403
If you are debugging a special application and need to setup GDB in custom
404 405 406 407 408 409 410 411 412 413 414
ways by running GDB commands, you can do that with the `--gdb-prerun-commands`
option::

 $ avocado run --gdb-run-bin=foo:bar --gdb-prerun-commands=/tmp/disable-signals footest

In this example, `/tmp/disable-signals` is a simple text file containing two lines::

 signal SIGUSR1 pass
 signal SIGUSR1 nostop

Each line is a GDB command, so you can have from simple to very complex
415
debugging environments configured like that.
416

417 418
WRAP EXECUTABLE RUN BY TESTS
============================
419

420 421 422
Avocado allows the instrumentation of executables being run by a test
in a transparent way. The user specifies a script ("the wrapper") to be
used to run the actual program called by the test.
423

424 425 426 427
If the instrumentation script is implemented correctly, it should not
interfere with the test behavior. That is, the wrapper should avoid
changing the return status, standard output and standard error messages
of the original executable.
428

429 430 431
The user can be specific about which program to wrap (with a shell-like glob),
or if that is omitted, a global wrapper that will apply to all
programs called by the test.
432

433 434 435
So, for every executable run by the test, the program name will be
compared to the pattern to decide whether to wrap it or not. You can
have multiples wrappers and patterns defined.
436 437 438 439 440

Examples::

 $ avocado run datadir --wrapper examples/wrappers/strace.sh

441 442 443 444 445 446 447 448
Any command created by the test datadir will be wrapped on ``strace.sh``. ::

 $ avocado run datadir --wrapper examples/wrappers/ltrace.sh:*make \
                       --wrapper examples/wrappers/perf.sh:*datadir

Any command that matches the pattern `*make` will
be wrapper on ``ltrace.sh`` and the pattern ``*datadir`` will trigger
the execution of ``perf.sh``. ::
449

450 451
Note that it is not possible to use ``--gdb-run-bin`` together
with ``--wrapper``, they are incompatible.
452

453 454
RUNNING TESTS WITH AN EXTERNAL RUNNER
=====================================
C
Cleber Rosa 已提交
455 456 457 458 459 460 461 462 463 464 465

It's quite common to have organically grown test suites in most
software projects. These usually include a custom built, very specific
test runner that knows how to find and run their own tests.

Still, running those tests inside Avocado may be a good idea for
various reasons, including being able to have results in different
human and machine readable formats, collecting system information
alongside those tests (the Avocado's `sysinfo` functionality), and
more.

466
Avocado makes that possible by means of its "external runner" feature. The
C
Cleber Rosa 已提交
467 468
most basic way of using it is::

469
    $ avocado run --external-runner=/path/to/external_runner foo bar baz
C
Cleber Rosa 已提交
470 471 472

In this example, Avocado will report individual test results for tests
`foo`, `bar` and `baz`. The actual results will be based on the return
473 474
code of individual executions of `/path/to/external_runner foo`,
`/path/to/external_runner bar` and finally `/path/to/external_runner baz`.
C
Cleber Rosa 已提交
475 476

As another way to explain an show how this feature works, think of the
477
"external runner" as some kind of interpreter and the individual tests as
C
Cleber Rosa 已提交
478
anything that this interpreter recognizes and is able to execute. A
479
UNIX shell, say `/bin/sh` could be considered an external runner, and
C
Cleber Rosa 已提交
480 481 482 483
files with shell code could be considered tests::

    $ echo "exit 0" > /tmp/pass
    $ echo "exit 1" > /tmp/fail
484
    $ avocado run --external-runner=/bin/sh /tmp/pass /tmp/fail
C
Cleber Rosa 已提交
485 486 487 488 489 490
    JOB ID     : 4a2a1d259690cc7b226e33facdde4f628ab30741
    JOB LOG    : /home/<user>/avocado/job-results/job-<date>-<shortid>/job.log
    TESTS      : 2
    (1/2) /tmp/pass: PASS (0.01 s)
    (2/2) /tmp/fail: FAIL (0.01 s)
    RESULTS    : PASS 1 | ERROR 0 | FAIL 1 | SKIP 0 | WARN 0 | INTERRUPT 0
491
    TESTS TIME : 0.01 s
492
    JOB HTML   : /home/<user>/avocado/job-results/job-<date>-<shortid>/html/results.html
C
Cleber Rosa 已提交
493 494 495 496 497 498 499 500

This example is pretty obvious, and could be achieved by giving
`/tmp/pass` and `/tmp/fail` shell "shebangs" (`#!/bin/sh`), making
them executable (`chmod +x /tmp/pass /tmp/fail)`, and running them as
"SIMPLE" tests.

But now consider the following example::

501
    $ avocado run --external-runner=/bin/curl http://local-avocado-server:9405/jobs/ \
C
Cleber Rosa 已提交
502 503 504 505 506 507 508
                                           http://remote-avocado-server:9405/jobs/
    JOB ID     : 56016a1ffffaba02492fdbd5662ac0b958f51e11
    JOB LOG    : /home/<user>/avocado/job-results/job-<date>-<shortid>/job.log
    TESTS      : 2
    (1/2) http://local-avocado-server:9405/jobs/: PASS (0.02 s)
    (2/2) http://remote-avocado-server:9405/jobs/: FAIL (3.02 s)
    RESULTS    : PASS 1 | ERROR 0 | FAIL 1 | SKIP 0 | WARN 0 | INTERRUPT 0
509
    TESTS TIME : 3.04 s
510
    JOB HTML   : /home/<user>/avocado/job-results/job-<date>-<shortid>/html/results.html
C
Cleber Rosa 已提交
511

512
This effectively makes `/bin/curl` an "external test runner", responsible for
C
Cleber Rosa 已提交
513
trying to fetch those URLs, and reporting PASS or FAIL for each of them.
514

515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546
RECORDING TEST REFERENCE OUTPUT
===============================

As a tester, you may want to check if the output of a given application matches
an expected output. In order to help with this common use case, we offer the
option ``--output-check-record [mode]`` to the test runner. If this option is
used, it will store the stdout or stderr of the process (or both, if you
specified ``all``) being executed to reference files: ``stdout.expected`` and
``stderr.expected``.

Those files will be recorded in the test data dir. The data dir is in the same
directory as the test source file, named ``[source_file_name.data]``. Let's
take as an example the test ``synctest.py``. In a fresh checkout of avocado,
you can see::

        examples/tests/synctest.py.data/stderr.expected
        examples/tests/synctest.py.data/stdout.expected

From those 2 files, only stdout.expected is non empty::

    $ cat examples/tests/synctest.py.data/stdout.expected
    PAR : waiting
    PASS : sync interrupted

The output files were originally obtained using the test runner and passing the
option --output-check-record all to the test runner::

    $ avocado run --output-check-record all examples/tests/synctest.py
    JOB ID    : <id>
    JOB LOG   : /home/<user>/avocado/job-results/job-<date>-<shortid>/job.log
    TESTS     : 1
    (1/1) examples/tests/synctest.py: PASS (2.20 s)
547
    RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0
548
    TESTS TIME : 2.20 s
549 550 551 552 553 554

After the reference files are added, the check process is transparent, in the
sense that you do not need to provide special flags to the test runner.
Now, every time the test is executed, after it is done running, it will check
if the outputs are exactly right before considering the test as PASSed. If you
want to override the default behavior and skip output check entirely, you may
555
provide the flag ``--output-check=off`` to the test runner.
556 557 558 559 560 561 562 563

The ``avocado.utils.process`` APIs have a parameter ``allow_output_check``
(defaults to ``all``), so that you can select which process outputs will go to
the reference files, should you chose to record them. You may choose ``all``,
for both stdout and stderr, ``stdout``, for the stdout only, ``stderr``, for
only the stderr only, or ``none``, to allow neither of them to be recorded and
checked.

564
This process works fine also with simple tests, executables that
565 566 567 568 569 570 571 572 573 574 575 576
return 0 (PASSed) or != 0 (FAILed). Let's consider our bogus example::

    $ cat output_record.sh
    #!/bin/bash
    echo "Hello, world!"

Let's record the output (both stdout and stderr) for this one::

    $ avocado run output_record.sh --output-check-record all
    JOB ID    : <id>
    JOB LOG   : /home/<user>/avocado/job-results/job-<date>-<shortid>/job.log
    TESTS     : 1
577
    (1/1) home/$USER/Code/avocado/output_record.sh: PASS (0.01 s)
578
    RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0
579
    TESTS TIME : 0.01 s
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596

After this is done, you'll notice that a the test data directory
appeared in the same level of our shell script, containing 2 files::

    $ ls output_record.sh.data/
    stderr.expected  stdout.expected

Let's look what's in each of them::

    $ cat output_record.sh.data/stdout.expected
    Hello, world!
    $ cat output_record.sh.data/stderr.expected
    $

Now, every time this test runs, it'll take into account the expected files that
were recorded, no need to do anything else but run the test.

597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621
RUNNING REMOTE TESTS
====================

Avocado allows you to execute tests on a remote machine by means of a SSH
network connection. The remote machine must be configured to accept remote
connections and the Avocado framework have to be installed in both origin
and remote machines.

When running tests on remote machine, the test sources and its data (if any present)
are transfered to the remote target, just before the test execution.
After the test execution, all test results are transfered back to the origin machine.

Here is how to run the sleeptest example test in a remote machine with IP
address 192.168.0.123 (standard port 22), remote user name `fedora` and
remote user password `123456`::

 $ avocado run --remote-hostname 192.168.0.123 --remote-username fedora --remote-password 123456

The output should look like::

 REMOTE LOGIN  : fedora@192.168.0.123:22
 JOB ID    : <JOBID>
 JOB LOG   : /home/<user>/avocado/job-results/job-<date>-<shortid>/job.log
 TESTS     : 1
 (1/1) sleeptest.py:  PASS (1.01 s)
622
 RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0
623
 TESTS TIME : 1.01 s
624 625 626 627

For more information, please consult the topic Remote Machine Plugin
on Avocado's online documentation.

628 629 630 631 632 633 634 635 636
LINUX DISTRIBUTION UTILITIES
============================

Avocado has some planned features that depend on knowing the Linux Distribution being used on the sytem.
The most basic command prints the detected Linux Distribution::

  $ avocado distro
  Detected distribution: fedora (x86_64) version 21 release 0

637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657
Other features are available with the same command when command line options are given, as shown by the
`--help` option.

For instance, it possible to create a so-called "Linux Distribution Definition" file, by inspecting an installation
tree. The installation tree could be the contents of the official installation ISO or a local network mirror.

These files let Avocado pinpoint if a given installed package is part of the original Linux Distribution or
something else that was installed from an external repository or even manually. This, in turn, can help
detecting regressions in base system pacakges that affected a given test result.

To generate a definition file run::

  $ avocado distro --distro-def-create --distro-def-name avocadix  \
                   --distro-def-version 1 --distro-def-arch x86_64 \
                   --distro-def-type rpm --distro-def-path /mnt/dvd

And the output will be something like::

   Loading distro information from tree... Please wait...
   Distro information saved to "avocadix-1-x86_64.distro"

658

C
Cleber Rosa 已提交
659 660 661 662 663
FILES
=====

::

664
 /etc/avocado/avocado.conf
C
Cleber Rosa 已提交
665 666 667 668 669 670 671
    system wide configuration file

BUGS
====

If you find a bug, please report it over our github page as an issue.

672
LICENSE
L
Lucas Meneghel Rodrigues 已提交
673
=======
674 675 676 677 678 679 680 681

Avocado is released under GPLv2 (explicit version)
`http://gnu.org/licenses/gpl-2.0.html`. Even though most of the current code is
licensed under a "and any later version" clause, some parts are specifically
bound to the version 2 of the license and therefore that's the official license
of the prject itself. For more details, please see the LICENSE file in the
project source code directory.

C
Cleber Rosa 已提交
682 683 684
MORE INFORMATION
================

685 686 687
For more information please check Avocado's project website, located at
`http://avocado-framework.github.io/`. There you'll find links to online
documentation, source code and community resources.
C
Cleber Rosa 已提交
688 689 690 691

AUTHOR
======

692
Avocado Development Team <avocado-devel@redhat.com>