From patchwork Mon Nov 25 06:57:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 11259891 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B4F80138C for ; Mon, 25 Nov 2019 06:57:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9532A20679 for ; Mon, 25 Nov 2019 06:57:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574665051; bh=8NJZ4ecKYsAsn8f0rkIBPL4Q6ni1vDuY2huK9s6nGEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vqxgPxbd9A8IqkZthyk8vGD87P1nvTf8yAq2aodyUQ/T2nWdt61Y+dt3qtpiXPx6w GDGTa1CqnXBbQwkXMW2M4fz/TyMnN4S6rLhWDPaS11pnPt7OLF05bJUjxzWple4WwO Hfiakv9BaA1oHln9rsgEnwS0xEtCQYJvBMRLAcuU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727173AbfKYG5b (ORCPT ); Mon, 25 Nov 2019 01:57:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:33144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725823AbfKYG5b (ORCPT ); Mon, 25 Nov 2019 01:57:31 -0500 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (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 8FE1520835; Mon, 25 Nov 2019 06:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574665050; bh=8NJZ4ecKYsAsn8f0rkIBPL4Q6ni1vDuY2huK9s6nGEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EeXJIKBht3llg+C28rDTz8jf1qp+AoBfCKyJ+axwXorkOaaF3ZnVGhHXyjKygzTEr TuodLxfwRXh4cYSzZvozSpqng3uBTjkR4dyrrPXRuo77EOWzvLIV+VABq5cd4+KcMA S38BxMwnr/lM1kdgjNjjwnIzcBOgV3EC3MRsefu0= From: Masami Hiramatsu To: Shuah Khan , Steven Rostedt Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BUGFIX PATCH v3 4/4] selftests/ftrace: Fix multiple kprobe testcase Date: Mon, 25 Nov 2019 15:57:27 +0900 Message-Id: <157466504736.21973.15722652829669648396.stgit@devnote2> X-Mailer: git-send-email 2.20.1 In-Reply-To: <157466501169.21973.31401747181477687.stgit@devnote2> References: <157466501169.21973.31401747181477687.stgit@devnote2> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Fix multiple kprobe event testcase to work it correctly. There are 2 bugfixes. - Since `wc -l FILE` returns not only line number but also FILE filename, following "if" statement always failed. Fix this bug by replacing it with 'cat FILE | wc -l' - Since "while do-done loop" block with pipeline becomes a subshell, $N local variable is not update outside of the loop. Fix this bug by using actual target number (256) instead of $N. Signed-off-by: Masami Hiramatsu Reviewed-by: Steven Rostedt (VMware) --- .../ftrace/test.d/kprobe/multiple_kprobes.tc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc index 5862eee91e1d..6e3dbe5f96b7 100644 --- a/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc +++ b/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc @@ -20,9 +20,9 @@ while read i; do test $N -eq 256 && break done -L=`wc -l kprobe_events` -if [ $L -ne $N ]; then - echo "The number of kprobes events ($L) is not $N" +L=`cat kprobe_events | wc -l` +if [ $L -ne 256 ]; then + echo "The number of kprobes events ($L) is not 256" exit_fail fi