2024-06-13 15:17:10

by Nícolas F. R. A. Prado

[permalink] [raw]
Subject: [PATCH 0/2] kselftest: devices: Allow running test on more platforms

This series adds two new features required to be able to run the test on
more platforms on KernelCI.

The first patch adds a parameter to allow overriding the directory in
which the board files will be looked for. Since the board files are
hosted in a separate repository [1], this parameter allows overlaying
those files on the filesystem and passing the location to the test.

The second is needed for one platform in particular, MT8195, in which
the usb controllers are instanced from a two-level deep DT node that
doesn't allow unique matching based on the existing properties.

[1] https://github.com/kernelci/platform-test-parameters

Signed-off-by: Nícolas F. R. A. Prado <[email protected]>
---
Nícolas F. R. A. Prado (2):
kselftest: devices: Allow specifying boards directory through parameter
kselftest: devices: Add of-fullname-regex property

.../selftests/devices/boards/google,spherion.yaml | 4 +++
.../selftests/devices/test_discoverable_devices.py | 37 +++++++++++++++++++++-
2 files changed, 40 insertions(+), 1 deletion(-)
---
base-commit: d97496ca23a2d4ee80b7302849404859d9058bcd
change-id: 20240612-kselftest-discoverable-probe-mt8195-kci-ca21742776d0

Best regards,
--
Nícolas F. R. A. Prado <[email protected]>



2024-06-13 15:17:25

by Nícolas F. R. A. Prado

[permalink] [raw]
Subject: [PATCH 1/2] kselftest: devices: Allow specifying boards directory through parameter

Add support for a --boards-dir parameter through which the directory in
which the board files will be searched for can be specified. The
'boards' subdirectory is still used as default when the parameter is not
specified.

This allows more easily running the test with board files supplied by an
external repository like
https://github.com/kernelci/platform-test-parameters.

Signed-off-by: Nícolas F. R. A. Prado <[email protected]>
---
.../testing/selftests/devices/test_discoverable_devices.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/devices/test_discoverable_devices.py b/tools/testing/selftests/devices/test_discoverable_devices.py
index fbae8deb593d..19f28ea774f4 100755
--- a/tools/testing/selftests/devices/test_discoverable_devices.py
+++ b/tools/testing/selftests/devices/test_discoverable_devices.py
@@ -14,6 +14,7 @@
# the description and examples of the file structure and vocabulary.
#

+import argparse
import glob
import ksft
import os
@@ -296,14 +297,24 @@ def run_test(yaml_file):
parse_device_tree_node(device_tree)


+parser = argparse.ArgumentParser()
+parser.add_argument(
+ "--boards-dir", default="boards", help="Directory containing the board YAML files"
+)
+args = parser.parse_args()
+
find_pci_controller_dirs()
find_usb_controller_dirs()

ksft.print_header()

+if not os.path.exists(args.boards_dir):
+ ksft.print_msg(f"Boards directory '{args.boards_dir}' doesn't exist")
+ ksft.exit_fail()
+
board_file = ""
for board_filename in get_board_filenames():
- full_board_filename = os.path.join("boards", board_filename + ".yaml")
+ full_board_filename = os.path.join(args.boards_dir, board_filename + ".yaml")

if os.path.exists(full_board_filename):
board_file = full_board_filename

--
2.45.0