Received: by 10.223.185.116 with SMTP id b49csp1886104wrg; Thu, 22 Feb 2018 04:54:42 -0800 (PST) X-Google-Smtp-Source: AH8x227wmq+ZT//VyzhKu4Y328O9s6TEm+dAAtpYO1fs03w2wxfDSosNc2ovnfKd+xsOS3MTItH0 X-Received: by 10.98.192.203 with SMTP id g72mr6889403pfk.27.1519304082880; Thu, 22 Feb 2018 04:54:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519304082; cv=none; d=google.com; s=arc-20160816; b=IZv57dW8L5nLkd5nBzJZxU6xKlg28guG7+h3Q5PpERrGs/HoN+G8Q9mN0Cx5KMNkDN iLjD8KifT+8/xEc/1TEt+I/slG3Cd5ycmp5sfFIHHboHUNXr2uhOUMaE+wCnQAjRLmkw U6BOwgS6VbxNK832Qzy5R0X7huH1lnfmgHOu/lmyf94raaEXwzqQRh6a2OK2r+e8XKcW lygE8bkwCWs0Y3RlM++2zjcEK9sfl3vURY3kYGzTuQrKHLriI8hLEFqNKOmria40V0zC cnYxLqRim7UfiMYs6FfT16y6JMtMdk+JjGzRqXtL/KNcCuUMKuOdpsaKEpCZkaNBPL0+ lO5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=7PyQ3+pdxen82IOK5dLdDmgNKb3bmSL73hoaZ5L6XBI=; b=hlsnU9axIw+08CX4Erco4BePQkXp6sKF9G8jfdsrkD2vamKnI9A14R1orgJ5bORYtr aYJ+W5Z7o32yMtzFbJVrm6etXRNpLeYFlvIlgwMB5Ix2ErGjaCVlhxhLR1C56unV7vwB K1UQICHJhruy8umU+Jr7ayx+cz31iUoTcxdhWWgZ/B4OKpYEfsLc4pJZJJ7pw5bdx5Xs 9j7gDSOUYAlyGQN2swCIJqYMgeTrmJAXSjzAJo9JlPTcMKXXFJxcJrPIedJxo+LSF8ft ozMLhsrOOCvR1IVh+T6ckA8tAGuErdQoUooweBMLGCIQEeUnvIPDsfpVy+rP9QYTO+I/ zLlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CTSxkM2V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id bf2-v6si6200plb.257.2018.02.22.04.54.28; Thu, 22 Feb 2018 04:54:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CTSxkM2V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S932329AbeBVMxv (ORCPT + 99 others); Thu, 22 Feb 2018 07:53:51 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:44882 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753702AbeBVMxu (ORCPT ); Thu, 22 Feb 2018 07:53:50 -0500 Received: by mail-pg0-f65.google.com with SMTP id l4so1952809pgp.11; Thu, 22 Feb 2018 04:53:49 -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; bh=7PyQ3+pdxen82IOK5dLdDmgNKb3bmSL73hoaZ5L6XBI=; b=CTSxkM2V58PqOuDJY6bY1RQmuTViuIZ7sEXBjFsH2N2Ex9XPSDT41bBLizN+Bwe0cP EA0oFDO+pzfTcu4otM+wkL9wpeMG5f+uDNqnMaahkBgs7kBcmHKttw3Xez0BrZYXF6vJ zwFRQg6Uzm6zQ9OpKYbref81XX+zGdJliaWCCMj3FUPYrq1tqR8fTKMrq5hLqwM+ujJY xUAbGcCPiOa9OtmBL8Bcai5y92MTcOY5xvPsI4vNz7Bj292NLegxt9I8tBeHGfzAp20I gbbuwiW10kmCX6rYMPVu+4s5O1I7RFIKxaffzDNClL8NCM8/yUVjTuaHwQp6x4uYEHG+ 1IUw== 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; bh=7PyQ3+pdxen82IOK5dLdDmgNKb3bmSL73hoaZ5L6XBI=; b=W5g5FR/QR35DAqXi8878uTFUQK/5++SFbYyrsjlyN296BkxBhMwPwUffPK7GtjdU8W 5+UZwiQWyp3PyKOiHn4XnQVfR7mGSTsaTUoydAdb5eKfiY9cTjBGzWyEkI2rITf4MID8 dz2u7jeXwGC+OIFcMRb8KiiybOyBxnE57aYBF0u2YU2G63pD3TqSQ1pW1PHY49gwoGYV DbRKvgUD6mhfkxMg8X1xgK4Rh9kFN1MnscDuCRQQ7bZ1qQ4CJppI59RCnPeH07hAovVd t/KilCfFyIkkp4xX/gDOhsYYK1uxuM7dTTzOVI5p3oQhqzjsi91orKtwzU56kqoaPxZk iA6w== X-Gm-Message-State: APf1xPCV1BUbRQ+EnP4DySrbpClfybyu7pA3GCQPe4nCaV4WjfKGYlLy bG7l2D047E6ZNyokUdzt99A= X-Received: by 10.99.126.17 with SMTP id z17mr5608459pgc.218.1519304029385; Thu, 22 Feb 2018 04:53:49 -0800 (PST) Received: from app09.andestech.com ([118.163.51.199]) by smtp.gmail.com with ESMTPSA id d77sm119847pfe.20.2018.02.22.04.53.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 04:53:48 -0800 (PST) From: Zong Li To: shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: zong@andestech.com, greentime@andestech.com, Zong Li Subject: [PATCH] selftest: support running subset of selftests for run_kselftest.sh Date: Thu, 22 Feb 2018 20:53:00 +0800 Message-Id: <20180222125300.15681-1-zongbox@gmail.com> X-Mailer: git-send-email 2.16.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Simply use the first argument to specify the subset of selftests. Use comma notation to separate multiple tests. (e.g. ./run_kselftest.sh size,timers,...) Default behaviour is running all selftests. Each selftest be defined as function that we can run one of selftests. The function name has underline as prefix to avoid confilct with built-in command of shell. (e.g. The exec is built-in command of shell) The hyhpen of function name be replace to the underline because not all shells can use hyphen in function name, like sh, ash and so on. Signed-off-by: Zong Li Cc: Greentime Hu Cc: Shuah Khan --- tools/testing/selftests/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 7442dfb73b7f..08e2a855f187 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -128,13 +128,22 @@ ifdef INSTALL_PATH for TARGET in $(TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ + echo "_$${TARGET//-/_}()" >> $(ALL_SCRIPT); \ + echo "{" >> $(ALL_SCRIPT); \ echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \ echo "echo ========================================" >> $(ALL_SCRIPT); \ echo "cd $$TARGET" >> $(ALL_SCRIPT); \ make -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \ echo "cd \$$ROOT" >> $(ALL_SCRIPT); \ + echo "}" >> $(ALL_SCRIPT); \ + echo "" >> $(ALL_SCRIPT); \ done; + echo "TARGETS=\$${1:-\`ls -d */ | sed 's#/##' \`}" >> $(ALL_SCRIPT); + echo "for TARGET in \$${TARGETS//,/ }; do" >> $(ALL_SCRIPT); + echo " _\$${TARGET//-/_}" >> $(ALL_SCRIPT); + echo "done" >> $(ALL_SCRIPT); + chmod u+x $(ALL_SCRIPT) else $(error Error: set INSTALL_PATH to use install) -- 2.16.1