Commit 1cb09b55 authored by Jiri Kosina's avatar Jiri Kosina
Browse files

Merge branch 'for-6.8/selftests' into for-linus

- greatly improved coverage of Tablets in hid-selftests (Benjamin Tissoires)
parents f54a651c da2c1b86
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ import logging

from hidtools.device.base_device import BaseDevice, EvdevMatch, SysfsFile
from pathlib import Path
from typing import Final
from typing import Final, List, Tuple

logger = logging.getLogger("hidtools.test.base")

@@ -155,7 +155,7 @@ class BaseTestCase:
        # if any module is not available (not compiled), the test will skip.
        # Each element is a tuple '(kernel driver name, kernel module)',
        # for example ("playstation", "hid-playstation")
        kernel_modules = []
        kernel_modules: List[Tuple[str, str]] = []

        def assertInputEventsIn(self, expected_events, effective_events):
            effective_events = effective_events.copy()
@@ -238,8 +238,7 @@ class BaseTestCase:
            try:
                with HIDTestUdevRule.instance():
                    with new_uhdev as self.uhdev:
                        skip_cond = request.node.get_closest_marker("skip_if_uhdev")
                        if skip_cond:
                        for skip_cond in request.node.iter_markers("skip_if_uhdev"):
                            test, message, *rest = skip_cond.args

                            if test(self.uhdev):
+7 −7
Original line number Diff line number Diff line
@@ -52,13 +52,13 @@ class BaseMouse(base.UHIDTestDevice):
        :param reportID: the numeric report ID for this report, if needed
        """
        if buttons is not None:
            l, r, m = buttons
            if l is not None:
                self.left = l
            if r is not None:
                self.right = r
            if m is not None:
                self.middle = m
            left, right, middle = buttons
            if left is not None:
                self.left = left
            if right is not None:
                self.right = right
            if middle is not None:
                self.middle = middle
        left = self.left
        right = self.right
        middle = self.middle
+528 −236

File changed.

Preview size limit exceeded, changes collapsed.

+3 −3
Original line number Diff line number Diff line
@@ -909,7 +909,7 @@ class TestDTH2452Tablet(test_multitouch.BaseTest.TestMultitouch, TouchTabletTest
        Ensure that the confidence bit being set to false should not result in a touch event.
        """
        uhdev = self.uhdev
        evdev = uhdev.get_evdev()
        _evdev = uhdev.get_evdev()

        t0 = test_multitouch.Touch(1, 50, 100)
        t0.confidence = False
@@ -917,6 +917,6 @@ class TestDTH2452Tablet(test_multitouch.BaseTest.TestMultitouch, TouchTabletTest
        events = uhdev.next_sync_events()
        self.debug_reports(r, uhdev, events)

        slot = self.get_slot(uhdev, t0, 0)
        _slot = self.get_slot(uhdev, t0, 0)

        assert not events
+26 −20
Original line number Diff line number Diff line
@@ -19,12 +19,12 @@ esac
SCRIPT_DIR="$(dirname $(realpath $0))"
OUTPUT_DIR="$SCRIPT_DIR/results"
KCONFIG_REL_PATHS=("${SCRIPT_DIR}/config" "${SCRIPT_DIR}/config.common" "${SCRIPT_DIR}/config.${ARCH}")
B2C_URL="https://gitlab.freedesktop.org/mupuf/boot2container/-/raw/master/vm2c.py"
B2C_URL="https://gitlab.freedesktop.org/gfx-ci/boot2container/-/raw/main/vm2c.py"
NUM_COMPILE_JOBS="$(nproc)"
LOG_FILE_BASE="$(date +"hid_selftests.%Y-%m-%d_%H-%M-%S")"
LOG_FILE="${LOG_FILE_BASE}.log"
EXIT_STATUS_FILE="${LOG_FILE_BASE}.exit_status"
CONTAINER_IMAGE="registry.freedesktop.org/libevdev/hid-tools/fedora/37:2023-02-17.1"
CONTAINER_IMAGE="registry.freedesktop.org/bentiss/hid/fedora/39:2023-11-22.1"

TARGETS="${TARGETS:=$(basename ${SCRIPT_DIR})}"
DEFAULT_COMMAND="pip3 install hid-tools; make -C tools/testing/selftests TARGETS=${TARGETS} run_tests"
@@ -32,7 +32,7 @@ DEFAULT_COMMAND="pip3 install hid-tools; make -C tools/testing/selftests TARGETS
usage()
{
	cat <<EOF
Usage: $0 [-i] [-s] [-d <output_dir>] -- [<command>]
Usage: $0 [-j N] [-s] [-b] [-d <output_dir>] -- [<command>]

<command> is the command you would normally run when you are in
the source kernel direcory. e.g:
@@ -55,6 +55,7 @@ Options:

	-u)		Update the boot2container script to a newer version.
	-d)		Update the output directory (default: ${OUTPUT_DIR})
	-b)		Run only the build steps for the kernel and the selftests
	-j)		Number of jobs for compilation, similar to -j in make
			(default: ${NUM_COMPILE_JOBS})
	-s)		Instead of powering off the VM, start an interactive
@@ -191,8 +192,9 @@ main()
	local command="${DEFAULT_COMMAND}"
	local update_b2c="no"
	local debug_shell="no"
	local build_only="no"

	while getopts ':hsud:j:' opt; do
	while getopts ':hsud:j:b' opt; do
		case ${opt} in
		u)
			update_b2c="yes"
@@ -207,6 +209,9 @@ main()
			command="/bin/sh"
			debug_shell="yes"
			;;
		b)
			build_only="yes"
			;;
		h)
			usage
			exit 0
@@ -226,8 +231,7 @@ main()
	shift $((OPTIND -1))

	# trap 'catch "$?"' EXIT

	if [[ "${debug_shell}" == "no" ]]; then
	if [[ "${build_only}" == "no" && "${debug_shell}" == "no" ]]; then
		if [[ $# -eq 0 ]]; then
			echo "No command specified, will run ${DEFAULT_COMMAND} in the vm"
		else
@@ -267,7 +271,9 @@ main()
	update_kconfig "${kernel_checkout}" "${kconfig_file}"

	recompile_kernel "${kernel_checkout}" "${make_command}"
	update_selftests "${kernel_checkout}" "${make_command}"

	if [[ "${build_only}" == "no" ]]; then
		if [[ "${update_b2c}" == "no" && ! -f "${b2c}" ]]; then
			echo "vm2c script not found in ${b2c}"
			update_b2c="yes"
@@ -278,13 +284,13 @@ main()
			chmod +x $b2c
		fi

	update_selftests "${kernel_checkout}" "${make_command}"
		run_vm "${kernel_checkout}" $b2c "${kernel_bzimage}" "${command}"
		if [[ "${debug_shell}" != "yes" ]]; then
			echo "Logs saved in ${OUTPUT_DIR}/${LOG_FILE}"
		fi

		exit $(cat ${OUTPUT_DIR}/${EXIT_STATUS_FILE})
	fi
}

main "$@"