1.. SPDX-License-Identifier: GPL-2.0-or-later 2 3Installation and tests execution 4================================ 5 6Basics requirements to build LTP are the following: 7 8* git 9* autoconf 10* automake 11* make 12* gcc 13* m4 14* pkgconf / pkg-config 15* libc headers 16* linux headers 17 18.. code-block:: console 19 20 $ git clone https://github.com/linux-test-project/ltp.git 21 $ cd ltp 22 $ make autotools 23 $ ./configure 24 25.. note:: 26 27 For optional library dependencies, take a look at the scripts inside :master:`ci/` 28 directory. 29 30Running single tests 31-------------------- 32 33LTP provides the possibility to build and run single tests: 34 35.. code-block:: console 36 37 $ cd testcases/kernel/syscalls/foo 38 $ make 39 $ PATH=$PATH:$PWD ./foo01 40 41Shell testcases are a bit more complicated, since they need to setup ``PATH`` 42as well as to compiled binary helpers: 43 44.. code-block:: console 45 46 $ cd testcases/lib 47 $ make 48 $ cd ../commands/foo 49 $ PATH=$PATH:$PWD:$PWD/../../lib/ ./foo01.sh 50 51Open Posix Testsuite has it's own build system which needs Makefiles to be 52generated first: 53 54.. code-block:: console 55 56 $ cd testcases/open_posix_testsuite/ 57 $ make generate-makefiles 58 $ cd conformance/interfaces/foo 59 $ make 60 $ ./foo_1-1.run-test 61 62Compiling and installing all testcases 63-------------------------------------- 64 65To compile all tests is really simple: 66 67.. code-block:: console 68 69 $ make 70 71 $ # install LTP inside /opt/ltp by default 72 $ make install 73 74.. note:: 75 76 Some tests will be disabled if ``configure`` script won't find the build 77 dependencies. 78 79Running tests 80------------- 81 82To run all the test suites 83 84.. code-block:: console 85 86 $ cd /opt/ltp 87 88 $ # run syscalls testing suite 89 $ ./kirk -f ltp -r syscalls 90 91.. note:: 92 93 Many test cases have to be executed as root. 94 95Test suites (e.g. syscalls) are defined in the ``runtest`` directory. Each file 96contains a list of test cases in a simple format. 97 98Each test case has its own executable or script that can directly executed: 99 100.. code-block:: console 101 102 $ testcases/bin/abort01 103 104 $ # some tests have arguments 105 $ testcases/bin/mesgq_nstest -m none 106 107 $ # vast majority of tests have a help 108 $ testcases/bin/ioctl01 -h 109 110 $ # Many require certain environment variables to be set 111 $ LTPROOT=/opt/ltp PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/wc01.sh 112 113Most commonly, the ``PATH`` variable needs to be set and also ``LTPROOT``, but 114there are a number of other variables which usually ``kirk`` sets for you. 115 116.. note:: 117 118 All shell scripts need the ``PATH`` to be set. However, this is not limited 119 to shell scripts and some C based tests need environment variables as well. 120 They usually raise a configuration error when this is needed. 121 122Network tests 123------------- 124 125Network tests usually require a certain setup that is described in 126:master:`testcases/network/README.md`. 127