Received: by 10.223.148.5 with SMTP id 5csp6909468wrq; Wed, 17 Jan 2018 21:32:07 -0800 (PST) X-Google-Smtp-Source: ACJfBovneT55PKGYsWM4IZrNdJe8gOUJHXcUpETVECrvd7lzUKXYbO2+KHgpPl8Btg3x2qM+z7su X-Received: by 10.101.72.11 with SMTP id h11mr5341549pgs.386.1516253527415; Wed, 17 Jan 2018 21:32:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516253527; cv=none; d=google.com; s=arc-20160816; b=yUGs9s/TY7ONDjg67vtqMizrJMJoWM9adAcEyHoe4Jj/HNDXA68+L8Rh6q0lA56iMd DR07AaMypl2p2pRTIoWM30zkaNjjr5BRxqIePKYmcLEBdcQb1ao5VihXkucHJ17dnjEP AYbG2a0ucj76g3gKMOHIwuGPgdi4eD+LZUDGR0l296n9OU7B7MLBW6S3j9V8ybfFYeE1 +Tn1JDFn7RHmD7UUvP/CDNPMZ8QLn4f6kJLwQ3CB5WHYS9G/KR3i9Fcl8AT/TJFc1r3l k4yUQie1rY2rR2qnUryToi3aOK4jALG+3+yYECas6ULWc+u8iVtELatp9M7Gk+aNfZUI MfXA== 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:to:from :dkim-signature:arc-authentication-results; bh=HTyRijE/3JOIpK9lpAy+c7ihiIjT0jGBqRC+mXl79UU=; b=ppIrzRISeiA8+wl1OV/Rt1lBl9kPoJ7/59l5qqo+6phWzq3kg4gCED/5Gt8fN4ZaPR 5uZEeyUYGpDV3Op4KKTElRJfu7oD9A/xMH9cctj04lUMKviYfayE9rIrwJ2PExFXxOsD mn6lABh4Cw0I6mVUjIK+juccLWWfuVQ+Z77Rg74RuaOk5lvrwuOXyr8U5lyanOXTTlIz RkI9LKLwDfdSYBqkwIuzq4fI5JnxBbKzrNlbqyX0R4L5QTGdTKXyycf2Yd7ShTsn2R4Z PXkOXD0F0ZDZREhL4uEz+YhlcQcl2PEvsBstYMKvgdoB3Aq0iW32GHk79Pule/+PaQQM btbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SzPWmXaZ; 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=NONE 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 z4si5870225pln.728.2018.01.17.21.31.53; Wed, 17 Jan 2018 21:32:07 -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=SzPWmXaZ; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754365AbeARFb2 (ORCPT + 99 others); Thu, 18 Jan 2018 00:31:28 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:41354 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750962AbeARFb1 (ORCPT ); Thu, 18 Jan 2018 00:31:27 -0500 Received: by mail-pf0-f195.google.com with SMTP id j3so13493150pfh.8; Wed, 17 Jan 2018 21:31:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=HTyRijE/3JOIpK9lpAy+c7ihiIjT0jGBqRC+mXl79UU=; b=SzPWmXaZ3HRu48BXvzaMf3p1Ble4P1QTJJVFlrjsFwJ1omMZFCQApJYpAXOUliiV6Y XIIws+tzydLVHAlOTLUTIIFVFJj5eMGE7AI9pAZK9aBgR1qVONbUPaY/diarcVAI13H+ iwBjQLgs2l10UFIEq/YA2HebR8fUBGFPU8QeGW+u/J3GOrVSNhNzL9Csrz6weqtPYiU2 S2S2PYyYgIXWKnM/3G3w+YgI28leiagt5F+VX9ieHj07WJpfsXQg252yUd5kqkzNZHx6 DBHtWU72f0LQMUBqy6VZoQIhIfrImzKoijii3rV6MlspmD2gAMabH5ciUgFPzMtFYFTj l8Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=HTyRijE/3JOIpK9lpAy+c7ihiIjT0jGBqRC+mXl79UU=; b=dY+ZJFE6e8sN/7MS2pVPqKH5Sd66k9LKLOvY1abAaTtTE0ll9rqZR0w970GboHHzLw uOt1cF/YslROzRnDcP8eiRKZFaVWm9uwZOloAzk69gcEVbav1A+MAMYUKbnmrkCuMA7k 4ue6CACLF2MCJebr2lhjZmzVlk8/F34RmZF9saZ/KduxeQvsBV4hp4/X7/gAeDsY0lrp kB5TJaJcy9ndr7TZT6RwgpkwG4mk/idPhbb2mv8hepAPZUUKr+t4CdPwK+SMRDLZinpm IiAS9vUDPoBafhlf4EaF2gkIdh9RGywbAv1peFZvjqH7Ppn28jkuY75KS3iK4bK5tRxv tE1g== X-Gm-Message-State: AKwxytcZeetfLDAdu5trhSn1yPDtubiy+ZzzgaC6/qZpwcqXbArXx0qm /917J8yzc803QIwtu56lb7s= X-Received: by 10.159.214.139 with SMTP id n11mr11374530plp.168.1516253486205; Wed, 17 Jan 2018 21:31:26 -0800 (PST) Received: from app09.andestech.com ([118.163.51.199]) by smtp.gmail.com with ESMTPSA id r27sm10583978pfj.75.2018.01.17.21.31.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jan 2018 21:31:25 -0800 (PST) From: Zong Li To: shuah@kernel.org, kstewart@linuxfoundation.org, tglx@linutronix.de, pombredanne@nexb.com, gregkh@linuxfoundation.org, zongbox@gmail.com, lei.yang@windriver.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, zong@andestech.com Subject: [PATCH v2] selftest: support run subset of selftests when running installed selftests Date: Thu, 18 Jan 2018 13:31:05 +0800 Message-Id: <1516253465-30367-1-git-send-email-zongbox@gmail.com> X-Mailer: git-send-email 1.7.9.5 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 installed. 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) Replace the hyphen with underline for cpu-hotplug and memory-hotplug. Not all shell can use hyphen in function name, like sh, ash and so on. Signed-off-by: Zong Li --- tools/testing/selftests/Makefile | 17 +++++++++++++---- .../selftests/{cpu-hotplug => cpu_hotplug}/Makefile | 2 +- .../selftests/{cpu-hotplug => cpu_hotplug}/config | 0 .../{cpu-hotplug => cpu_hotplug}/cpu-on-off-test.sh | 0 .../{memory-hotplug => memory_hotplug}/Makefile | 4 ++-- .../selftests/{memory-hotplug => memory_hotplug}/config | 0 .../mem-on-off-test.sh | 0 7 files changed, 16 insertions(+), 7 deletions(-) rename tools/testing/selftests/{cpu-hotplug => cpu_hotplug}/Makefile (66%) rename tools/testing/selftests/{cpu-hotplug => cpu_hotplug}/config (100%) rename tools/testing/selftests/{cpu-hotplug => cpu_hotplug}/cpu-on-off-test.sh (100%) rename tools/testing/selftests/{memory-hotplug => memory_hotplug}/Makefile (55%) rename tools/testing/selftests/{memory-hotplug => memory_hotplug}/config (100%) rename tools/testing/selftests/{memory-hotplug => memory_hotplug}/mem-on-off-test.sh (100%) diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index eaf599d..dc9bb6c 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -4,7 +4,7 @@ TARGETS += bpf TARGETS += breakpoints TARGETS += capabilities TARGETS += cpufreq -TARGETS += cpu-hotplug +TARGETS += cpu_hotplug TARGETS += efivarfs TARGETS += exec TARGETS += firmware @@ -17,7 +17,7 @@ TARGETS += kcmp TARGETS += lib TARGETS += membarrier TARGETS += memfd -TARGETS += memory-hotplug +TARGETS += memory_hotplug TARGETS += mount TARGETS += mqueue TARGETS += net @@ -43,8 +43,8 @@ TARGETS += zram # Run "make quicktest=1 run_tests" or # "make quicktest=1 kselftest" from top level Makefile -TARGETS_HOTPLUG = cpu-hotplug -TARGETS_HOTPLUG += memory-hotplug +TARGETS_HOTPLUG = cpu_hotplug +TARGETS_HOTPLUG += memory_hotplug # Clear LDFLAGS and MAKEFLAGS if called from main # Makefile to avoid test build failures when test @@ -121,13 +121,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 */\`}" >> $(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) diff --git a/tools/testing/selftests/cpu-hotplug/Makefile b/tools/testing/selftests/cpu_hotplug/Makefile similarity index 66% rename from tools/testing/selftests/cpu-hotplug/Makefile rename to tools/testing/selftests/cpu_hotplug/Makefile index d8be047..a9c88b9 100644 --- a/tools/testing/selftests/cpu-hotplug/Makefile +++ b/tools/testing/selftests/cpu_hotplug/Makefile @@ -6,6 +6,6 @@ TEST_PROGS := cpu-on-off-test.sh include ../lib.mk run_full_test: - @/bin/bash ./cpu-on-off-test.sh -a || echo "cpu-hotplug selftests: [FAIL]" + @/bin/bash ./cpu-on-off-test.sh -a || echo "cpu_hotplug selftests: [FAIL]" clean: diff --git a/tools/testing/selftests/cpu-hotplug/config b/tools/testing/selftests/cpu_hotplug/config similarity index 100% rename from tools/testing/selftests/cpu-hotplug/config rename to tools/testing/selftests/cpu_hotplug/config diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu_hotplug/cpu-on-off-test.sh similarity index 100% rename from tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh rename to tools/testing/selftests/cpu_hotplug/cpu-on-off-test.sh diff --git a/tools/testing/selftests/memory-hotplug/Makefile b/tools/testing/selftests/memory_hotplug/Makefile similarity index 55% rename from tools/testing/selftests/memory-hotplug/Makefile rename to tools/testing/selftests/memory_hotplug/Makefile index 86636d2..28fd7dc 100644 --- a/tools/testing/selftests/memory-hotplug/Makefile +++ b/tools/testing/selftests/memory_hotplug/Makefile @@ -4,10 +4,10 @@ all: include ../lib.mk TEST_PROGS := mem-on-off-test.sh -override RUN_TESTS := ./mem-on-off-test.sh -r 2 && echo "selftests: memory-hotplug [PASS]" || echo "selftests: memory-hotplug [FAIL]" +override RUN_TESTS := ./mem-on-off-test.sh -r 2 && echo "selftests: memory_hotplug [PASS]" || echo "selftests: memory_hotplug [FAIL]" override EMIT_TESTS := echo "$(RUN_TESTS)" run_full_test: - @/bin/bash ./mem-on-off-test.sh && echo "memory-hotplug selftests: [PASS]" || echo "memory-hotplug selftests: [FAIL]" + @/bin/bash ./mem-on-off-test.sh && echo "memory_hotplug selftests: [PASS]" || echo "memory_hotplug selftests: [FAIL]" clean: diff --git a/tools/testing/selftests/memory-hotplug/config b/tools/testing/selftests/memory_hotplug/config similarity index 100% rename from tools/testing/selftests/memory-hotplug/config rename to tools/testing/selftests/memory_hotplug/config diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh b/tools/testing/selftests/memory_hotplug/mem-on-off-test.sh similarity index 100% rename from tools/testing/selftests/memory-hotplug/mem-on-off-test.sh rename to tools/testing/selftests/memory_hotplug/mem-on-off-test.sh -- 2.9.3