<commit_before>.. _kernel-testing-page:

**************
Kernel testing
**************

Introduction
============

The LISA kernel tests are mostly meant for regression testing, or for supporting
new submissions to LKML. The existing infrastructure can also be used to hack up
workloads that would allow you to poke specific areas of the kernel.

Tests do not **have** to target Arm platforms nor the task scheduler. The only
real requirement is to be able to abstract your target through
:mod:`devlib`, and from there you are free to implement tests as you see fit.

They are commonly split into two steps:
  1) Collect some data by doing work on the target
  2) Post-process the collected data

In our case, the data usually consists of
`Ftrace <https://www.kernel.org/doc/Documentation/trace/ftrace.txt>`_ traces
that we then parse into :class:`pandas.DataFrame`.

.. seealso:: :ref:`analysis-page`

Available tests
===============

The following tests are available. They can be used as:

  * direct execution using ``lisa-test`` command (``LISA shell``) and ``exekall``
    (see :ref:`automated-testing-page`)
  * the individual classes/methods they are composed of can be used in custom
    scripts/jupyter notebooks (see ipynb/tests/synthetics_example.ipynb)

.. run-command::
  :capture-stderr:

  exekall run lisa.tests --rst-list --inject-empty-target-conf

Running tests
=============

From the CLI
++++++++++++

The shortest path to executing a test from a shell is:

1. Update the ``target_conf.yml`` file located at the root of the repository
   with the credentials to connect to the development board (see
   :class:`~lisa.target.TargetConf` keys for more information)
2. Run the following:
<commit_msg>doc: Avoid warnings while emitting test list<commit_after>.. _kernel-testing-page:

**************
Kernel testing
**************

Introduction
============

The LISA kernel tests are mostly meant for regression testing, or for supporting
new submissions to LKML. The existing infrastructure can also be used to hack up
workloads that would allow you to poke specific areas of the kernel.

Tests do not **have** to target Arm platforms nor the task scheduler. The only
real requirement is to be able to abstract your target through
:mod:`devlib`, and from there you are free to implement tests as you see fit.

They are commonly split into two steps:
  1) Collect some data by doing work on the target
  2) Post-process the collected data

In our case, the data usually consists of
`Ftrace <https://www.kernel.org/doc/Documentation/trace/ftrace.txt>`_ traces
that we then parse into :class:`pandas.DataFrame`.

.. seealso:: :ref:`analysis-page`

Available tests
===============

The following tests are available. They can be used as:

  * direct execution using ``lisa-test`` command (``LISA shell``) and ``exekall``
    (see :ref:`automated-testing-page`)
  * the individual classes/methods they are composed of can be used in custom
    scripts/jupyter notebooks (see ipynb/tests/synthetics_example.ipynb)

.. run-command::
  :capture-stderr:

  # Disable warnings to avoid dependencies to break the reStructuredText output
  export PYTHONWARNINGS="ignore"
  exekall run lisa.tests --rst-list --inject-empty-target-conf

Running tests
=============

From the CLI
++++++++++++

The shortest path to executing a test from a shell is:

1. Update the ``target_conf.yml`` file located at the root of the repository
   with the credentials to connect to the development board (see
   :class:`~lisa.target.TargetConf` keys for more information)
2. Run the following:

{'fraction_non_alphanumeric': 0.11592178770949721, 'fraction_numerical': 0.0022346368715083797, 'mean_word_length': 4.409365558912387, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4782578', 'n_tokens_mistral': 996, 'n_tokens_neox': 966, 'n_words': 452}