Received: by 10.192.165.148 with SMTP id m20csp683563imm; Fri, 4 May 2018 18:19:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpwekRFIQz1xD3n+wdhqFGRuCdUrhOZiFJgFb4rnXxt4wGFckK6H1qOOx2PLCa50XfqbocV X-Received: by 2002:a65:6496:: with SMTP id e22-v6mr5970591pgv.386.1525483142498; Fri, 04 May 2018 18:19:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525483142; cv=none; d=google.com; s=arc-20160816; b=vRlT1u/3zurCoHYqs/QpojlLmTXxu39k/C5X7B6Wh2r5FbLZu3NTXinO/RzBMUXKa7 gUKHb35q6Yp+KuK3RCEVtFAt7fsnvXQGbabplxexIt6h64d8mRdZQRLFLX3H+Y+qRkka B8sYU98gQG2gC4ojp6WzdUM7bZXeH1ivvQz9sgU+LWrlPfHRmB98CWn7/Fkga0fBfmRz tVW2Etq55PztiQuU2D/rSDyJUD/SMO3qicq0Y7pxEVcXXKm+NuepQeTmoWIOTT5XhXNl iNhio2I0ZWXvnOTDhAkZi4PL8x9GtKCAXkpr/ese1chiiCHgZpHrrVaD7Ogqj8keFRlk jLoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=2Q98F0t/rDer8jAAbpJbWcCRN/W/eJ/Vd7qhu5GXUfY=; b=tgFkVs41NdY0+s9jGwKStV42F10BrCxYKlwPSz7cXz5XeGfmuj+PjXY7XLHAFuilT9 fFsLzoYVtyCHymmtCRqFf8DOUHlluIHrSrA5jbYHptC6OMr36yq4DCUE8dPbqhJkyheB wlUL3xHM9pp3kaWW7ciwP3F65byjsDXZ9YmnL8Zyxib2BNZRdaZuDiSKfpWQyO0XwWJD EcyyzK6Eb7aYL8CX0MboUuS7qwn6C2SETkfu+W0ovG9zKBW4AYNmP1TBnXNUhBn/YYZv 5H8Jf1HwZae2Yuaeq4ezCeT/i9byAEqfJQnC84S3yfPpwxt1awSpUSnLMd18j+rPtw9O Ailg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e98-v6si16894888plb.273.2018.05.04.18.18.48; Fri, 04 May 2018 18:19:02 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752309AbeEEBSG (ORCPT + 99 others); Fri, 4 May 2018 21:18:06 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:50652 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752288AbeEEBSD (ORCPT ); Fri, 4 May 2018 21:18:03 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 325CC21075; Sat, 5 May 2018 01:18:02 +0000 (UTC) Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo02-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2Z4lL3F9M_oj; Sat, 5 May 2018 01:18:02 +0000 (UTC) Received: from localhost.localdomain (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 9704A20E18; Sat, 5 May 2018 01:17:57 +0000 (UTC) From: "Shuah Khan (Samsung OSG)" To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 22/24] selftests: memory-hotplug: return Kselftest Skip code for skipped tests Date: Fri, 4 May 2018 19:13:26 -0600 Message-Id: <20180505011328.32078-22-shuah@kernel.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180505011328.32078-1-shuah@kernel.org> References: <20180505011328.32078-1-shuah@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When memory-hotplug test is skipped because of unmet dependencies and/or unsupported configuration, it returns non-zero value hich is treated as a fail by the Kselftest framework. This leads to false negative result even when the test could not be run. Change it to return kselftest skip code when a test gets skipped to clearly report that the test could not be run. Kselftest framework SKIP code is 4 and the framework prints appropriate messages to indicate that the test is skipped. Signed-off-by: Shuah Khan (Samsung OSG) --- tools/testing/selftests/memory-hotplug/mem-on-off-test.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh index ff4991704d07..b37585e6aa38 100755 --- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh +++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh @@ -3,30 +3,33 @@ SYSFS= +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + prerequisite() { msg="skip all tests:" if [ $UID != 0 ]; then echo $msg must be run as root >&2 - exit 0 + exit $ksft_skip fi SYSFS=`mount -t sysfs | head -1 | awk '{ print $3 }'` if [ ! -d "$SYSFS" ]; then echo $msg sysfs is not mounted >&2 - exit 0 + exit $ksft_skip fi if ! ls $SYSFS/devices/system/memory/memory* > /dev/null 2>&1; then echo $msg memory hotplug is not supported >&2 - exit 0 + exit $ksft_skip fi if ! grep -q 1 $SYSFS/devices/system/memory/memory*/removable; then echo $msg no hot-pluggable memory >&2 - exit 0 + exit $ksft_skip fi } -- 2.14.1