Message ID | fe030b8e-0573-93de-88ae-38ee48d6c89f@alu.unizg.hr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2560738wrd; Mon, 27 Feb 2023 09:58:47 -0800 (PST) X-Google-Smtp-Source: AK7set+EZDGYuZ9DARUJzFH+k1ac0oB70ExofYRYTLRXYZwZrRYHzO9Qw4MFmD4/Ve7Hz74yYxL/ X-Received: by 2002:a17:903:2441:b0:196:5bac:e319 with SMTP id l1-20020a170903244100b001965bace319mr30359028pls.35.1677520727620; Mon, 27 Feb 2023 09:58:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677520727; cv=none; d=google.com; s=arc-20160816; b=F3UQ8C3X/Oagafu5kGrheveb31ndGmh0BCFtP0XW2LWeGvdngBz3d0RAxubD9ymYUG 3Lsiwp2Z60Bkf6lVjD4UCn9EH0xnE7+c2vchhBiDzGbarAAPC13uDqTgLfxN+3tp5Ikd c+a23pNm/LU6XJTM+iEzwkOwUiP+GknhTVX0cslLHBm8XY5VCo5Dd1cnE+ocjb89gTGk gSzu92uxm6hYG8Xs+pxTaaOmucsKa4M1NuhBChUNnhyKaT5dQNOWa/9m/8OLQR8QkVxP MgHM0H/jUISE31qISdjKwSQmhiC8SxaWCWKw3zuq6WVY7Mp6HRcKIOxH8Yoe1EL4TExc ogHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :dkim-signature:dkim-signature; bh=dg3SnNjMlj8lg59QWHnwaZNrRWsNe3QdSHfCTh7rBzw=; b=B+i5Zdc8/wDLJrvzhbMVy9g0Dwubimfmy6sUaz0akjftN/gFgWqedZNJ774h6B4EFR 2FOKC1+Sa/1fSVx3GjCbXhdNHn0cuGV/mT+3SrYlb0sMHw6+ii8ttVptextxDt0BdRZO ym4+ySp80VpuwVCXel9SjJTWmdxYWics/fesgW98Pm3AjUjlJSImSX4NTMTzAPOR1gEk apZO660PP6W5Qep8dKVPG6QnpsQw/f4XRGj3AaBDLbyaESvVkX79+woWSWbd8906CKc2 +l4j8QHjsipwwsDix+keqKzkW0cUkqsgl7fE65rUH6FraIVwIgaNq6eLpyAscRG2aAaI NDDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=PsaigPuD; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b="rCwgAO6/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z13-20020a655a4d000000b005001391ef6bsi7291801pgs.108.2023.02.27.09.58.34; Mon, 27 Feb 2023 09:58:47 -0800 (PST) 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=fail header.i=@alu.unizg.hr header.s=mail header.b=PsaigPuD; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b="rCwgAO6/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229886AbjB0Rvc (ORCPT <rfc822;wenzhi022@gmail.com> + 99 others); Mon, 27 Feb 2023 12:51:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbjB0Rvb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 27 Feb 2023 12:51:31 -0500 Received: from domac.alu.hr (domac.alu.unizg.hr [161.53.235.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBF9510ABA; Mon, 27 Feb 2023 09:51:28 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by domac.alu.hr (Postfix) with ESMTP id 7428F604E9; Mon, 27 Feb 2023 18:51:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1677520282; bh=YdTE5lDjvSSCYH2seOlusLqO3HeakuTrMpKlRWsfD7U=; h=Date:To:Cc:From:Subject:From; b=PsaigPuDqLpEVTR5iDmXZmLDHZ+pa5Bm8yWi73hCBBxJ84N5SK8UOGCRQ85A27LcO 3IAHHadhCkFpgZFDiwnWKRTedStfiCYKmqVFCTmXBVKPDmHfP3AUVC/RFFxUEapTdp cEZiaMrksCMGrPuouGgGpJzQJ2G+7ZZvqku3HfggONDr6jkLioyBpBm5r0dYDnrN87 uYl3N7uvLp+mZwH+PYbX/dmga1vyUglhTo87kC9+NoeTomxmUAeU2Zqz8QK6vgsl+S 8hd71trlysAulyw41ErQDQfLAY1/FFYjsw7Z1cpOgIZapUYWdRXKoIVd11JRRmnDGD E/pKP09rQBflw== X-Virus-Scanned: Debian amavisd-new at domac.alu.hr Received: from domac.alu.hr ([127.0.0.1]) by localhost (domac.alu.hr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7lCOyHGiZN8z; Mon, 27 Feb 2023 18:51:15 +0100 (CET) Received: from [193.198.186.200] (pc-mtodorov.slava.alu.hr [193.198.186.200]) by domac.alu.hr (Postfix) with ESMTPSA id B8CEF604EA; Mon, 27 Feb 2023 18:51:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1677520274; bh=YdTE5lDjvSSCYH2seOlusLqO3HeakuTrMpKlRWsfD7U=; h=Date:To:Cc:From:Subject:From; b=rCwgAO6/UwD90lz2DFg8oBL/MAFEn1xTnP3vVmO77p62MjzmoA5JOspIU+zux5aAy ck9M6pHcf/mtGc212aVPmTM3gR7yc9+fT59Cr4kTFhGSmRIIiQxJPfPFHGkr7Q3KCI 07RPmQ+isyO2lnydHrtCN3vcTtGoLB50OIcVJ62OuVp+NQSXfpa9+hp5FO+v7R6Vac BeauQSWcXvOUPf+4kCF00VMQcQHFgg4/jT8BXT3b1KaigHNiRLetME00HBLljt0MNc ITIqDArIVPm3kKdfULd8J6ojOdMQsY81b5CHT3HDULjnH8QbjAW1bACIUHMQ7g6HCm ihxyw5sqgPiuw== Message-ID: <fe030b8e-0573-93de-88ae-38ee48d6c89f@alu.unizg.hr> Date: Mon, 27 Feb 2023 18:51:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Content-Language: en-US, hr To: Bartosz Golaszewski <brgl@bgdev.pl> Cc: Andy Shevchenko <andriy.shevchenko@intel.com>, LKML <linux-kernel@vger.kernel.org>, linux-gpio@vger.kernel.org From: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> Subject: selftests/gpio: gpio-sim.sh: BUG: test FAILED due to recent change in sh source Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS 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: <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?1759007974661172953?= X-GMAIL-MSGID: =?utf-8?q?1759007974661172953?= |
Series |
selftests/gpio: gpio-sim.sh: BUG: test FAILED due to recent change in sh source
|
|
Commit Message
Mirsad Todorovac
Feb. 27, 2023, 5:51 p.m. UTC
Hi, The gpio-sim.sh test appears to FAIL in a wrong way due to missing initialisation of shell variables: $ sudo gpio-sim.sh . . . 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 ./gpio-sim.sh: line 393: test: =: unary operator expected bias setting does not work GPIO gpio-sim test FAIL $ This patch fixed the issue: ... after which the test passed: 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 Which I believe proves that the bug was in the script and not in the gpio-sim driver. Or I am doing something very wrong, but I got the above error on AlmaLinux 8.7 on my Lenovo desktop box with the 6.2+ latest pull Linux kernel: [marvin@pc-mtodorov linux_torvalds]$ uname -rms Linux 6.2.0-mglru-kmlk-andy-09238-gd2980d8d8265 x86_64 Regards, Mirsad
Comments
On Mon, Feb 27, 2023 at 06:51:09PM +0100, Mirsad Todorovac wrote: > Hi, > > The gpio-sim.sh test appears to FAIL in a wrong way due to missing initialisation > of shell variables: > > $ sudo gpio-sim.sh > . > . > . > 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 > ./gpio-sim.sh: line 393: test: =: unary operator expected > bias setting does not work > GPIO gpio-sim test FAIL > $ > > This patch fixed the issue: > > 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 > > ... after which the test passed: > > 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 > > Which I believe proves that the bug was in the script and not in the gpio-sim driver. I agree with the analysis. Bart, seems to me that it might be the case, but I want to amend the fix a bit.
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