xref: /aosp_15_r20/external/ltp/doc/old/User-Guidelines.asciidoc (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard WorkerLTP User Guidelines
2*49cdfc7eSAndroid Build Coastguard Worker===================
3*49cdfc7eSAndroid Build Coastguard Worker
4*49cdfc7eSAndroid Build Coastguard WorkerFor compiling, installing and running the tests see `README.md`.
5*49cdfc7eSAndroid Build Coastguard WorkerFor running LTP network tests see `testcases/network/README.md`.
6*49cdfc7eSAndroid Build Coastguard Worker
7*49cdfc7eSAndroid Build Coastguard Worker1. Library environment variables
8*49cdfc7eSAndroid Build Coastguard Worker--------------------------------
9*49cdfc7eSAndroid Build Coastguard Worker
10*49cdfc7eSAndroid Build Coastguard WorkerFollowing environment variables are expected to be set by LTP users. Therefore,
11*49cdfc7eSAndroid Build Coastguard Workerwith some exceptions, they have 'LTP_' prefix. Environment variables with 'TST_'
12*49cdfc7eSAndroid Build Coastguard Workerprefix are used inside LTP shell API and should *not* be set by users.
13*49cdfc7eSAndroid Build Coastguard Worker
14*49cdfc7eSAndroid Build Coastguard Worker|==============================================================================
15*49cdfc7eSAndroid Build Coastguard Worker| 'KCONFIG_PATH'        | The path to the kernel config file, (if not set, it tries
16*49cdfc7eSAndroid Build Coastguard Worker                          the usual paths '/boot/config-RELEASE' or '/proc/config.gz').
17*49cdfc7eSAndroid Build Coastguard Worker| 'KCONFIG_SKIP_CHECK'  | Skip kernel config check if variable set (not set by default).
18*49cdfc7eSAndroid Build Coastguard Worker| 'LTPROOT'             | Prefix for installed LTP.  **Should be always set**
19*49cdfc7eSAndroid Build Coastguard Worker                          as some tests need it for path to test data files
20*49cdfc7eSAndroid Build Coastguard Worker                          ('LTP_DATAROOT'). LTP is by default installed into '/opt/ltp'.
21*49cdfc7eSAndroid Build Coastguard Worker| 'LTP_COLORIZE_OUTPUT' | By default LTP colorizes it's output unless it's redirected
22*49cdfc7eSAndroid Build Coastguard Worker                          to a pipe or file.  Force colorized output behaviour:
23*49cdfc7eSAndroid Build Coastguard Worker                          'y' or '1': always colorize, 'n' or '0': never colorize.
24*49cdfc7eSAndroid Build Coastguard Worker| 'LTP_DEV'             | Path to the block device to be used
25*49cdfc7eSAndroid Build Coastguard Worker                          (C: '.needs_device = 1', shell: 'TST_NEEDS_DEVICE=1').
26*49cdfc7eSAndroid Build Coastguard Worker| 'LTP_SINGLE_FS_TYPE'  | Testing only - specifies filesystem instead all
27*49cdfc7eSAndroid Build Coastguard Worker                          supported (for tests with '.all_filesystems').
28*49cdfc7eSAndroid Build Coastguard Worker| 'LTP_DEV_FS_TYPE'     | Filesystem used for testing (default: 'ext2').
29*49cdfc7eSAndroid Build Coastguard Worker| 'LTP_TIMEOUT_MUL'     | Multiplies timeout, must be number >= 0.1 (> 1 is useful for
30*49cdfc7eSAndroid Build Coastguard Worker                          slow machines to avoid unexpected timeout).
31*49cdfc7eSAndroid Build Coastguard Worker                          Variable is also used in shell tests, but ceiled to int.
32*49cdfc7eSAndroid Build Coastguard Worker| 'LTP_RUNTIME_MUL'     | Multiplies maximal test iteration runtime. Tests
33*49cdfc7eSAndroid Build Coastguard Worker                          that run for more than a second or two are capped on
34*49cdfc7eSAndroid Build Coastguard Worker                          runtime. You can scale the default runtime both up
35*49cdfc7eSAndroid Build Coastguard Worker                          and down with this multiplier. NOTE: Not yet implemented
36*49cdfc7eSAndroid Build Coastguard Worker                          in shell API.
37*49cdfc7eSAndroid Build Coastguard Worker| 'LTP_VIRT_OVERRIDE'   | Overrides virtual machine detection in the test
38*49cdfc7eSAndroid Build Coastguard Worker                          library. Setting it to empty string tell the library
39*49cdfc7eSAndroid Build Coastguard Worker                          that system is not a virtual machine. Other possible
40*49cdfc7eSAndroid Build Coastguard Worker                          values are 'kvm', 'xen', 'zvm' and 'microsoft' that
41*49cdfc7eSAndroid Build Coastguard Worker                          describe different types supervisors.
42*49cdfc7eSAndroid Build Coastguard Worker| 'PATH'                | It's required to addjust path:
43*49cdfc7eSAndroid Build Coastguard Worker                          `PATH="$PATH:$LTPROOT/testcases/bin"`
44*49cdfc7eSAndroid Build Coastguard Worker| 'TMPDIR'              | Base directory for template directory (C: '.needs_tmpdir = 1'
45*49cdfc7eSAndroid Build Coastguard Worker                          and others, which imply it, shell: 'TST_NEEDS_TMPDIR=1').
46*49cdfc7eSAndroid Build Coastguard Worker                          Must be an absolute path (default: '/tmp').
47*49cdfc7eSAndroid Build Coastguard Worker| 'LTP_NO_CLEANUP'      | Disable running test cleanup (defined in 'TST_CLEANUP').
48*49cdfc7eSAndroid Build Coastguard Worker                          Shell API only.
49*49cdfc7eSAndroid Build Coastguard Worker| 'LTP_ENABLE_DEBUG'    | Enable debug info (value '1' or 'y').
50*49cdfc7eSAndroid Build Coastguard Worker|==============================================================================
51*49cdfc7eSAndroid Build Coastguard Worker
52*49cdfc7eSAndroid Build Coastguard Worker2. Test execution time and timeout
53*49cdfc7eSAndroid Build Coastguard Worker----------------------------------
54*49cdfc7eSAndroid Build Coastguard Worker
55*49cdfc7eSAndroid Build Coastguard WorkerThe limit on how long a test can run does compose of two parts max_runtime and
56*49cdfc7eSAndroid Build Coastguard Workertimeout. The limit does apply to a single test variant, that means for example
57*49cdfc7eSAndroid Build Coastguard Workerthat tests that run for all available filesystems will apply this limit for a
58*49cdfc7eSAndroid Build Coastguard Workersingle filesystem only.
59*49cdfc7eSAndroid Build Coastguard Worker
60*49cdfc7eSAndroid Build Coastguard WorkerThe max_runtime is a cap on how long the run() function can take, for most
61*49cdfc7eSAndroid Build Coastguard Workertestcases this part is set to zero. For tests that do run for more than a
62*49cdfc7eSAndroid Build Coastguard Workersecond or two the max_runtime has to be defined and the run() function has to
63*49cdfc7eSAndroid Build Coastguard Workercheck actively how much runtime is left.
64*49cdfc7eSAndroid Build Coastguard Worker
65*49cdfc7eSAndroid Build Coastguard WorkerTest runtime can be scaled up and down with 'LTP_RUNTIME_MUL' environment
66*49cdfc7eSAndroid Build Coastguard Workervariable or set on a commandline by the '-I' parameter. Hoewever be vary that
67*49cdfc7eSAndroid Build Coastguard Workersetting the runtime too low will cause long running tests to exit prematurely
68*49cdfc7eSAndroid Build Coastguard Workerpossibly before the have a chance actually test anyting.
69*49cdfc7eSAndroid Build Coastguard Worker
70*49cdfc7eSAndroid Build Coastguard WorkerThe timeout part is a limit for the test setup and cleanup and also safety
71*49cdfc7eSAndroid Build Coastguard Workermargin for the runtime accounting. It's currently set to 30 seconds but may
72*49cdfc7eSAndroid Build Coastguard Workerchange later. If your target machine is too slow it can be scaled up with the
73*49cdfc7eSAndroid Build Coastguard Worker'LTP_TIMEOUT_MUL' environment variable.
74