Message ID | 20230411171521.29678-1-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2735134vqo; Tue, 11 Apr 2023 10:20:06 -0700 (PDT) X-Google-Smtp-Source: AKy350bFCLmMaxiMV9BJtJsxVZDB/ontc9O1Msf4Q+OMVTQglfsUQM1Gp2cDyh8SLZ+4XnwJwpdk X-Received: by 2002:a05:6402:758:b0:504:7171:4542 with SMTP id p24-20020a056402075800b0050471714542mr3093249edy.0.1681233606616; Tue, 11 Apr 2023 10:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681233606; cv=none; d=google.com; s=arc-20160816; b=doal++HQbwUjdo+2Lbl4PFx5zhQJWPS5S0RMMPV2huRt4pECgv9MfG/X+qeXcCxkQt hH7Hgj0nQnHp965Yu2qj0jlu8/nKOiZnYbBNRaxSqiZ3XG+n53sfE+ODyG3EhRDLOIfi BR3i/kDHhLJYbA64Vj8dyF7Y+xYeRftt5x7Lg4ieaFpWI+VgMJQ6G45rNjvAsgwfvk+i GUFi20/EtgWkCZK3f46CjOza5aJy0Z0LXYE6JS9TbM3+D/+FkOFQsdjdagaRyNPKgUFJ n7sGZp32IU7MXrYBRpV7jcqbdVwcx98k37OBne7V3dVXIsXAKvLUBW6eUw07FlkXShF0 x3vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=yPnf6LXI5dPykBQsmJi1yl/mMCSQUuuIkFmbNtNdfhY=; b=PZy/OSbwbqLXBmG5cxZvyFTveS2KqBSDG+Xr5B1Vd5FacgbofU+ULEFSPylZ+IGavK d54oNmywsiz+uxw9PlBpIE2tLD9taTLV6LA4eUME08UkS0EXqSYga7aq9BmPKA9GIPTZ WhWeUSVlMod3uCUD+s7xejo2JzyImLvt/l2k5HyLeSkZfTvkBYFxX4TVTWfnYy+F4Wc0 5RHHG+I/hyBH+uEMt7d4VNEshlZQNMyL0n5Ti9rRMBxUc/kkqaumqkf7neMS++i69Xbk ESagfM7bY64gXkQzXpBHuA/8Kmsb9ag9R2phmZNNLbFnyHVXW8c4VAPbF4ikEOOyAuFn H7Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YiTihbpZ; 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=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020aa7d907000000b004cebb5c1590si12333394edr.446.2023.04.11.10.19.42; Tue, 11 Apr 2023 10:20:06 -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=@intel.com header.s=Intel header.b=YiTihbpZ; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230014AbjDKRPk (ORCPT <rfc822;leviz.kernel.dev@gmail.com> + 99 others); Tue, 11 Apr 2023 13:15:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbjDKRPi (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 11 Apr 2023 13:15:38 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0F4B5BA0; Tue, 11 Apr 2023 10:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681233330; x=1712769330; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=l77rwRkmmaeKf8oCWhGD/yj1q+/ZZYlFQ+ZgKZ60owc=; b=YiTihbpZc/YfJWIudoEx6Ib8fCRULyyjKJ4Rt8bIUhEcu/IpB4gPij6a mSNnIUC6MV+LkfMOXKqBOJaRW8MU6pcxDX8gIXXeu4xHFeKpYepJC3Tg4 gpAiG3B9wSBUcvf2sVCK0G1f3Kle2uUVJg1FI0sRoWYHY2gG56oyFOpVH 1708YHElLb2x8WJkB/R5eR92Q9mS59gq18mj4/h5cTotcHVA1Gqun6ywZ KArNoOcq4oeSAXu38w+tdyc03m1hdcbVDGk4mMJ9hzpQD+FxPsCGp2yZR hlQgfsXi9oEV2/vw34zStgYIwDw88q8m2EIOseWowRVluKNU4t4LhXIr7 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10677"; a="346354122" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="346354122" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2023 10:15:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10677"; a="638904505" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="638904505" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 11 Apr 2023 10:15:26 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id B7195438; Tue, 11 Apr 2023 20:15:29 +0300 (EEST) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: linux-gpio@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bamvor Jian Zhang <bamv2005@gmail.com>, Shuah Khan <shuah@kernel.org>, Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <brgl@bgdev.pl>, Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>, Andy Shevchenko <andriy.shevchenko@linux.intel.com> Subject: [PATCH v1 1/2] selftests: gpio: gpio-sim: Fix BUG: test FAILED due to recent change Date: Tue, 11 Apr 2023 20:15:20 +0300 Message-Id: <20230411171521.29678-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762901210165317523?= X-GMAIL-MSGID: =?utf-8?q?1762901210165317523?= |
Series |
[v1,1/2] selftests: gpio: gpio-sim: Fix BUG: test FAILED due to recent change
|
|
Commit Message
Andy Shevchenko
April 11, 2023, 5:15 p.m. UTC
From: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> According to Mirsad the gpio-sim.sh test appears to FAIL in a wrong way due to missing initialisation of shell variables: 4.2. Bias settings work correctly cat: /sys/devices/platform/gpio-sim.0/gpiochip18/sim_gpio0/value: No such file or directory ./gpio-sim.sh: line 393: test: =: unary operator expected bias setting does not work GPIO gpio-sim test FAIL After this change the test passed: 4.2. Bias settings work correctly GPIO gpio-sim test PASS His testing environment is AlmaLinux 8.7 on Lenovo desktop box with the latest Linux kernel based on v6.2: Linux 6.2.0-mglru-kmlk-andy-09238-gd2980d8d8265 x86_64 Suggested-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- tools/testing/selftests/gpio/gpio-sim.sh | 3 +++ 1 file changed, 3 insertions(+)
Comments
On Tue, Apr 11, 2023 at 08:15:20PM +0300, Andy Shevchenko wrote:
> From: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
Ah, Mirsad, I need your SoB, if you are okay with the change.
Otherwise I have to drop your authorship.
On 11. 04. 2023. 19:47, Andy Shevchenko wrote: > On Tue, Apr 11, 2023 at 08:15:20PM +0300, Andy Shevchenko wrote: >> From: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> > > Ah, Mirsad, I need your SoB, if you are okay with the change. > Otherwise I have to drop your authorship Hi, Andy, Sorry I needed to vent my beer before doing this test: [root@pc-mtodorov linux_torvalds]# uname -rms Linux 6.2.0-mglru-kmlk-andy-09238-gd2980d8d8265 x86_64 [root@pc-mtodorov linux_torvalds]# tools/testing/selftests/gpio/gpio-sim.sh 1. chip_name and dev_name attributes 1.1. Chip name is communicated to user 1.2. chip_name returns 'none' if the chip is still pending 1.3. Device name is communicated to user 2. Creating and configuring simulated chips 2.1. Default number of lines is 1 2.2. Number of lines can be specified 2.3. Label can be set 2.4. Label can be left empty 2.5. Line names can be configured 2.6. Line config can remain unused if offset is greater than number of lines 2.7. Line configfs directory names are sanitized 2.8. Multiple chips can be created 2.9. Can't modify settings when chip is live 2.10. Can't create line items when chip is live 2.11. Probe errors are propagated to user-space 2.12. Cannot enable a chip without any GPIO banks 2.13. Duplicate chip labels are not allowed 2.14. Lines can be hogged 3. Controlling simulated chips 3.1. Pull can be set over sysfs 3.2. Pull can be read from sysfs 3.3. Incorrect input in sysfs is rejected 3.4. Can't write to value 4. Simulated GPIO chips are functional 4.1. Values can be read from sysfs 4.2. Bias settings work correctly cat: /sys/devices/platform/gpio-sim.0/gpiochip18/sim_gpio0/value: No such file or directory tools/testing/selftests/gpio/gpio-sim.sh: line 393: test: =: unary operator expected bias setting does not work GPIO gpio-sim test FAIL [root@pc-mtodorov linux_torvalds]# git apply ../gpio-sim-andy2.patch [root@pc-mtodorov linux_torvalds]# tools/testing/selftests/gpio/gpio-sim.sh 1. chip_name and dev_name attributes 1.1. Chip name is communicated to user 1.2. chip_name returns 'none' if the chip is still pending 1.3. Device name is communicated to user 2. Creating and configuring simulated chips 2.1. Default number of lines is 1 2.2. Number of lines can be specified 2.3. Label can be set 2.4. Label can be left empty 2.5. Line names can be configured 2.6. Line config can remain unused if offset is greater than number of lines 2.7. Line configfs directory names are sanitized 2.8. Multiple chips can be created 2.9. Can't modify settings when chip is live 2.10. Can't create line items when chip is live 2.11. Probe errors are propagated to user-space 2.12. Cannot enable a chip without any GPIO banks 2.13. Duplicate chip labels are not allowed 2.14. Lines can be hogged 3. Controlling simulated chips 3.1. Pull can be set over sysfs 3.2. Pull can be read from sysfs 3.3. Incorrect input in sysfs is rejected 3.4. Can't write to value 4. Simulated GPIO chips are functional 4.1. Values can be read from sysfs 4.2. Bias settings work correctly GPIO gpio-sim test PASS [root@pc-mtodorov linux_torvalds]# So the issue was reproduced again on the above mentioned kernel, and the patch fixes it. I will never trust an unexecuted line again, so help me the Lord Above. Yes, you have both: Tested-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr> Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr> Thank you for considering my bug report. It is great to assist your professional team. This issue wasn't triggered by the 6.1.15 mglru kernel, and I am wondering what could be the difference? (With the same gpio-sim.sh and patch.) Best regards, Mirsad
On Tue, Apr 11, 2023 at 7:15 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > From: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> > > According to Mirsad the gpio-sim.sh test appears to FAIL in a wrong way > due to missing initialisation of shell variables: > > 4.2. Bias settings work correctly > cat: /sys/devices/platform/gpio-sim.0/gpiochip18/sim_gpio0/value: No such file or directory > ./gpio-sim.sh: line 393: test: =: unary operator expected > bias setting does not work > GPIO gpio-sim test FAIL > > After this change the test passed: > > 4.2. Bias settings work correctly > GPIO gpio-sim test PASS > > His testing environment is AlmaLinux 8.7 on Lenovo desktop box with > the latest Linux kernel based on v6.2: > > Linux 6.2.0-mglru-kmlk-andy-09238-gd2980d8d8265 x86_64 > > Suggested-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > tools/testing/selftests/gpio/gpio-sim.sh | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/tools/testing/selftests/gpio/gpio-sim.sh b/tools/testing/selftests/gpio/gpio-sim.sh > index 9f539d454ee4..fa2ce2b9dd5f 100755 > --- a/tools/testing/selftests/gpio/gpio-sim.sh > +++ b/tools/testing/selftests/gpio/gpio-sim.sh > @@ -389,6 +389,9 @@ create_chip chip > create_bank chip bank > set_num_lines chip bank 8 > enable_chip chip > +DEVNAME=`configfs_dev_name chip` > +CHIPNAME=`configfs_chip_name chip bank` > +SYSFS_PATH="/sys/devices/platform/$DEVNAME/$CHIPNAME/sim_gpio0/value" > $BASE_DIR/gpio-mockup-cdev -b pull-up /dev/`configfs_chip_name chip bank` 0 > test `cat $SYSFS_PATH` = "1" || fail "bias setting does not work" > remove_chip chip > -- > 2.40.0.1.gaa8946217a0b > Queued for fixes. Thanks! Bart
diff --git a/tools/testing/selftests/gpio/gpio-sim.sh b/tools/testing/selftests/gpio/gpio-sim.sh index 9f539d454ee4..fa2ce2b9dd5f 100755 --- a/tools/testing/selftests/gpio/gpio-sim.sh +++ b/tools/testing/selftests/gpio/gpio-sim.sh @@ -389,6 +389,9 @@ create_chip chip create_bank chip bank set_num_lines chip bank 8 enable_chip chip +DEVNAME=`configfs_dev_name chip` +CHIPNAME=`configfs_chip_name chip bank` +SYSFS_PATH="/sys/devices/platform/$DEVNAME/$CHIPNAME/sim_gpio0/value" $BASE_DIR/gpio-mockup-cdev -b pull-up /dev/`configfs_chip_name chip bank` 0 test `cat $SYSFS_PATH` = "1" || fail "bias setting does not work" remove_chip chip