Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1932182ima; Thu, 25 Oct 2018 07:13:14 -0700 (PDT) X-Google-Smtp-Source: AJdET5eIBWUl9ItnyJ/ZgrTIWfvlllEak47Bz+QYxfhEMA6LL2wPazh90hsdTTUvr8wRFyOhxSXG X-Received: by 2002:a63:1765:: with SMTP id 37-v6mr1657328pgx.131.1540476794534; Thu, 25 Oct 2018 07:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540476794; cv=none; d=google.com; s=arc-20160816; b=ASUPACiSgLLGWll9winD6vtRUtVXOhKOexzaEzy5X91A855UYyfKu6485VliCSmmO7 xjnyV4+u4LIBhiX/XXh1425ZELI7BFVFSUmXHVW7NwJxfOHvrpDkT9r708crkCL5Vz/q aFsFBrmbUGkiOZwyjXVKWaxbYFKwx9wR8aD1KCQWFTz1USArKMGjbKHkYfKLImUO8UAk I9ytHJ/XMa9Fv0DWBe5aH93zBMPZ/nyH4A5i06Bnbr5JBG5Pf4GMLcwB9aTEcBSFmuQ7 xH/8813++hO/4KamMsNug5XrCZLVq7156TVmpTFlMpOmpdnzkPqBWhyMLPT7FaeYfayN oFXg== 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:dkim-signature; bh=j1nG9H9mi3swZJKxsCgjgkD8gGSnlr9IAVcN4lDkpCs=; b=rDP7m6o4W5QtVb43GOGG301KwQtbvyTh1ixJBZ4eaaH0rnT4z+gfEvE63B21oBWMsv spgpgk9Qvbq+Ls5TaE7Es8EgIgU/6uXocrsGvs3CnvFcelf+ahV3BF2Rf5ZCQVbx61bH E/cHnGJPID8Pcx0K36jFMDTbA7EcaSxcgRjrzUTf9yhfjlXu1JUc+A5GZ0yKGp2Xw9lu EqbnZsFTS7QBCupmiHvxgiMrtTF+LC6EwMR25QQM087YpbAvgL9RG6Sluu3X5owFae5Y 3fUU6oHxPLQ1f0nDd0AlN/Om3+hFVJjYJvPWwTKW8zMaQnrL9Opft6vpZtz73vGJM7YH +Pqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BMsg7lmr; 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 h4-v6si8091656pgj.507.2018.10.25.07.12.48; Thu, 25 Oct 2018 07:13:14 -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=BMsg7lmr; 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 S1728486AbeJYWo4 (ORCPT + 99 others); Thu, 25 Oct 2018 18:44:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:54104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728299AbeJYWoz (ORCPT ); Thu, 25 Oct 2018 18:44:55 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5175720848; Thu, 25 Oct 2018 14:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476720; bh=PmG9L0S4y9Oy9AEHc2GkBC46j3sxZ+6tY+MxieGHUDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BMsg7lmrXDgI/st3fEBaLPm2NQo4hrl801JuscdErw06YQWyDSKqohzMwQ70wnCs0 GEyCDECtdBzTr2Wm7VAvBexuvkBbioM5qNLPINdEEPLyib+vVdqkIAB8Pd8TA/5sy6 7IxguPVTxptKiT2Aa1ucLJSMoLTLCYd+PIOMN7Qk= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sandipan Das , Heiko Carstens , Hendrik Brueckner , Jiri Olsa , Martin Schwidefsky , "Naveen N . Rao" , Ravi Bangoria , Thomas Richter , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH AUTOSEL 4.14 46/46] perf tests: Fix indexing when invoking subtests Date: Thu, 25 Oct 2018 10:10:53 -0400 Message-Id: <20181025141053.213330-46-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141053.213330-1-sashal@kernel.org> References: <20181025141053.213330-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sandipan Das [ Upstream commit aa90f9f9554616d5738f7bedb4a8f0e5e14d1bc6 ] Recently, the subtest numbering was changed to start from 1. While it is fine for displaying results, this should not be the case when the subtests are actually invoked. Typically, the subtests are stored in zero-indexed arrays and invoked based on the index passed to the main test function. Since the index now starts from 1, the second subtest in the array (index 1) gets invoked instead of the first (index 0). This applies to all of the following subtests but for the last one, the subtest always fails because it does not meet the boundary condition of the subtest index being lesser than the number of subtests. This can be observed on powerpc64 and x86_64 systems running Fedora 28 as shown below. Before: # perf test "builtin clang support" 55: builtin clang support : 55.1: builtin clang compile C source to IR : Ok 55.2: builtin clang compile C source to ELF object : FAILED! # perf test "LLVM search and compile" 38: LLVM search and compile : 38.1: Basic BPF llvm compile : Ok 38.2: kbuild searching : Ok 38.3: Compile source for BPF prologue generation : Ok 38.4: Compile source for BPF relocation : FAILED! # perf test "BPF filter" 40: BPF filter : 40.1: Basic BPF filtering : Ok 40.2: BPF pinning : Ok 40.3: BPF prologue generation : Ok 40.4: BPF relocation checker : FAILED! After: # perf test "builtin clang support" 55: builtin clang support : 55.1: builtin clang compile C source to IR : Ok 55.2: builtin clang compile C source to ELF object : Ok # perf test "LLVM search and compile" 38: LLVM search and compile : 38.1: Basic BPF llvm compile : Ok 38.2: kbuild searching : Ok 38.3: Compile source for BPF prologue generation : Ok 38.4: Compile source for BPF relocation : Ok # perf test "BPF filter" 40: BPF filter : 40.1: Basic BPF filtering : Ok 40.2: BPF pinning : Ok 40.3: BPF prologue generation : Ok 40.4: BPF relocation checker : Ok Signed-off-by: Sandipan Das Reported-by: Arnaldo Carvalho de Melo Tested-by: Arnaldo Carvalho de Melo Cc: Heiko Carstens Cc: Hendrik Brueckner Cc: Jiri Olsa Cc: Martin Schwidefsky Cc: Naveen N. Rao Cc: Ravi Bangoria Cc: Thomas Richter Fixes: 9ef0112442bd ("perf test: Fix subtest number when showing results") Link: http://lkml.kernel.org/r/20180726171733.33208-1-sandipan@linux.ibm.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/tests/builtin-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 5966f1f9b160..1c9bc3516f8b 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -375,7 +375,7 @@ static int test_and_print(struct test *t, bool force_skip, int subtest) if (!t->subtest.get_nr) pr_debug("%s:", t->desc); else - pr_debug("%s subtest %d:", t->desc, subtest); + pr_debug("%s subtest %d:", t->desc, subtest + 1); switch (err) { case TEST_OK: @@ -589,7 +589,7 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) for (subi = 0; subi < subn; subi++) { pr_info("%2d.%1d: %-*s:", i, subi + 1, subw, t->subtest.get_desc(subi)); - err = test_and_print(t, skip, subi + 1); + err = test_and_print(t, skip, subi); if (err != TEST_OK && t->subtest.skip_if_fail) skip = true; } -- 2.17.1