Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7150674rwr; Tue, 2 May 2023 10:07:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ54jma2HStdGcjhbnrfqWcNlCW7X947/1falr96P61LfvhMPCR2dm98Qs9wY5MMyUFt2Ghb X-Received: by 2002:a05:6a20:a09f:b0:ef:8b50:56b7 with SMTP id r31-20020a056a20a09f00b000ef8b5056b7mr16509775pzj.60.1683047238590; Tue, 02 May 2023 10:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683047238; cv=none; d=google.com; s=arc-20160816; b=B50YqhFROMwNnvAeJ16XP8jEzGC7l0Z+kXNekaFuMxRiEFerMUQSe2ohijtVmaslZ/ o90qXL1P1QFmIwKcvBBRv1Z86PQEVT/+uNqg7xUm6BVIPItehtOIULhxy2ItuiTco1/c SZF/IbgeK9A7coBwDXBJ9sI5gdEhYK02eqeZ67SiOUR+JBVDs9foQtU6l/DiUOxy0qAR X8ByBWAdJteRJDRq5KttjyG9Sq8EC4JVqthhBoqRQHB27nbPFzet/vf9cUSRfnRNjZMm n6JyZmjim7baO8bU/Q8hkErbklL53ka0884BkzsPJLb/op1B/C4nPtPNswN9bRcYHmuA jjCA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Q1g+BA4N5McbyEIryrpzj1O18ZYchVOkwdif6Y10dy0=; b=Y/YOSHTMTZ0nLXBmJ/kmYcyM6AZtXXr4SqDTvQ4rxjYloSrksoH93FIoxYwy7fBeF0 vvWfqxSVvKosd4dHx24KIHxsoPUcvrk/4EFmoase0thcdhKliPOrYJkROr7GdLrKjBn2 e4/T7+5H80BtgUYCGX87jm0A/YtUo1Jo4m5yf1RBXtfKYNQyylv9hv0X4iKZEYqyVgFx VpfeFfWWex8uhEVmc8+nnCWPwDqZrCZTifb+L5MHCZAzLBklpKyDw1tohALtj9Zsxb/b +wKDC0K87f5Ool1VjCqmfnVYNVZXYyyd9cCE2nwojMJYH/rfaAIq+SRZUPxKMTWH5tkN 350A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UFvcJQV7; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s14-20020a17090302ce00b0019955f0dc48si31676886plk.527.2023.05.02.10.07.04; Tue, 02 May 2023 10:07:18 -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=@gmail.com header.s=20221208 header.b=UFvcJQV7; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233614AbjEBRF0 (ORCPT + 99 others); Tue, 2 May 2023 13:05:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233781AbjEBRFW (ORCPT ); Tue, 2 May 2023 13:05:22 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B7E210D9; Tue, 2 May 2023 10:05:21 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1aaf91ae451so23346115ad.1; Tue, 02 May 2023 10:05:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683047121; x=1685639121; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=Q1g+BA4N5McbyEIryrpzj1O18ZYchVOkwdif6Y10dy0=; b=UFvcJQV7gAUEWAXBSUttHC7lywAX8CT3g4Zb+j2Zrxu0VL3wqzP6qebRIv/fjk/YgN uLNPdYZUSyyH2UzHSVZs0bL4IInr8fKfuWBVQNlagkdyG1AUZ9keHAp+tZg7Ys7iPE17 SwEpcRn1X/sPNj3xbOy1gBzOkXGLv+3E6doEmc8OXNip2DXmbG80/IpFhGjRsz98tIwK hVbZOBk2Dc4oDUFfmzXMvEug0tdAo9NFADmwYN22jOZfbBBseggcEMWtBXGVuqLs8QuW t4khzOufQePetEVkqrowqX//GBsyGnMgxBr3261BkfXGqstMkYKcH7l77+rqSzt5+D/K 9gsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683047121; x=1685639121; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Q1g+BA4N5McbyEIryrpzj1O18ZYchVOkwdif6Y10dy0=; b=hDDaoEEQNL+cypE9W3kCv0qjMNTrJztRaxAIMh7uqrBLGR/CopsG1HLukuEMPBRIMv KbBNYChsOthibwCBaFg7sFiFMRGl9nssnLxPjzewWQDVmR3LncfxNgrKad5m4yqfu8NF aBkhXpfN7qR9tnptsO/Yd9TDatwzDBl3csIJV/b9B/EagIeBf4AgomS2+gihGojs7yyy LkeoHZmGsPp8SXCqBvp10xiGpjxP0fZyUKhdcksZNJhsFCFsaE/DvXlT85Csu1Fer2EO lFikF1BFYWazbdNLlbqGuEnN9JU8KjiT/f0zq3FKUVCSPeZT9PEaZ6Tj4QqyGFsuK6kp y5bA== X-Gm-Message-State: AC+VfDyKyD9RH0/DJW9wKf6JVJ5dOlH1SyLrZszQUz8Z8tqRG1mgLc2q J5yAmgprEvjNs/IearHts4WhEZzOB38= X-Received: by 2002:a17:903:2352:b0:1aa:ed6f:29c2 with SMTP id c18-20020a170903235200b001aaed6f29c2mr10855920plh.11.1683047120829; Tue, 02 May 2023 10:05:20 -0700 (PDT) Received: from google.com ([2620:15c:9d:2:6edf:1ae0:55be:72db]) by smtp.gmail.com with ESMTPSA id bb7-20020a17090b008700b0024e0d6b219fsm3138744pjb.42.2023.05.02.10.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 10:05:20 -0700 (PDT) Date: Tue, 2 May 2023 10:05:16 -0700 From: Dmitry Torokhov To: Javier Martinez Canillas Cc: Geert Uytterhoeven , Brendan Higgins , David Gow , linux-input@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/2] Input: tests - miscellaneous fixes Message-ID: References: <878re6y9s8.fsf@minerva.mail-host-address-is-not-set> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <878re6y9s8.fsf@minerva.mail-host-address-is-not-set> X-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FSL_HELO_FAKE, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 02, 2023 at 06:31:51PM +0200, Javier Martinez Canillas wrote: > Geert Uytterhoeven writes: > > Hello Geert, > > > Hi Javier, > > > > On Tue, May 2, 2023 at 12:17 PM Geert Uytterhoeven > > wrote: > >> This patch series fixes a crash in the new input selftest, and makes the > >> test available when the KUnit framework is modular. > >> > >> Unfortunately test 3 still fails for me (tested on Koelsch (R-Car M2-W) > >> and ARAnyM): > >> > >> KTAP version 1 > >> # Subtest: input_core > >> 1..3 > >> input: Test input device as /devices/virtual/input/input1 > >> ok 1 input_test_polling > >> input: Test input device as /devices/virtual/input/input2 > >> ok 2 input_test_timestamp > >> input: Test input device as /devices/virtual/input/input3 > >> # input_test_match_device_id: ASSERTION FAILED at # drivers/input/tests/input_test.c:99 > >> Expected input_match_device_id(input_dev, &id) to be true, but is false > >> not ok 3 input_test_match_device_id > >> # input_core: pass:2 fail:1 skip:0 total:3 > >> # Totals: pass:2 fail:1 skip:0 total:3 > >> not ok 1 input_core > > > > Adding more debug code shows that it's the test on evbit [1] in > > input_match_device_id() that fails. > > Looking at your input_test_match_device_id(), I think you expect > > the checks for the various bitmaps to be gated by > > "if (id->flags & INPUT_DEVICE_ID_MATCH_EVBIT)", like is done for the > > other checks? > > > > [1] https://elixir.bootlin.com/linux/latest/source/drivers/input/input.c#L1021 > > > > That's correct. In input_test_init(), the input dev is marked as capable > of emitting EV_KEY BTN_LEFT and BTN_RIGHT. The goal of that test was to > check this. > > That is, check if matches by the input dev capabilities in which case the > __set_bit(EV_KEY, ...) would make the match true and __set_bit(EV_ABS, ..) > would make the condition false. > > But maybe I misunderstood how the input_set_capability() and __set_bit() > functions work ? > > I'll take a look to this tomorrow, thanks a lot for your report! Unfortunately (?) INPUT_DEVICE_ID_MATCH_*BIT have never had any effect, the kernel always used bitmaps when matching (with the assumption that if one does not care about given bitmap they can simply pass empty one), so I think what we need to change is: diff --git a/drivers/input/tests/input_test.c b/drivers/input/tests/input_test.c index 8b8ac3412a70..0540225f0288 100644 --- a/drivers/input/tests/input_test.c +++ b/drivers/input/tests/input_test.c @@ -87,7 +87,7 @@ static void input_test_timestamp(struct kunit *test) static void input_test_match_device_id(struct kunit *test) { struct input_dev *input_dev = test->priv; - struct input_device_id id; + struct input_device_id id = { 0 }; /* * Must match when the input device bus, vendor, product, version to avoid having garbage in the match data. I suppose we should remove INPUT_DEVICE_ID_MATCH_*BIT from mod_devicetable.h to avoid this confusion. Thanks. -- Dmitry