Received: by 10.192.165.148 with SMTP id m20csp1598862imm; Thu, 10 May 2018 13:18:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrMOKcQDhVtTchnh5qvgR5llrVQLmAtj85VELDknOTC1oEFnvhI/EaOpWxeh4TflPRzeR87 X-Received: by 2002:a65:4e03:: with SMTP id r3-v6mr2229478pgt.121.1525983538156; Thu, 10 May 2018 13:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525983538; cv=none; d=google.com; s=arc-20160816; b=nmjdGn83WM+R4t0rC07MAzSmMERLPe3PHK3XeQ8FH5pAZRzk0P4b9Yu8NQh9fmzrud Mb0aU5EKuZYGQMn4XzmVlrK89AasIOYjdZD8fUAjoMAt1Rbnu1mPTuub+7sy6RbaamWX sBPlsxCyuGHGQBxH6PqCHhcn40ks96bdG9IlBxBvOHadQ69ziSfGNfHb+t0yHoRU8J7l tzQeB7z0arQvLw6PsWzaA1mqtyCuBhVa/A3zUDsRQsMNOs9QBWK8fgC+kdVanzVBki0o +bdJPRpUglqlw1nPgT5X0HHxgjQf5aerwx6b48Xfj08UaV9hjhwQA3lyDoR1U8AgSwFt CcCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=bpMbi3/Ep99LjM9j2p401wpLuJlzE0kp2f8QQiG9Sjw=; b=ATW576QrfHdMgCGcFZ2M45tZrAqKaePD6zvrwkUMV9x1x7pBuqmOAUcQq5SnyM7KB5 oHRwnU0Z7rP0xR/CCIiTGAGbHRF1nS9wHWjYtWdxokTrA39+EjeALdh57LUaWavVFogp f9Itnzlt6KnV6S1zjwoSqKLf1+l8dB37vBgd7+IO8PSLaTyJIxB6hXSxb9f2hSYRgAgg L9niy90lzx13h72IOz4+hvxNJ1HVFHSIYObU6mU2HvSiX5+0cmFr0WpbHA4occUQLNk5 Fu4aL6rJ/QkYIrCdFfK6pQW8ym+NV8l6MrRrQ5jI9dpPpddzFW+15erEbmNfRFpQEVwO RSQA== 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 u10-v6si1250798pgr.642.2018.05.10.13.18.43; Thu, 10 May 2018 13:18:58 -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 S1752382AbeEJUS0 (ORCPT + 99 others); Thu, 10 May 2018 16:18:26 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:53498 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752104AbeEJUSZ (ORCPT ); Thu, 10 May 2018 16:18:25 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 60CCAC13E6; Thu, 10 May 2018 20:18:24 +0000 (UTC) Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo01-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jJM39M5X1OAN; Thu, 10 May 2018 20:18:24 +0000 (UTC) Received: from [192.168.1.87] (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 78D00C1363; Thu, 10 May 2018 20:18:16 +0000 (UTC) Subject: Re: [PATCH 09/24] selftests: ftrace: return Kselftest Skip code for skipped tests To: Masami Hiramatsu Cc: rostedt@goodmis.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan References: <20180505011328.32078-1-shuah@kernel.org> <20180505011328.32078-9-shuah@kernel.org> <20180508123812.874ff8d2a22abd62148b293d@kernel.org> From: Shuah Khan Message-ID: <34a4aa44-75f0-b868-cfc8-37fc716af0a5@kernel.org> Date: Thu, 10 May 2018 14:18:16 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180508123812.874ff8d2a22abd62148b293d@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Masami, On 05/07/2018 09:38 PM, Masami Hiramatsu wrote: > On Fri, 4 May 2018 19:13:13 -0600 > "Shuah Khan (Samsung OSG)" wrote: > >> 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 > > This should return 0. If you want to change the result code, > you have to change the last part as below. > (Note that we need a switch option of return code, so that > ftracetest user can continue to use same way...) Doesn't this existing option take care of this: --fail-unsupported Treat UNSUPPORTED as a failure" Is there a need for another. This indicates that the default mode is UNSUPPORTED isn't a failure. > > diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest > index f9a9d424c980..d6ce56a2a937 100755 > --- a/tools/testing/selftests/ftrace/ftracetest > +++ b/tools/testing/selftests/ftrace/ftracetest > @@ -326,5 +326,15 @@ prlog "# of unsupported: " `echo $UNSUPPORTED_CASES | wc -w` > prlog "# of xfailed: " `echo $XFAILED_CASES | wc -w` > prlog "# of undefined(test bug): " `echo $UNDEFINED_CASES | wc -w` > > -# if no error, return 0 > -exit $TOTAL_RESULT > +# following kselftest result code > +if [ $UNSUPPORTED_CASES -ne 0 -o \ > + $UNTESTED_CASES -ne 0 -o \ > + $UNRESOLVED_CASES -ne 0]; then # There are skipped tests > + exit 4 > +elif [ $XAILED_CASES -ne 0 -o ]; then # XFAILs > + exit 2 > +elif [ $FAILED_CASES -ne 0 -o ]; then # FAILs > + exit 1 > +else # PASS > + exit 0 > +fi > Thanks for pointing out the right change to make. -- Shuah