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