Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp388393imm; Thu, 10 May 2018 23:09:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZowh3tDOmcpfxeEberYzPeYzmkgQpkM8Tx6fCzeSbx/1VVQYQcOGWVmLQj9JKvn7wP5GXHL X-Received: by 2002:a17:902:da4:: with SMTP id 33-v6mr4191762plv.52.1526018998916; Thu, 10 May 2018 23:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526018998; cv=none; d=google.com; s=arc-20160816; b=HoHCZuhYFbwzdvTEc95QeucFj8Gw5hrxIVK1TnZY1xpUVDC8P7hDf3d11VKQb6prJb pXh47WG/dCCVavmDeIxmn6Fp4Gj8UJ4Ut2amF01mTu6ur7fXCMwLw6efF8SSRLwhHdkK rvZWUokgVnKMH32t4hXPJ+gPzO4LK2f+KkIkqA51ha7g3wNB7cncKrFhA5uyie06ejSK T0l8qVjZjWhX6jvN/u6sVhMJJmtNoWsXYkKoGEDM7RxSwDhKexVcOWAQlth514P7Hdzf Mz7uaz8f6KO4O2zffDo/xNRJHyDRHhY8om5SGpuhRtpPDiT3yvZrDM6P4jO9GkTvyskZ F9xQ== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=tsXrahem4ro0tt2AXnMZDqCB8VAVMrlLrc84SMOgO1c=; b=E3fcyvJz4R0tE4r0NZeMB3g0jBUGZiEEAsGNWL4U1/Gx+SzgcvqCYzQHsG2KPK+8MI Y9MidaAGkCo5aUoTo23+FLnU1AEcZ+ZPg/wPa4QfXtDX7jngcoinlwsbar2iH/jwnua/ c/bXNN58Kn3oa2wwjG/c5xyZeMljJpP4MOc+jmFRH61fafnznRJ3epBRp/DypxX/4yi9 Vwtxnpy5c3er+qHAo4vWkFzibfRPmqtjUvO9hdEi4Ccu5fzwPi7eV3l+4bg0IUYTkUJG pXIRkbggjoJjjko4KqpwWVwkgYeroVNKrdrNgvHP4IarwzCq3fZZUD+Ba3EBdRNe1bSt WD2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M/Q1oX7v; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5-v6si2522894ply.598.2018.05.10.23.09.44; Thu, 10 May 2018 23:09: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; dkim=pass header.i=@kernel.org header.s=default header.b=M/Q1oX7v; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752209AbeEKGJd (ORCPT + 99 others); Fri, 11 May 2018 02:09:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:52082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750805AbeEKGJc (ORCPT ); Fri, 11 May 2018 02:09:32 -0400 Received: from devbox (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A0D220779; Fri, 11 May 2018 06:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526018971; bh=643AKDebMnPlxnR5IN+joM44eSAfRjbn66X2d3KcFAU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=M/Q1oX7vEZQIjNHspYtoOckcFw3JcAJAHOFW+qyBKQt7NXA76ltRPHNj66KgFH3cQ dK5Va3PQvmk27b+QuaenxRpt5w4PHOan4aUWKjO9o73ZqXTIHIpnEMs0U8fEkWYZsp GSKLTKV5PJNb/XFhkWaeSDWI2Yl7rHzV63x6TJf8= Date: Fri, 11 May 2018 15:09:28 +0900 From: Masami Hiramatsu To: Shuah Khan Cc: rostedt@goodmis.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/24] selftests: ftrace: return Kselftest Skip code for skipped tests Message-Id: <20180511150928.6e9b5fb7fdf9a90b4720a575@kernel.org> In-Reply-To: <34a4aa44-75f0-b868-cfc8-37fc716af0a5@kernel.org> References: <20180505011328.32078-1-shuah@kernel.org> <20180505011328.32078-9-shuah@kernel.org> <20180508123812.874ff8d2a22abd62148b293d@kernel.org> <34a4aa44-75f0-b868-cfc8-37fc716af0a5@kernel.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 10 May 2018 14:18:16 -0600 Shuah Khan wrote: > 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" No, that is an opposite option... it makes UNSUPPORTED result as a failure. What the option we need is to ignore UNSUPPORTED results because it is expected. > Is there a need for another. This indicates that the default > mode is UNSUPPORTED isn't a failure. Right, currently UNSUPPORTED/UNRESOLVED/UNTESTED are not 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 Ah, I missed to remove the last "-o" > > + exit 2 > > +elif [ $FAILED_CASES -ne 0 -o ]; then # FAILs ditto. Thanks, > > + exit 1 > > +else # PASS > > + exit 0 > > +fi > > > > Thanks for pointing out the right change to make. > > -- Shuah > -- Masami Hiramatsu