Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2727729pxb; Tue, 19 Jan 2021 04:48:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOfbIbtyh4322SAZnDFBEHzldXeYe+ZOSfDj415+5wfaSqEwBueReJUXk+j1mvKKVe2Umx X-Received: by 2002:a05:6402:487:: with SMTP id k7mr3301100edv.130.1611060484040; Tue, 19 Jan 2021 04:48:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611060484; cv=none; d=google.com; s=arc-20160816; b=tf4glzW10CPRfduhQO3asImZrqVJ0hWBwVQ9TtMl4VAZZdk0xyE8xN2HeUeTMgGphz l7fE4ybqDs7ReNG/WOYhMBQi2yX8m3q/b2Ll1/zVTWkXzuDx8m5HhbuJZxnjXtG2D0Rw 43/23Wly1PwrhtV6plJk6fMySJ71X5YEL4m6iFQhlRQlg0x0pbmlKfQB0+44MtKMdOpa y02cEUGntgSoXmW78IyYoOTXJrXCHNOaqOS9JDqceI7TcEqsvJVhkCvbbLS3AiRumlRK RxGSKBYUrF3lR5bj9s2O1qhq6w60GDb90Fu1td1khV6fdOKKBRZsy3pR5ZBi8KzhsSkv clgQ== 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=nS36t5MdMV6M9yjzyoSn9+892tFdOCVlnlg10RRFg7g=; b=ynQrxqYAG1KlRKWJh2afMU0iTjWqES60NZR3hrq0fUz408fiadxIyE/WEQRFWdm0zr BrkEjas8mAOlrT2/mTjtlGYvIw+I0qjTNnpp5QtfAeAjGuwMgakwHtcIxmAG9ow5Yw2j qB8Ih6pbGj+3HHnuT4o7WzVtwvrHJlvr4yb5tJ8zz6I+XOZa7nKEvFNEkvrWb8A1zmoA j3Wfn1j1dVBJS5TJKch6qUsPlClP6TfRSIuzs/8DCBAoaVfXoTpWeHYGOyBHUODGT1My iys70dFqVa2eBTqK/pdZiZBpWJvGF5SCURBOUCWFyZttoc3aPoaQlqIUafx7c/T+NbXy ibDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V3G8Vacs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k25si1310214edq.373.2021.01.19.04.47.41; Tue, 19 Jan 2021 04:48:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V3G8Vacs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2387414AbhASMgM (ORCPT + 99 others); Tue, 19 Jan 2021 07:36:12 -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-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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 -- 2.30.0