Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6602531rwd; Mon, 5 Jun 2023 22:21:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6wbJb5MW8HVlfSdHD86dLWVFm5lnESyPi9EQ2KBpJSsJtysHZd6ddJGB3E14DCjJjg8WlX X-Received: by 2002:a05:6a20:1610:b0:10f:708b:bb28 with SMTP id l16-20020a056a20161000b0010f708bbb28mr1568610pzj.7.1686028883068; Mon, 05 Jun 2023 22:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686028883; cv=none; d=google.com; s=arc-20160816; b=N79fbu11DxTx2Uiz9wkd8fJHSQu6vC40Jc05S5FvYGdJ1355fQh6ez4xXOvqO9+yPl ZOxDlPA3bbe04hX6IqB7/FQCODbO2SRwquYkiw4ml1OjT51pQ4QdFPDC15Ihgr8uCQaN 1gKi+sZIYVbrF5pWEw44Now6DURj2RPvSKjYsBwy22OaB6kc7eqCPAFCCRdVtWncDxCN vbPuKNCLu+BQq53CiEzlZTOspQ/zrFNVG6HyJj38NiPlWOkEtYmkaOs7ebN8xFoWQW7J EvRxIajP4GCzVAO47G58T/Q9EUYLL0aSsGeiaecTgPbJNMjtz+NaeQI/gUVJAM2mt2jh q5PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=WP3yKSXu55VaU9s/qiTySC2G3aZBpjBEicEtRyfVroM=; b=Nu3hSRYFRmq3XxrrH0CTm422y39zKwMhlqA6HQJITQUgPGU7EN1EwbbRTs96k2ytlT P2ohSfBzzgs2A38/EbI0ia+O+Sgf4zhEms/5gEPqw0tRpkapjgTshhE7ruRPYpi1IT6F ivCRsIw+2m2wMjxfHTBCl2kAR9bDacQVkT02mHnda1HSh78Yk6D0JxP0tN1EqzNg8fxv 8FrQu5V0/KiBtc2nGVUFQEXgFMCB4fjtfg9z04K31SVdtCugv08qrAtwFouyaXdBKs7N jIaFMKuQGV58MYKm2OdxSj66eNkuInLSE+P723JJgf1j+Po86TbcpLtBy30MuFB9cwut f4yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@who-t.net header.s=fm3 header.b=R2JYD0ZH; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=YLpyzhId; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b21-20020a621b15000000b0064f735aef04si6354043pfb.209.2023.06.05.22.21.11; Mon, 05 Jun 2023 22:21:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@who-t.net header.s=fm3 header.b=R2JYD0ZH; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=YLpyzhId; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234275AbjFFFEo (ORCPT + 99 others); Tue, 6 Jun 2023 01:04:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230516AbjFFFEl (ORCPT ); Tue, 6 Jun 2023 01:04:41 -0400 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 454F6196; Mon, 5 Jun 2023 22:04:40 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 26F2B3200A93; Tue, 6 Jun 2023 01:04:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 06 Jun 2023 01:04:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=who-t.net; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1686027878; x=1686114278; bh=WP 3yKSXu55VaU9s/qiTySC2G3aZBpjBEicEtRyfVroM=; b=R2JYD0ZHbVmfBBIKFN RBlHtlXT3VutVokCtWVUOHhNkBrqk8JufwnmB8D3dpvKOVE2hXg95sXRLPF369am TL/eCHMfsSd53jpz7zbYjZe/uSzPybJMm9u8sTNxf+dT+h3ffWAI/gvEScZfIM+G RGfD8u8kPyQCFhIG4daSBQnyV7ug5a1xVDe/mijGPR6/FCLPGsY3rNmTbhjlDQ1V bRxLeyY/mkCi6L1wREyjLA4PRuNEOKNvvNFf0qioM50T5MlQJcpGinpWUBX1Dbtk Mv9mzWu2oEYTB0hBXpA8dUl/5n45ZdWTBFT7If4s1rq5NDmYmuCMyBIToYfuzQW+ kVQA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1686027878; x=1686114278; bh=WP3yKSXu55VaU 9s/qiTySC2G3aZBpjBEicEtRyfVroM=; b=YLpyzhIdzUf9Gc39Njz/Lnyf4Ezbm MOkqio4XC34ZwDF6AXj1PFUjLZpEhDQSRGdZKOCTr4M6+s2q8engIw3/cdI693aT o+gq08KkEPBi0nm2VnZd8yVUloGzj1m6UD66Iz+WMITerOYuOWe/0OqyYzKiVvee SVoc1hy1Y3vUy4P6r8MjrUcAcffKfJr0lJqyHOK7eFs8IBuKhC5e17QvclCWoxQE jofxPaFrItDZOe/IVm7akvT/LvO7oP3iwqgRREekvtrOxJdGPCKNJmITgn67Hjlb aJXGb1Cf8ci/sLMVgLFRiRKjAM/eEP2ZTpRMBdU9xgKAT2gJUmtmzSZSw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedttddgkeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheprfgvthgv rhcujfhuthhtvghrvghruceophgvthgvrhdrhhhuthhtvghrvghrseifhhhoqdhtrdhnvg htqeenucggtffrrghtthgvrhhnpeekvdekgeehfeejgfdvudffhfevheejffevgfeigfek hfduieefudfgtedugfetgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehpvghtvghrrdhhuhhtthgvrhgvrhesfihhohdqthdrnhgvth X-ME-Proxy: Feedback-ID: i7ce144cd:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 6 Jun 2023 01:04:34 -0400 (EDT) Date: Tue, 6 Jun 2023 15:04:31 +1000 From: Peter Hutterer To: Enric Balletbo i Serra Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Dmitry Torokhov , Javier Martinez Canillas , Dana Elfassy , linux-input@vger.kernel.org, phuttere@redhat.com, Benjamin Tissoires Subject: Re: [PATCH v2] selftests/input: Introduce basic tests for evdev ioctls Message-ID: <20230606050431.GA3789903@quokka> References: <20230530102627.87284-1-eballetbo@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230530102627.87284-1-eballetbo@kernel.org> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 30, 2023 at 12:26:27PM +0200, Enric Balletbo i Serra wrote: > This provides a basic infrastructure for the creation of tests for the evdev > interface. Most of this code is adapted from the libevdev wrapper library. While > most of evdev ioctls are covered and tested using libevdev tests there are some > evdev ioctls that aren't because are not supported (and will not be supported) > by libevdev [1]. So, adding, at least those tests, would make sense. > > The test creates an uinput device (and an evdev device) so you can > call the wanted ioctl from userspace. So, to run those tests you need > to have support for uinput and evdev as well. > > [1] For example, libevdev doesn't support setting EV_REP because it's inherently > racy - one libevdev context to set those values via the ioctl would cause all > other libevdev contexts on the same device to be out of sync. Since we do not > get notifications when the values changed, libevdev's buffered values for EV_REP > will remain whatever they were initially. > > Signed-off-by: Enric Balletbo i Serra thanks, this mostly LGTM but there's still a bug left in the vararg handling. [...] > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "../kselftest_harness.h" > + > +#define TEST_DEVICE_NAME "selftest input device" > + > +struct selftest_uinput { > + int uinput_fd; /** file descriptor to uinput */ > + int evdev_fd; /** file descriptor to evdev */ > + char *name; /** device name */ > + char *syspath; /** /sys path */ > + char *devnode; /** device node */ nitpick: none of name, syspath, devnode are used in the tests and it's likely they'll never need to be so there's no reason to strdup them here. You could change fetch_syspath_and_devnode() to open_devnode() and return the opened fd, meaning you can reduce the code even more. [...] > + > +TEST(eviocgname_get_device_name) > +{ > + struct selftest_uinput *uidev; > + char buf[256]; > + int rc; > + > + rc = selftest_uinput_create_device(&uidev); this one and the others without extra arguments need to be: rc = selftest_uinput_create_device(&uidev, -1); otherwise the vararg loop is going to keep the room warm for no reason. Cheers, Peter