Skip to content

Commit 336fc28

Browse files
pvts-matPlaidCat
authored andcommitted
kvm exception in the collection's directory organization
1 parent a18784c commit 336fc28

File tree

1 file changed

+61
-9
lines changed

1 file changed

+61
-9
lines changed

kselftests/README.rst

+61-9
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ collections rich in tests, like ``bpf`` with around 45 of them, as well
4545
as containing only a single one, like ``zram`` with ``zram: zram.sh``,
4646
and everything in between.
4747

48-
The *tests* map directly to the files with the same name in the
49-
``tools/testing/selftests/`` subdirectory. For example the
50-
``net:ip_defrag.sh`` is realized by the
51-
``tools/testing/selftests/net/ip_defrag.sh`` script. Every test maps to
52-
an executable file in ``tools/testing/selftests/``, but not every
53-
executable file in ``tools/testing/selftests/`` maps to a test (eg.
54-
``tools/testing/selftests/rcutorture/bin/parse-build.sh``)
55-
5648
The *collections* map directly to the subdirectories in
5749
``tools/testing/selftests/``. For example the ``net`` collection refers
5850
to the ``tools/testing/selftests/net/`` subdir. All collections map to
@@ -74,6 +66,21 @@ doesn't contain "all network-related tests" but rather "all
7466
network-related tests which aren't already contained by some more
7567
specific collections".
7668

69+
The *tests* map directly to the files with the same name in the
70+
``tools/testing/selftests/`` subdirectory. For example the
71+
``net:ip_defrag.sh`` is realized by the
72+
``tools/testing/selftests/net/ip_defrag.sh`` script. Every test maps to
73+
an executable file in ``tools/testing/selftests/``, but not every
74+
executable file in ``tools/testing/selftests/`` maps to a test (eg.
75+
``tools/testing/selftests/rcutorture/bin/parse-build.sh``). The
76+
executable is usually contained directly in its collection's directory,
77+
but **not always** - the tests of the ``kvm`` collection being the
78+
exception, with, for example, ``kvm:userspace_io_test`` having its
79+
binary in ``tools/testing/selftests/kvm/x86_64/userspace_io_test``
80+
instead of ``tools/testing/selftests/kvm/userspace_io_test``. It's not
81+
100% clear whether this is allowed or if it's ``kvm`` breaking the
82+
rules. Probably the latter.
83+
7784
To get the explicit list of all fully qualified test names provided by
7885
the releaes relate to `Printing the list of all available tests`_.
7986

@@ -219,7 +226,9 @@ selftests and cannot be used directly from the source as it's done with
219226
`tools/testing/selftests/kselftest-list.txt`_ file, which must be
220227
created first (see `Printing the list of all available tests`_ and
221228
`Running a specific set of tests`_). Once it's in place this script is
222-
the preferred method to conduct testing.
229+
the preferred method to conduct testing (Note: it's **not** preferred
230+
for running ``kvm`` tests - see a note in {{Printing the list of all
231+
available tests}} for details).
223232

224233
From the technical viewpoint the script serves as a wrapper of
225234
`tools/testing/selftests/kselftest/runner.sh`_, transforming the
@@ -392,6 +401,49 @@ because they weren't compiled. The list is meant to show all the tests
392401
that *may* be run, provided all the prerequisites are met and the tests
393402
were actually built..
394403

404+
Note: This way of printing tests fails for the ``arm64`` collection on
405+
``ciqlts9_2`` (at least) - no ``arm64`` tests will be printed. To
406+
investigate how to work around this.
407+
408+
Note 1: The names of tests emited by the ``kvm`` collection don't take
409+
into account that the corresponding programs are not contained directly
410+
in the collection's directory, but are dir-prefixed with the
411+
architecture. For example the test ``kvm:userspace_io_test`` compiled on
412+
x86_64 has its binary in
413+
``tools/testing/selftests/kvm/x86_64/userspace_io_test``, **not** in
414+
``tools/testing/selftests/kvm/userspace_io_test``. This confuses the
415+
``run_kselftest.sh`` script which, upon invoking like
416+
417+
.. code:: shell
418+
419+
tools/testing/selftests/run_kselftest.sh --test kvm:userspace_io_test
420+
421+
raises the following warning and fails:
422+
423+
::
424+
425+
TAP version 13
426+
1..1
427+
# selftests: kvm: userspace_io_test
428+
# Warning: file userspace_io_test is missing!
429+
not ok 1 selftests: kvm: userspace_io_test
430+
431+
This can be ad-hoc fixed by prefixing the test's name with ``x86_64/``
432+
433+
.. code:: shell
434+
435+
tools/testing/selftests/run_kselftest.sh --test kvm:x86_64/userspace_io_test
436+
437+
::
438+
439+
TAP version 13
440+
1..1
441+
# selftests: kvm: userspace_io_test
442+
ok 1 selftests: kvm: userspace_io_test
443+
444+
(Assuming the resulting name ``kvm:x86_64/userspace_io_test`` was added
445+
to ``tools/testing/selftests/kselftest-list.txt``)
446+
395447
Running a specific set of tests
396448
-------------------------------
397449

0 commit comments

Comments
 (0)