xref: /linux/Documentation/dev-tools/testing-devices.rst (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1.. SPDX-License-Identifier: GPL-2.0
2.. Copyright (c) 2024 Collabora Ltd
3
4=============================
5Device testing with kselftest
6=============================
7
8
9There are a few different kselftests available for testing devices generically,
10with some overlap in coverage and different requirements. This document aims to
11give an overview of each one.
12
13Note: Paths in this document are relative to the kselftest folder
14(``tools/testing/selftests``).
15
16Device oriented kselftests:
17
18* Devicetree (``dt``)
19
20  * **Coverage**: Probe status for devices described in Devicetree
21  * **Requirements**: None
22
23* Error logs (``devices/error_logs``)
24
25  * **Coverage**: Error (or more critical) log messages presence coming from any
26    device
27  * **Requirements**: None
28
29* Discoverable bus (``devices/probe``)
30
31  * **Coverage**: Presence and probe status of USB or PCI devices that have been
32    described in the reference file
33  * **Requirements**: Manually describe the devices that should be tested in a
34    YAML reference file (see ``devices/probe/boards/google,spherion.yaml`` for
35    an example)
36
37* Exist (``devices/exist``)
38
39  * **Coverage**: Presence of all devices
40  * **Requirements**: Generate the reference (see ``devices/exist/README.rst``
41    for details) on a known-good kernel
42
43Therefore, the suggestion is to enable the error log and devicetree tests on all
44(DT-based) platforms, since they don't have any requirements. Then to greatly
45improve coverage, generate the reference for each platform and enable the exist
46test. The discoverable bus test can be used to verify the probe status of
47specific USB or PCI devices, but is probably not worth it for most cases.
48