From patchwork Tue Jan 19 12:30:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Gibson X-Patchwork-Id: 367377 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 791F4C4160E for ; Tue, 19 Jan 2021 14:33:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62BA0207FB for ; Tue, 19 Jan 2021 14:33:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405441AbhASOcm (ORCPT ); Tue, 19 Jan 2021 09:32:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393041AbhASMb6 (ORCPT ); Tue, 19 Jan 2021 07:31:58 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CB23C061573; Tue, 19 Jan 2021 04:31:17 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id t6so10433418plq.1; Tue, 19 Jan 2021 04:31:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nS36t5MdMV6M9yjzyoSn9+892tFdOCVlnlg10RRFg7g=; b=V3G8VacsqtfQWaKPnCU0sc21kZkaVKCZy5kJhlf/xxIOMdldWCyDrl1zupAr5RFKhG I5gciOyM6qLzOCSYpBu3W5VmDuSpqUqCHnkSbknhNKoq+Hy4fPweRpANQiozr/qGQNvF lsvRFFgioG7cZy7bF2zsOs9xdAFqZofEUapF8LIFV4SblopP731+gHow5sdMnDY+JBTF eg0dC2kGjofl5GRPHh/YGIm6OhZwEw28n4dVWpWcNFgwOscNtE5yq4km+prsOwKgw7pQ e2oWKaEl/Lq5iSDiMTbeQdcokU0EROaEPFQja2JYXvw/q2d2ri5PU53/ufva+RCOUMIC OdkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nS36t5MdMV6M9yjzyoSn9+892tFdOCVlnlg10RRFg7g=; b=NkvvMY5JYdeZ/CQEG3XNa08LrYJp943Ql4YD6NVd4Vd4rkFZqMQa+NfB4q1tnGrHf3 1oTTsVMOx05X3Mp4gIOgaIwPhfnwGWL8pzYAWWlq8XM5df2/4njx18guu9xUtOKGF0fG uTOstVXBEWhI00EN/+K8oMkUaD7pTO1H94Zp1ZIhVJygjSPBRMhMYBjCYK8mGhADgcbn aU6nABJuDjbb0FFVmUscDudo0QR0U9ourIaPe4fRWgXzEgpCqo8TWHju2y15kvm9Gu0I nCT1wvzUfXG2giY9xgN6TBmpsDOHzUJBB7ymJrtwa3VjUftpQwCTDSY5I37FFUnTWtgi G4Xw== X-Gm-Message-State: AOAM532VzBbLQzSo3OUrEiI4KEDJeJ0T5bRJPspLwAX1aaC8IcOkJKEH ZXkNClCuzhwONZ/ntibIjT62OO10I4o= X-Google-Smtp-Source: ABdhPJxiY7d7vgdzhf1lpGZsAsiDWIT77Cgx4PhrSG3O31AvCsnSpMgZRQYcsXg3zO5FAIsZM2Ew5w== X-Received: by 2002:a17:90a:d181:: with SMTP id fu1mr5186551pjb.188.1611059475930; Tue, 19 Jan 2021 04:31:15 -0800 (PST) Received: from sol.lan (106-69-181-154.dyn.iinet.net.au. [106.69.181.154]) by smtp.gmail.com with ESMTPSA id q4sm19283052pgr.39.2021.01.19.04.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 04:31:14 -0800 (PST) From: Kent Gibson To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kselftest@vger.kernel.org, bgolaszewski@baylibre.com, linus.walleij@linaro.org, shuah@kernel.org, bamv2005@gmail.com Cc: Kent Gibson Subject: [PATCH v3 0/7] selftests: gpio: rework and port to GPIO uAPI v2 Date: Tue, 19 Jan 2021 20:30:52 +0800 Message-Id: <20210119123059.102004-1-warthog618@gmail.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Initially I just wanted to port the selftests to the latest GPIO uAPI, but on finding that, due to dependency issues, the selftests are not built for the buildroot environments that I do most of my GPIO testing in, I decided to take a closer look. The first patch is essentially a rewrite of the exising test suite. It uses a simplified abstraction of the uAPI interfaces to allow a common test suite to test the gpio-mockup using either of the uAPI interfaces. The simplified cdev interface is implemented in gpio-mockup.sh, with the actual driving of the uAPI implemented in gpio-mockup-cdev.c. The simplified sysfs interface replaces gpio-mockup-sysfs.sh and is loaded over the cdev implementation when selected. The new tests should also be simpler to extend to cover new mockup interfaces, such as the one Bart has been working on. I have dropped support for testing modules other than gpio-mockup from the command line options, as the tests are very gpio-mockup specific so I didn't see any calling for it. I have also tried to emphasise in the test output that the tests are covering the gpio-mockup itself. They do perform some implicit testing of gpiolib and the uAPI interfaces, and so can be useful as smoke tests for those, but their primary focus is the gpio-mockup. Patches 2 through 5 do some cleaning up that is now possible with the new implementation, including enabling building in buildroot environments. Patch 4 doesn't strictly clean up all the old gpio references that it could - the gpio was the only Level 1 test, so the Level 1 tests could potentially be removed, but I was unsure if there may be other implications to removing a whole test level, or that it may be useful as a placeholder in case other static LDLIBS tests are added in the future?? Patch 6 finally gets around to porting the tests to the latest GPIO uAPI. And Patch 7 updates the config to set the CONFIG_GPIO_CDEV option that was added in v5.10. Cheers, Kent. Changes v2 -> v3: - remove 'commit' from Fixes tag in patch 1. - rebase on Bart's gpio/for-next Changes v1 -> v2 (all in patch 1 and gpio-mockup.sh unless stated otherwise): - reorder includes in gpio-mockup-cdev.c - a multitude of improvements to gpio-mockup.sh and gpio-mockup-sysfs.sh based on Andy's review comments - improved cleanup to ensure all child processes are killed on exit - added race condition prevention or mitigation including the wait in release_line, the retries in assert_mock, the assert_mock in set_mock, and the sleep in set_line Kent Gibson (7): selftests: gpio: rework and simplify test implementation selftests: gpio: remove obsolete gpio-mockup-chardev.c selftests: remove obsolete build restriction for gpio selftests: remove obsolete gpio references from kselftest_deps.sh tools: gpio: remove uAPI v1 code no longer used by selftests selftests: gpio: port to GPIO uAPI v2 selftests: gpio: add CONFIG_GPIO_CDEV to config tools/gpio/gpio-utils.c | 89 ---- tools/gpio/gpio-utils.h | 6 - tools/testing/selftests/Makefile | 9 - tools/testing/selftests/gpio/Makefile | 26 +- tools/testing/selftests/gpio/config | 1 + .../testing/selftests/gpio/gpio-mockup-cdev.c | 198 +++++++ .../selftests/gpio/gpio-mockup-chardev.c | 323 ------------ .../selftests/gpio/gpio-mockup-sysfs.sh | 168 ++---- tools/testing/selftests/gpio/gpio-mockup.sh | 497 ++++++++++++------ tools/testing/selftests/kselftest_deps.sh | 4 +- 10 files changed, 603 insertions(+), 718 deletions(-) create mode 100644 tools/testing/selftests/gpio/gpio-mockup-cdev.c delete mode 100644 tools/testing/selftests/gpio/gpio-mockup-chardev.c base-commit: 64e6066e16b8c562983dd9d33e604c0001ae0fc7