source: rtems-docs/user/tools/tester.rst

Last change on this file was 8bf866b, checked in by Chris Johns <chrisj@…>, on 04/28/20 at 05:27:11

user/tester: Remove command line help as output

Closes #3381

  • Property mode set to 100644
File size: 20.1 KB
Line 
1.. SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. Copyright (C) 2017 Chris Johns <chrisj@rtems.org>
4
5.. _rtems-tester-command:
6
7RTEMS Tester and Run
8====================
9
10.. index:: Tools, rtems-test, rtems-run
11
12The RTEMS Tester is a test tool that provides a command line interface to run
13test executables on supported targets. The tool provides back end support for
14common simulators, debuggers and boot loaders. Board support package (BSP)
15configurations for RTEMS are provided and can be used to run all the tests in
16the RTEMS test suite. The tool and its framework is not specific to RTEMS and
17can be configured to run any suitable application.
18
19RTEMS is an embedded operating system and is cross-compiled on a range of host
20machines. The executables run on hardware which can vary widely from open
21source simulators, commercial simulators, debuggers with simulators, debuggers
22with hardware specific pods and devices, and targets with boot loaders.
23Testing RTEMS requires that the cross-compiled test executable is transferred
24to the target hardware, executed, the output captured and returned to the test
25host where it is analyzed to determine the test result.
26
27Running the RTEMS tests on your target is very important. It provides you with
28a traceable record showing that your RTEMS version and its tools are working at
29the level the RTEMS development team expect when releasing RTEMS. Being able to
30easily run the tests and verify the results is critical in maintaining high
31standards.
32
33Available BSP testers
34---------------------
35
36You can list the available BSP testers with (not all shown):
37
38.. code-block:: none
39
40    $ rtems-test --list-bsps
41    arm920
42    beagleboardxm
43    beagleboneblack
44    jmr3904-run
45    jmr3904
46    mcf5235
47    pc
48    psim-run
49    psim
50    realview_pbx_a9_qemu
51    sis-run
52    sis
53    xilinx_zynq_a9_qemu
54    xilinx_zynq_a9_qemu_smp
55    xilinx_zynq_zc706
56    xilinx_zynq_zc706_qemu
57    xilinx_zynq_zedboard
58
59.. note:: The list is growing all the time and if your BSP is not supported we
60          encourage you to add it and submit the configuration back to the
61          project.
62
63Some of the BSPs may appear more than once in the list. These are aliased BSP
64configurations that may use different back ends. We will show how to use
65:program:`rtems-test` command with the erc32 BSP because it is easy to build
66and use.
67
68.. _BuildingRTEMSTests:
69
70Building RTEMS Tests
71--------------------
72
73Build the RTEMS Kernel (See :ref:`rtems-kernel`) by cloning the repository,
74running the ``bootstrap`` procedure, building and finally installing the
75kernel. Be sure to enable tests by using ``--enable-tests`` option with
76configure after running ``bootstrap``.
77
78.. code-block:: none
79
80    $ ../../rtems.git/configure --target=sparc-rtems5 \
81                        --enable-tests --enable-rtemsbsp=erc32
82    $ make
83
84Add the `-j` option to the make command with the number of parallel jobs to run a
85parallel build (e.g. `-j 8`).
86
87Building all the tests takes time and it uses more disk so be patient. When
88make finishes, all the tests will have been built.
89
90.. note:: Some BSPs may require a post-build process to be run on the RTEMS ELF
91          executable to create an image suitable for execution. This can be built
92          into the configuration script and the tester will perform a pre-test
93          command to convert the executable to a suitable format for your target.
94
95Before running all the tests it is a good idea to run the ``hello`` test. The
96``hello`` test is an RTEMS version of the classic "Hello World" example and
97running it shows you have a working toolchain and build of RTEMS ready to run
98the tests. Running the example using SIS:
99
100.. code-block:: none
101
102    $ sparc-rtems5-sis sparc-rtems5/c/erc32/testsuites/samples/hello/hello.exe
103    SIS - SPARC/RISCV instruction simulator 2.20,  copyright Jiri Gaisler 2019
104    Bug-reports to jiri@gaisler.se
105    ERC32 emulation enabled
106
107    Loaded sparc-rtems5/c/erc32/testsuites/samples/hello.exe, entry 0x02000000
108
109    sis> run
110
111
112    *** BEGIN OF TEST HELLO WORLD ***
113    *** TEST VERSION: 5.0.0.c6d8589bb00a9d2a5a094c68c90290df1dc44807
114    *** TEST STATE: EXPECTED-PASS
115    *** TEST BUILD: RTEMS_POSIX_API
116    *** TEST TOOLS: 7.5.0 20191114 (RTEMS 5, RSB 83fa79314dd87c0a8c78fd642b2cea3138be8dd6, Newlib 3e24fbf6f)
117    Hello World
118
119    *** END OF TEST HELLO WORLD ***
120
121
122    *** FATAL ***
123    fatal source: 0 (INTERNAL_ERROR_CORE)
124    fatal code: 5 (INTERNAL_ERROR_THREAD_EXITTED)
125    RTEMS version: 5.0.0.c6d8589bb00a9d2a5a094c68c90290df1dc44807
126    RTEMS tools: 7.5.0 20191114 (RTEMS 5, RSB 83fa79314dd87c0a8c78fd642b2cea3138be8dd6, Newlib 3e24fbf6f)
127    executing thread ID: 0x08a010001
128    executing thread name: UI1
129    cpu 0 in error mode (tt = 0x101)
130        116401  02009ae0:  91d02000   ta  0x0
131
132    sis> q
133
134The examples can also be run using GDB with SIS as the back end. SIS can be connected to
135gdb through a network socket using the gdb remote interface.
136
137Either start SIS with ``-gdb``, or issue the ``gdb`` command inside SIS, and connect
138gdb with ``target remote:1234``. The default port is ``1234``, the port can be changed
139using the ``-port`` option.
140
141Open a terminal and issue the following command:
142
143.. code-block:: none
144
145    $ sparc-rtems5-sis -gdb
146    SIS - SPARC/RISCV instruction simulator 2.20,  copyright Jiri Gaisler 2019
147    Bug-reports to jiri@gaisler.se
148    ERC32 emulation enabled
149
150    gdb: listening on port 1234
151
152Now open another terminal and issue the following command:
153
154.. code-block:: none
155
156    $ sparc-rtems5-gdb sparc-rtems5/c/erc32/testsuites/samples/hello/hello.exe
157    GNU gdb (GDB) 8.3
158    Copyright (C) 2019 Free Software Foundation, Inc.
159    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
160    This is free software: you are free to change and redistribute it.
161    There is NO WARRANTY, to the extent permitted by law.
162    Type "show copying" and "show warranty" for details.
163    This GDB was configured as "--host=x86_64-linux-gnu --target=sparc-rtems5".
164    Type "show configuration" for configuration details.
165    For bug reporting instructions, please see:
166    <http://www.gnu.org/software/gdb/bugs/>.
167    Find the GDB manual and other documentation resources online at:
168        <http://www.gnu.org/software/gdb/documentation/>.
169
170    For help, type "help".
171    Type "apropos word" to search for commands related to "word"...
172    Reading symbols from sparc-rtems5/c/erc32/testsuites/samples/hello.exe...
173    (gdb) target remote:1234
174
175The ``target remote:1234`` will tell gdb to connect to the sis simulator. After this
176command the output of the first terminal will change to:
177
178.. code-block:: none
179
180    $ sparc-rtems5-sis -gdb
181    SIS - SPARC/RISCV instruction simulator 2.20,  copyright Jiri Gaisler 2019
182    Bug-reports to jiri@gaisler.se
183    ERC32 emulation enabled
184
185    gdb: listening on port 1234 connected
186
187Before running the executable, it must be loaded, this is done using the
188``load`` command in gdb, and to run it, issue the ``continue`` command.
189
190.. code-block:: none
191
192    $ sparc-rtems5-gdb sparc-rtems5/c/erc32/testsuites/samples/hello/hello.exe
193    GNU gdb (GDB) 8.3
194    Copyright (C) 2019 Free Software Foundation, Inc.
195    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
196    This is free software: you are free to change and redistribute it.
197    There is NO WARRANTY, to the extent permitted by law.
198    Type "show copying" and "show warranty" for details.
199    This GDB was configured as "--host=x86_64-linux-gnu --target=sparc-rtems5".
200    Type "show configuration" for configuration details.
201    For bug reporting instructions, please see:
202    <http://www.gnu.org/software/gdb/bugs/>.
203    Find the GDB manual and other documentation resources online at:
204        <http://www.gnu.org/software/gdb/documentation/>.
205
206    For help, type "help".
207    Type "apropos word" to search for commands related to "word"...
208    Reading symbols from sparc-rtems5/c/erc32/testsuites/samples/hello.exe...
209    (gdb) target remote:1234
210    Remote debugging using :1234
211    0x00000000 in ?? ()
212    (gdb) load
213    Loading section .text, size 0x17170 lma 0x2000000
214    Loading section .rtemsroset, size 0x40 lma 0x2017170
215    Loading section .data, size 0x600 lma 0x20181c0
216    Start address 0x2000000, load size 96176
217    Transfer rate: 4696 KB/sec, 270 bytes/write.
218    (gdb) continue
219    Continuing.
220
221You can see your executable running in the first terminal.
222
223.. code-block:: none
224
225    SIS - SPARC/RISCV instruction simulator 2.20,  copyright Jiri Gaisler 2019
226    Bug-reports to jiri@gaisler.se
227
228    ERC32 emulation enabled
229
230    gdb: listening on port 1235 connected
231    X2000000,0:#40
232
233
234    *** BEGIN OF TEST HELLO WORLD ***
235    *** TEST VERSION: 5.0.0.c6d8589bb00a9d2a5a094c68c90290df1dc44807
236    *** TEST STATE: EXPECTED-PASS
237    *** TEST BUILD: RTEMS_POSIX_API
238    *** TEST TOOLS: 7.5.0 20191114 (RTEMS 5, RSB 83fa79314dd87c0a8c78fd642b2cea3138be8dd6, Newlib 3e24fbf6f)
239    Hello World
240
241    *** END OF TEST HELLO WORLD ***
242
243    ^Csis> q
244
245
246For more information on the sis simulator refer to this doc: https://gaisler.se/sis/sis.pdf
247
248There are currently close to 500 separate tests and you can run them all with a
249single RTEMS Tester command.
250
251Running the Tests
252-----------------
253
254The :program:`rtems-test` command line accepts a range of options. These are
255discussed later in the manual. Command line arguments without a `--` prefix are
256test executables or paths to directories. When using a path to a directory,
257the directories under that path are searched for any file with a ``.exe`` extension.
258This is the default extension for RTEMS executables built within RTEMS. You can
259pass more than one executable on the command line.
260
261To run the erc32 tests enter the following command from the top of the erc32
262BSP build tree:
263
264.. code-block:: none
265
266    $ ~/development/rtems/test/rtems-tools.git/tester/rtems-test \
267             --log=log_erc32_sis \
268             --rtems-bsp=erc32-sis \
269                 sparc-rtems5/c/erc32/testsuites/samples
270    RTEMS Testing - Tester, 5.not_released
271    [ 1/13] p:0  f:0  u:0  e:0  I:0  B:0  t:0  i:0  | sparc/erc32: base_sp.exe
272    [ 2/13] p:0  f:0  u:0  e:0  I:0  B:0  t:0  i:0  | sparc/erc32: capture.exe
273    [ 3/13] p:0  f:0  u:0  e:0  I:0  B:0  t:0  i:0  | sparc/erc32: cdtest.exe
274    [ 4/13] p:0  f:0  u:0  e:0  I:0  B:0  t:0  i:0  | sparc/erc32: fileio.exe
275    [ 5/13] p:2  f:0  u:0  e:0  I:0  B:0  t:0  i:0  | sparc/erc32: hello.exe
276    [ 6/13] p:2  f:0  u:0  e:0  I:0  B:0  t:0  i:0  | sparc/erc32: cxx_iostream.exe
277    [ 8/13] p:2  f:0  u:0  e:0  I:0  B:0  t:2  i:0  | sparc/erc32: minimum.exe
278    [ 7/13] p:2  f:0  u:0  e:0  I:0  B:0  t:2  i:0  | sparc/erc32: loopback.exe
279    [ 9/13] p:3  f:0  u:0  e:0  I:0  B:0  t:3  i:0  | sparc/erc32: nsecs.exe
280    [10/13] p:3  f:0  u:0  e:0  I:0  B:0  t:3  i:0  | sparc/erc32: paranoia.exe
281    [11/13] p:4  f:0  u:0  e:0  I:0  B:0  t:3  i:0  | sparc/erc32: pppd.exe
282    [12/13] p:6  f:0  u:0  e:0  I:0  B:0  t:3  i:0  | sparc/erc32: ticker.exe
283    [13/13] p:6  f:0  u:0  e:0  I:0  B:0  t:3  i:0  | sparc/erc32: unlimited.exe
284    Passed:         7
285    Failed:         0
286    User Input:     0
287    Expected Fail:  0
288    Indeterminate:  0
289    Benchmark:      0
290    Timeout:        5
291    Invalid:        1
292    Total:         13
293    Average test time: 0:00:27.963000
294    Testing time     : 0:06:03.519012
295
296The output has been shortened so it fits nicely here. Following the order of
297appearance above, we have the following:
298
299* The RTEMS Tester's test command. In this example we are using an absolute
300  path.
301* The ``--log`` option sends the output to a log file. By default only failed
302  tests log the complete output.
303* The ``--rtems-bsp`` option selects the erc32 BSP.
304* The path to the erc32 BSP tests to run. If you add subdirectories
305  to the path specific tests can be run.
306* The test results so far. See details below.
307* Overall results of the run. In this run, 13 tests passed, 5 tests timed out
308  and 1 is invalid. The timeouts are probably due to the tests not having enough
309  time to complete. The default timeout is 180 seconds and some of the interrupt
310  tests need more time. The amount of time each test takes depends on the
311  performance of your host CPU when running the simulations.
312* The average time per test and the total time taken to run all the tests.
313
314.. note:: If the path to the testsuites was set to
315  ``sparc-rtems5/c/erc32/testsuites`` instead of
316  ``sparc-rtems5/c/erc32/testsuites/samples`` then all the executables
317  would have been tested and not just those in samples.
318
319.. note:: Some BSPs require the use of the specific target architecture GDB
320          command (e.g. RTEMS 5 SPARC GDB command is ``sparc-rtems5-gdb``).
321          As this command is part of the RTEMS tools, the ``--rtems-tools``
322          option should be added to the ``rtems-test`` command line, e.g.
323          ``--rtems-tools=$HOME/development/rtems/5``.
324          Not every BSP requires this option so you will need to check the
325          specifics of the BSP configuration you are using in order to
326          determine if this option is needed.
327
328An output line is printed for each test that is executed. The :program:`rtems-test`
329command by default runs multiple tests in parallel so you will see a number
330of tests starting quickly and then new tests start as others finish. For example,
331the output shown above is from an 8-core processor. Thus, the first 8 tests
332started in parallel and the status shows the order in which they actually started,
333which is not necessarily sequential, as it happens in the example above where
334test 8 started before test 7.
335
336Each output line shows information about the current status of the tests.
337The status reported in each line is the status when the test starts and not the
338result of that particular test. Thus, a fail, timeout or invalid count changing
339means a test running before this test failed. The overall status in the end
340shows that 7 tests passed, no failures, 5 timeouts and 1 invalid test.
341
342Concerning the output of each line, we have the following:
343
344.. code-block:: none
345
346    [ 5/13] p:2  f:0  u:0  e:0  I:0  B:0  t:0  i:0  | sparc/erc32: hello.exe
347
348* [ 5/13] indicates the test number, in this case test 5 out of 13 tests.
349* ``p`` is the passed test count (2 in this case).
350* ``f`` is the failed test count (0 in this case).
351* ``u`` is the count for test marked as "user-input" (tests that expect input
352    from the user).
353* ``e`` is the expected-fail count (tests that are expected to fail).
354* ``I`` is the count for tests the results of which are indeterminate.
355* ``B`` is the count for benchmarked tests.
356* ``t`` is the timeout test count.
357* ``i`` is the invalid test count.
358* ``sparc/erc32`` is the architecture and BSP names.
359* ``hello.exe`` is the executable name.
360
361The test log records all the tests and results. The logging mode by default
362only provides the output history if a test fails, times out, or is invalid. The
363time taken by each test is also recorded.
364
365The tests must complete in a specified period of time or the test is marked as
366timed out. The default timeout is 3 minutes and can be globally changed using the
367``--timeout`` command line option. The time required to complete a test can
368vary. When simulators are run in parallel, the time taken depends on the resources
369available on the host machine being used. A test per core is the most stable
370method even though more tests can be run than available cores. If your machine
371needs longer or you are using a VM you may need to lengthen the timeout.
372
373Test Status
374-----------
375
376Tests can be marked with one of the following:
377
378* Pass
379* Fail
380* User-input
381* Expected-fail
382* Indeterminate
383* Benchmark
384* Timeout
385* Invalid
386
387The RTEMS console or ``stdout`` output from the test is needed to determine the
388result of the test.
389
390Pass
391^^^^
392A test passes if the start and end markers are seen in the test output. The
393start marker is ``***`` and the end mark is ``*** END OF TEST``. All tests in
394the RTEMS test suite have these markers.
395
396Fail
397^^^^
398A test fails if the start marker is seen and there is no end marker.
399
400User-input
401^^^^^^^^^^
402A test marked as "user-input" as it expects input from user.
403
404Expected-fail
405^^^^^^^^^^^^^
406A test that is expected to fail.
407
408Indeterminate
409^^^^^^^^^^^^^
410A test the results of which are indeterminate.
411
412Benchmark
413^^^^^^^^^
414A benchmarked test.
415
416Timeout
417^^^^^^^
418If the test does not complete within the timeout setting the test is marked as
419having timed out.
420
421Invalid
422^^^^^^^
423If no start marker is seen the test is marked as invalid. If you are testing on
424real target hardware things can sometimes go wrong and the target may not
425initialize or respond to the debugger in an expected way.
426
427Logging
428-------
429
430The following modes of logging are available:
431
432* All (``all``)
433* Failures (``failures``)
434* None (``none``)
435
436This mode is controlled using the command line option ``--log-mode`` using
437the values listed above.
438
439All
440^^^
441The output of all tests is written to the log.
442
443Failures
444^^^^^^^^
445The output of the all tests that do not pass is written to the log.
446
447None
448^^^^
449No output is written to the log.
450
451The output is tagged so you can determine where it comes from. The following is
452the complete output for the In Memory File System test ``imfs_fslink.exe``
453running on a Coldfire MCF5235 using GDB and a BDM pod:
454
455.. code-block:: none
456
457    [ 11/472] p:9   f:0   t:0   i:1   | m68k/mcf5235: imfs_fslink.exe
458    > gdb: ..../bin/m68k-rtems4.11-gdb -i=mi --nx --quiet ..../imfs_fslink.exe
459    > Reading symbols from ..../fstests/imfs_fslink/imfs_fslink.exe...
460    > done.
461    > target remote | m68k-bdm-gdbserver pipe 003-005
462    > Remote debugging using | m68k-bdm-gdbserver pipe 003-005
463    > m68k-bdm: debug module version 0
464    > m68k-bdm: detected MCF5235
465    > m68k-bdm: architecture CF5235 connected to 003-005
466    > m68k-bdm: Coldfire debug module version is 0 (5206(e)/5235/5272/5282)
467    > Process 003-005 created; pid = 0
468    > 0x00006200 in ?? ()
469    > thb *0xffe254c0
470    > Hardware assisted breakpoint 1 at 0xffe254c0
471    > continue
472    > Continuing.
473    ]
474    ]
475    ] External Reset
476    ]
477    ] ColdFire MCF5235 on the BCC
478    ] Firmware v3b.1a.1a (Built on Jul 21 2004 17:31:28)
479    ] Copyright 1995-2004 Freescale Semiconductor, Inc.  All Rights Reserved.
480    ]
481    ] Enter 'help' for help.
482    ]
483    > Temporary breakpoint
484    > 1, 0xffe254c0 in ?? ()
485    > load
486    > Loading section .text, size 0x147e0 lma 0x40000
487    > Loading section .data, size 0x5d0 lma 0x547e0
488    > Start address 0x40414, load size 85424
489    > Transfer rate: 10 KB/sec, 1898 bytes/write.
490    > b bsp_reset
491    > Breakpoint 2 at 0x41274: file ..../shared/bspreset_loop.c, line 14.
492    > continue
493    > Continuing.
494    ] dBUG>
495    ]
496    ] *** FILE SYSTEM TEST ( IMFS ) ***
497    ] Initializing filesystem IMFS
498    ]
499    ]
500    ] *** LINK TEST ***
501    ] link creates hardlinks
502    ] test if the stat is the same
503    ] chmod and chown
504    ] unlink then stat the file
505    ] *** END OF LINK TEST ***
506    ]
507    ]
508    ] Shutting down filesystem IMFS
509    ] *** END OF FILE SYSTEM TEST ( IMFS ) ***
510    > Breakpoint
511    > 2, bsp_reset () at ..../m68k/mcf5235/../../shared/bspreset_loop.c:14
512    > 14    {
513    Result: passed     Time: 0:00:10.045447
514
515* GDB command line (Note: paths with \'....' have been shortened)
516* Lines starting with ``>`` are from GDB's console.
517* Line starting with ``]`` are from the target's console.
518* The result with the test time.
519
520Reporting
521---------
522
523The RTEMS Tester supports output in a machine parsable format. This can be
524enabled using the options ``--report-path`` and ``--report-format``. Currently,
525JSON output is supported using these options like so:
526``--report-path="report" --report-format=json``
527
528This will produce a file ``report.json`` that contains output equivalent to the
529``failure`` logging mode.
530
531Running Tests in Parallel
532-------------------------
533
534The RTEMS Tester supports parallel execution of tests by default. This only
535makes sense if the test back end can run in parallel without resulting in
536resource contention. Simulators are an example of back ends that can run in
537parallel. A hardware debug tool like a BDM or JTAG pod can manage only a
538single test at once so the tests need to be run one at a time.
539
540The test framework manages the test jobs and orders the output in the log
541in test order. Output is held for completed tests until the next test to be
542reported has finished.
543
544Command Line Help
545-----------------
546
547The :program:`rtems-test` command line accepts a range of options. You can
548review the available options by using the ``--help`` option.
Note: See TracBrowser for help on using the repository browser.