Skip to contentSkip to conversation

docs: Add running the tests section

PATCH Superseded Richard Palethorpe 3 participants 5 messages May 25, 2017 – May 26, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 docs: Add running the tests section

The simplest/shortest possible guide to installing from source and running the tests.

---

In the common case, LTP is now easy to install and use. The documentation is also thorough. However I have had feedback from a few developers that they find installing the LTP and running a single test very difficult.

I think the reason for this is that the documentation is too spread out and difficult to navigate. Even while writing this I discovered new things which I have not seen before.

This guide is aimed at the casual LTP user, who just wants to fix some failing test case (usually from syscalls), so their work flow will be:

* Patch Kernel
* Install it in VM
* Install LTP in VM
* Run test to see if it still fails

Users who are just curious will probably just want to run syscalls as well.

I think it is best to have a short end-to-end guide as the first thing people see when coming to the project. Then link off into more detailed documentation for people who fall off the happy path.

 README | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
README +56 -0
index bf0061c41..5c3236783 100644
@@ -30,6 +30,62 @@ 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/the-linux-test-project/ltp.git
+$ cd ltp
+$ make autotools
+$ ./configure
+$ 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 fails 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
+
 Developers corner
 -----------------
 
Signature · 1 line
2.12.2
#1 lore raw

PATCH 2/2 docs: Add description of runtest file format

An informal description of the runtest file contents.

---
 doc/ltp-run-files.txt | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)
doc/ltp-run-files.txt +40 -1
index 36180b97b..f8cc36b9e 100644
@@ -1,4 +1,43 @@
-List of scripts or executables that need to be run for complete LTP execution.
+The runtest files contain a list of test cases to be executed.
+
+File Format
+-----------
+
+Lines starting with a '#' are comments and blank lines are ignored.
+
+Otherwise, lines start with a test name followed by white space, then some
+shell script to be executed. For example
+
+Test Name
+|       Delimiter               Test case argument
+|       |                       |
+v       v                       v
+splice02 seq 1 20000 | splice02 splice02-temp
+         ^             ^                    ^
+         |             |                    |
+         |             Test case executable |
+         -----------Shell script-------------
+
+So the splice02 runtest entry pipes the output of seq into the splice02 test
+executable. Most runtest entries are simpler than this, for example
+
+splice03 splice03
+
+Here the test name and executable have the same name and no arguments have
+been supplied.
+
+Run test files should start with a comment describing the tests they contain,
+e.g.
+
+#DESCRIPTION:Kernel system calls
+
+Note that the LTP has absorbed a number of other projects. Some of these have
+been fully converted to the LTP format, others have runtest files generated
+for them during installation, while some use a shell script to integrate them
+with the other tests.
+
+Test suites
+-----------
 
  - syscalls  (except epoll, see below)
  - fs
Signature · 1 line
2.12.2
#2 lore raw

PATCH 1/2 docs: Add running the tests section

In reply to Richard Palethorpe

Hi!

Quoted 1 line

The simplest/shortest possible guide to installing from source and running the tests.

This is a great addition, thanks for writing it, a few comments below.

Quoted 48 lines

---

In the common case, LTP is now easy to install and use. The documentation is also thorough. However I have had feedback from a few developers that they find installing the LTP and running a single test very difficult.

I think the reason for this is that the documentation is too spread out and difficult to navigate. Even while writing this I discovered new things which I have not seen before.

This guide is aimed at the casual LTP user, who just wants to fix some failing test case (usually from syscalls), so their work flow will be:

* Patch Kernel
* Install it in VM
* Install LTP in VM
* Run test to see if it still fails

Users who are just curious will probably just want to run syscalls as well.

I think it is best to have a short end-to-end guide as the first thing people see when coming to the project. Then link off into more detailed documentation for people who fall off the happy path.

 README | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
README +12 -0
index bf0061c41..5c3236783 100644
@@ -30,6 +30,62 @@ 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/the-linux-test-project/ltp.git
+$ cd ltp
+$ make autotools
+$ ./configure
+$ make

README Don't run them on production systems. Growfiles, doio, and iogen in particular · line 54

Quoted 10 lines
README +10 -0
+$ 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 fails due to a missing component, check the ./configure output.

^
Common case here is that test is skipped these days, i.e. reports TCONF.

Quoted 23 lines
README +23 -0
+- 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

README Don't run them on production systems. Growfiles, doio, and iogen in particular · line 87

Quoted 10 lines
README +10 -0
+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

Quite a lot of the C tests and all shell tests needs at least /opt/ltp/testcases/bin in the $PATH in order to source scripts and/or execute helper binaries. Some tests needs LTPROOT (in order to locate datafiles) as well.

So safest example here is:

LTPROOT=/opt/ltp/ PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/test_name

Also 99% of the test has help that is printed when -h is passed in arguments.

Quoted 9 lines
README +0 -0
 Developers corner
 -----------------
 
Signature · 5 lines
2.12.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Cyril Hrubis
[email protected]
#3 lore raw

PATCH 1/2 docs: Add running the tests section

Quoted 4 lines · Cyril Hrubis

Hi!

Quoted 1 line

The simplest/shortest possible guide to installing from source and running the tests.

This is a great addition, thanks for writing it, a few comments below.

Thanks for cleaning up the LTP ;-)

I also think it would be a good idea to do a step-by-step tutorial on writing a simple test case. Then do another one which extends it to fork a child.

The current guidelines are quite abstract, which is nice as a reference, but I think most people learn quicker with examples as well and maybe it would reduce the amount of review time.

Quoted 30 lines
Quoted 14 lines
README +14 -0
+
+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

README Don't run them on production systems. Growfiles, doio, and iogen in particular · line 87

Quoted 10 lines
README +10 -0
+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

Quite a lot of the C tests and all shell tests needs at least /opt/ltp/testcases/bin in the $PATH in order to source scripts and/or execute helper binaries. Some tests needs LTPROOT (in order to locate datafiles) as well.

Quoted 6 lines

So safest example here is:

LTPROOT=/opt/ltp/ PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/test_name

Also 99% of the test has help that is printed when -h is passed in arguments.

As it happens though abort01 and fork13 don't require anything. So I propose making it a bit longer by adding this:

"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, in the example above, a shell script is given and indeed all shell scripts need the PATH to be set. However this is not limited to shell scripts, many C based tests need these variables as well."

--
Thank you,
Richard.

#4 lore raw

PATCH 1/2 docs: Add running the tests section

Hi!

Quoted 7 lines
Quoted 1 line

This is a great addition, thanks for writing it, a few comments below.

Thanks for cleaning up the LTP ;-)

I also think it would be a good idea to do a step-by-step tutorial on writing a simple test case. Then do another one which extends it to fork a child.

Feel free to write these.

Quoted 3 lines

The current guidelines are quite abstract, which is nice as a reference, but I think most people learn quicker with examples as well and maybe it would reduce the amount of review time.

Fair enough.

Quoted 46 lines
Quoted 30 lines
Quoted 14 lines
README +14 -0
+
+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

README Don't run them on production systems. Growfiles, doio, and iogen in particular · line 87

Quoted 10 lines
README +10 -0
+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

Quite a lot of the C tests and all shell tests needs at least /opt/ltp/testcases/bin in the $PATH in order to source scripts and/or execute helper binaries. Some tests needs LTPROOT (in order to locate datafiles) as well.

Quoted 6 lines

So safest example here is:

LTPROOT=/opt/ltp/ PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/test_name

Also 99% of the test has help that is printed when -h is passed in arguments.

As it happens though abort01 and fork13 don't require anything. So I propose making it a bit longer by adding this:

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

$ testcases/bin/ioctl01 -h

Many require certain environment variables to be set

Quoted 8 lines
$ 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, in the example above, a shell script is given and indeed all shell scripts need the PATH to be set. However this is not limited to shell scripts, many C based tests need these variables as well."

I find the last paragraph hard to parse. Maybe dropping the "and indeed" and starting new sentence with "All shell scripts" would help a bit.

Otherwise this looks good.

Signature · 2 lines
Cyril Hrubis
[email protected]