net/{stress,virt}: Migrate virt_lib.sh, ipsec_lib.sh + tests using them

It was needed to migrate it all in once, as macsec0{1,2}.sh tests are
using both libraries.

This includes:
* Create setup, getopts and helper function for both libraries.
* Using TST_TEST_DATA and TST_TEST_DATA_IFS in many test cases
(simplify tests and allow to have more TST_CNT to keep readability of
output + required by udp_ipsec.sh and udp_ipsec_vti.sh otherwise it'd
need to use getopts to determine type of udp, as passing parameter to
tst_run is not not recommended to new API).
* Put code into TST_TESTFUNC functions.
* Move anything based on TST_IPV6 to TST_SETUP setup functions (as
TST_IPV6 is not set until setup)

Other changes:
* udp_ipsec{,_vti}.sh: were calling do_test() twice, with parameter.
Now they use correctly TST_CNT and no parameters.
Order of running tests changed. Before first were run udp tests for all
items in $IPSEC_SIZE_ARRAY, then all udp_lite tests. Now for each item
in $IPSEC_SIZE_ARRAY both udp and udp_lite tests are run.
* gre01.sh: Move back device type setting (changed in 57738337a
"network/gre01: fix device type setting").

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Alexey Kodanev <alexey.kodanev@oracle.com>
25 files changed
tree: cb404b08f3183fb38ac627e8600125069b5a93dc
  1. doc/
  2. include/
  3. lib/
  4. m4/
  5. pan/
  6. runtest/
  7. scenario_groups/
  8. scripts/
  9. testcases/
  10. testscripts/
  11. tools/
  12. utils/
  13. .gitignore
  14. .gitmodules
  15. .travis.packages_i386
  16. .travis.packages_native
  17. .travis.yml
  18. build.sh
  19. configure.ac
  20. COPYING
  21. execltp.in
  22. IDcheck.sh
  23. INSTALL
  24. ltpmenu
  25. Makefile
  26. Makefile.release
  27. README.kernel_config
  28. README.md
  29. runltp
  30. runltplite.sh
  31. TODO
  32. ver_linux
  33. VERSION
README.md

Linux Test Project

Linux Test Project is a joint project started by SGI, OSDL and Bull developed and maintained by IBM, Cisco, Fujitsu, SUSE, Red Hat, Oracle and others. The project goal is to deliver tests to the open source community that validate the reliability, robustness, and stability of Linux.

The LTP testsuite contains a collection of tools for testing the Linux kernel and related features. Our goal is to improve the Linux kernel and system libraries by bringing test automation to the testing effort. Interested open source contributors are encouraged to join.

Project pages are located at: http://linux-test-project.github.io/

The latest image is always available at: https://github.com/linux-test-project/ltp/releases

The discussion about the project happens at ltp mailing list: http://lists.linux.it/listinfo/ltp

The git repository is located at GitHub at: https://github.com/linux-test-project/ltp

Warning!

Be careful with these tests!

Don't run them on production systems. Growfiles, doio, and iogen in particular stress the I/O capabilities of systems and while they should not cause problems on properly functioning systems, they are intended to find (or cause) problems.

Quick guide to running the tests

If you have git, autoconf, automake, m4, the linux headers and the common developer packages installed, the chances are the following will work.

$ git clone https://github.com/linux-test-project/ltp.git
$ cd ltp
$ make autotools
$ ./configure

Now you can continue either with compiling and running a single test or with compiling and installing the whole testsuite.

Shortcut to running a single test

If you need to execute a single test you actually does not need to compile whole LTP, if you want to run a syscall testcase following should work.

$ cd testcases/kernel/syscalls/foo
$ make
$ PATH=$PATH:$PWD ./foo01

Shell testcases are a bit more complicated since these need a path to a shell library as well as to compiled binary helpers, but generally following should work.

$ cd testcases/lib
$ make
$ cd ../commands/foo
$ PATH=$PATH:$PWD:$PWD/../../lib/ ./foo01.sh

Open Posix Testsuite has it's own build system which needs Makefiles to be generated first, then compilation should work in subdirectories as well.

$ cd testcases/open_posix_testsuite/
$ make generate-makefiles
$ cd conformance/interfaces/foo
$ make
$ ./foo_1-1.run-test

Compiling and installing all testcases

$ make
$ make install

This will install LTP to /opt/ltp.

  • If you have a problem see doc/mini-howto-building-ltp-from-git.txt.
  • If you still have a problem see INSTALL and ./configure --help.
  • Failing that, ask for help on the mailing list or Github.

Some tests will be disabled if the configure script can not find their build dependencies.

  • If a test returns TCONF due to a missing component, check the ./configure output.
  • If a tests fails due to a missing user or group, see the Quick Start section of INSTALL.

To run all the test suites

$ cd /opt/ltp
$ ./runltp

Note that many test cases have to be executed as root.

To run a particular test suite

$ ./runltp -f syscalls

To run all tests with madvise in the name

$ ./runltp -f syscalls -s madvise

Also see

$ ./runltp --help

Test suites (e.g. syscalls) are defined in the runtest directory. Each file contains a list of test cases in a simple format, see doc/ltp-run-files.txt.

Each test case has its own executable or script, these can be executed directly

$ testcases/bin/abort01

Some have arguments

$ testcases/bin/fork13 -i 37

The vast majority of test cases accept the -h (help) switch

$ testcases/bin/ioctl01 -h

Many require certain environment variables to be set

$ LTPROOT=/opt/ltp PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/wc01.sh

Most commonly, the path variable needs to be set and also LTPROOT, but there are a number of other variables, runltp usually sets these for you.

Note that all shell scripts need the PATH to be set. However this is not limited to shell scripts, many C based tests need environment variables as well.

Developers corner

Before you start you should read following documents:

  • doc/test-writing-guidelines.txt
  • doc/build-system-guide.txt

There is also a step-by-step tutorial:

  • doc/c-test-tutorial-simple.txt

If something is not covered there don't hesitate to ask on the LTP mailing list. Also note that these documents are available online at:

https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines https://github.com/linux-test-project/ltp/wiki/BuildSystem https://github.com/linux-test-project/ltp/wiki/C-Test-Case-Tutorial