Received: by 10.192.165.148 with SMTP id m20csp681839imm; Fri, 4 May 2018 18:16:12 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpvhsp++vkg6AYufbzaXbSbgSeHiH6FMPiJUAUBycb48XjLyyGjaB0p8bcOtwISUDFQgvIq X-Received: by 2002:a63:91c4:: with SMTP id l187-v6mr23800403pge.261.1525482972547; Fri, 04 May 2018 18:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525482972; cv=none; d=google.com; s=arc-20160816; b=TJmr4aekpApku13Js49xUgNTslUM7k5QeH44bc9J3NM3086DMeCr5xqRnThSgja9qc imlpwqErfpTkBo5DYyxfqI7XzbZqILKEPB4Cj79SWTwCg0M/jaw3G882pxzjh9mQEEct dBT+Qkwi0Wm/AY8JH6VsRIt1IiJ0MwO1N12WAHVUrMrBa+NiRKN+xU7hQyPe/EfbLvZ0 uvetq/f5iVwgIcUQT6nkTWVtRd5s3oRE+rNXrokYW2DHlCtEghd8GIY29L38nK29eql0 5GFqRIfqO6YtjYkEl6YqIiHFPjnyjqRwq6Zr8UAx/SqaYZviSaJNUmc0xWhqWmf3R/Qh /tow== 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=DaayVPjDSyRFVAciVKO5nPHQIRJP29UcHLLy8AX7Pk8=; b=GNIE9EMUQFxltPRDTJtb/44TU/EvVf8NzdRtmDj/g2gn472csU4r6SgUZgL0a0jk6v gIy5/k569DWWuOoGhuP9fDz3w+oK0CIbdmCIbqLatVoBLflCRUvZl+zgL65fa/OpzCXh 1h3mDQxCh2RTAavj3kFSudlP0Lc/ysbIeTnBByVLIOC2Shyo0JUZDTt75PPN1VCOOASO BfCzBJJT+JA+WbwOD7yea5y/1f2GoBTA/fumKYyzVLUQdYrHAv74c/IfPq1x4h6kM/Pc fcV5ARPGsG08+TYDcorc9aq8WiSIIcov3PQ7ws8NuDBrCayzSsqhc8RJn8Kwe26ruFPd WydQ== 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 y3-v6si8664092pgv.504.2018.05.04.18.15.57; Fri, 04 May 2018 18:16:12 -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 S1752055AbeEEBPZ (ORCPT + 99 others); Fri, 4 May 2018 21:15:25 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:50444 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751771AbeEEBPW (ORCPT ); Fri, 4 May 2018 21:15:22 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 3A1F121249; Sat, 5 May 2018 01:15:22 +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 yOvVJz3qDWIF; Sat, 5 May 2018 01:15:22 +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 B1D9821020; Sat, 5 May 2018 01:15:14 +0000 (UTC) From: "Shuah Khan (Samsung OSG)" To: shuah@kernel.org, rostedt@goodmis.org, mhiramat@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/24] selftests: ftrace: return Kselftest Skip code for skipped tests Date: Fri, 4 May 2018 19:13:13 -0600 Message-Id: <20180505011328.32078-9-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 ftrace test is skipped because of unmet dependencies and/or unsupported configuration, it returns 0 which is treated as a pass by the Kselftest framework. This leads to false positive 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/ftrace/ftracetest | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest index f9a9d424c980..b731c8cdcffb 100755 --- a/tools/testing/selftests/ftrace/ftracetest +++ b/tools/testing/selftests/ftrace/ftracetest @@ -23,6 +23,9 @@ echo " If is -, all logs output in console only" exit $1 } +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=4 + errexit() { # message echo "Error: $1" 1>&2 exit 1 @@ -30,7 +33,8 @@ errexit() { # message # Ensuring user privilege if [ `id -u` -ne 0 ]; then - errexit "this must be run by root user" + echo "Skipping: test must be run by root user" + exit $ksft_skip fi # Utilities @@ -249,7 +253,7 @@ trap 'SIG_RESULT=$UNTESTED' $SIG_UNTESTED SIG_UNSUPPORTED=$((SIG_BASE + UNSUPPORTED)) exit_unsupported () { kill -s $SIG_UNSUPPORTED $SIG_PID - exit 0 + exit $ksft_skip } trap 'SIG_RESULT=$UNSUPPORTED' $SIG_UNSUPPORTED -- 2.14.1