• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. SPDX-License-Identifier: GPL-2.0-or-later
2
3Tests setup
4===========
5
6The internal LTP library provides a set of features that permits to customize
7tests behavior by setting environment variables and using specific tests
8arguments.
9
10Library environment variables
11-----------------------------
12
13Following environment variables are expected to be set by LTP users. Therefore,
14with some exceptions, they have ``LTP_`` prefix. Environment variables with
15``TST_`` prefix are used inside LTP shell API and should **not** be set by
16users.
17
18.. list-table::
19   :header-rows: 1
20
21   * - Variable
22     - Note
23
24   * - KCONFIG_PATH
25     - The path to the kernel config file, (if not set, it tries the usual paths
26       ``/boot/config-RELEASE`` or ``/proc/config.gz``)
27
28   * - KCONFIG_SKIP_CHECK
29     - Skip kernel config check if variable set (not set by default)
30
31   * - LTPROOT
32     - Prefix for installed LTP.  **Should be always set**, since some tests
33       need it to use data files (``LTP_DATAROOT``). LTP is by default installed
34       into ``/opt/ltp``
35
36   * - LTP_COLORIZE_OUTPUT
37     - By default LTP colorizes it's output unless it's redirected to a pipe or
38       file. Force colorized output behavior: ``y`` or ``1``: always colorize,
39       ``n`` or ``0``: never colorize.
40
41   * - LTP_DEV
42     - Path to the block device to be used. C Language: ``.needs_device = 1``.
43       Shell language: ``TST_NEEDS_DEVICE=1``.
44
45   * - LTP_SINGLE_FS_TYPE
46     - Testing only - specifies filesystem instead all supported
47       (for tests with ``.all_filesystems``).
48
49   * - LTP_DEV_FS_TYPE
50     - Filesystem used for testing (default: ``ext2``).
51
52   * - LTP_TIMEOUT_MUL
53     - Multiplies timeout, must be number >= 0.1 (> 1 is useful for slow
54       machines to avoid unexpected timeout).
55
56   * - LTP_RUNTIME_MUL
57     - Multiplies maximal test iteration runtime. Tests that run for more than a
58       second or two are capped on runtime. You can scale the default runtime
59       both up and down with this multiplier. This is not yet implemented in the
60       shell API.
61
62   * - LTP_VIRT_OVERRIDE
63     - Overrides virtual machine detection in the test library. Setting it to
64       empty string, tells the library that system is not a virtual machine.
65       Other possible values are ``kvm``, ``xen``, ``zvm`` and ``microsoft``
66       that describe different types supervisors.
67
68   * - PATH
69     - It's required to adjust path: ``PATH="$PATH:$LTPROOT/testcases/bin"``
70
71   * - TMPDIR
72     - Base directory for template directory (C language: ``.needs_tmpdir = 1``
73       and shell: ``TST_NEEDS_TMPDIR=1``). Must be an absolute path (default:
74       '/tmp').
75
76   * - LTP_NO_CLEANUP
77     - Disable running test cleanup (defined in ``TST_CLEANUP``).
78       Shell API only.
79
80   * - LTP_ENABLE_DEBUG
81     - Enable debug info (value ``1`` or ``y``). Equivalent of ``-D`` parameter.
82
83Environment variables for network tests
84^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
85See :master:`testcases/network/README.md`.
86
87Test execution time and timeout
88-------------------------------
89
90The limit on how long a test can run does compose of two parts: ``runtime``
91and ``timeout``. The limit does apply to a single test variant. That means, for
92example, that tests which run for all available filesystems will apply this
93limit for a single filesystem only.
94
95The ``runtime`` is a cap on how long the ``run()`` function can take and for
96most testcases this part is set to zero. For tests that do run for more than a
97second or two the ``runtime`` has to be defined and the ``run()`` function
98has to check actively how much runtime is left.
99
100Test runtime can be scaled up and down with ``LTP_RUNTIME_MUL`` environment
101variable or set on a command-line by the ``-I`` parameter. However,
102setting the runtime too low will cause long running tests to exit prematurely,
103possibly before having a chance to actually test anything.
104
105The timeout is a limit for test setup and cleanup and it's also a safety
106margin for the runtime accounting. It's currently set to 30 seconds but it may
107change later. If your target machine is too slow, it can be scaled up with the
108``LTP_TIMEOUT_MUL`` environment variable.
109