Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp924656pxb; Wed, 27 Oct 2021 15:19:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxh/Vihg7sSlXlgZLPtykeqNdMw3I4fpJhMZm4WsY/XyMC/oShVwlk24G4yNX955MM8i+KU X-Received: by 2002:a17:90a:cc05:: with SMTP id b5mr401082pju.71.1635373182204; Wed, 27 Oct 2021 15:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635373182; cv=none; d=google.com; s=arc-20160816; b=L3I2BgCi4wjpJIDBDLRfzTcoIzs9SnlxG9rob81avWp3k5wqcG0kHHwmFPpNlmur2U SQSdVVPUUpB+Y3yXJv3Fx16pn3bM7+2T0JpYS6MEZN2DgezfCZrDOrYDi6a32Wolsts5 uj44ILx0hcXolqH+nG7GYfb89ITZg3aITUZ/qRvixTDbYXPOSKvrBNyHNAV9nNckhjE6 Fnv+zn2I3FSVlpCVuPPopHoTXMykjoV4Fi2c4TvWYgj6+EuB5WeTIzru4TiD68fGLMJ1 aHPhWdQVjn6HdSXMzNQJrb1znDQHbiZBEKT3XQoAv/Uu9oHlKNgB6FEhkvyoXOPEhWac V/Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=q2wN8KCchBm1pRgcCT8SPYsU7JXnpkUAt+LUKaPKpgo=; b=jllX9El/5sZVANURZr2+Mu77xFPqou0XU9vQcxKcmEhPoG44xgZBFYkagI1g2T1Oz8 YqwiLUzDbRxHljUvJsqJ6a2RU3HaBTaTnJ02XFKdsxjKX8GfDcnd6Pf4bnZotz2HzYYB bzINrWP7dgPLq12tSOswh+kJPcoVnjB+jRF/sIX6W9oEMfVD1hyY+JsXo5Aw3BhKkTOK V3ZDjMjSjvM3iW3A4xHwAcm2nqnH7LCO1s4HOxgcTdBPNiTvpo5NhAm4bqAEGobxGaot Xnk+T6n3u8G4CefUeb9gRTNczEFW39hY/ol8SFAPqm7r8OPPvcwyZa8002TF7eKmEinl FozA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m25vswBw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id z9si450539plg.431.2021.10.27.15.19.30; Wed, 27 Oct 2021 15:19:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m25vswBw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229868AbhJ0WBU (ORCPT + 99 others); Wed, 27 Oct 2021 18:01:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:45262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229830AbhJ0WBT (ORCPT ); Wed, 27 Oct 2021 18:01:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F01A3610A6; Wed, 27 Oct 2021 21:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635371934; bh=R8YhZO5s1uz5ekNzWYz3BaLvSkHoIbKUHbDXl3Jhvwk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=m25vswBwUn9xA7vOoqQN3oL5TwZz4VDAvswlOUoiw1Ssx5b44Me+jdaZfdpoP8V8f 9sLi0dML9i3lDn68cwc62Z3fHin5Cmfqe2mP7gMDQ2SlryyZWsxoRDNeoIGe9RdqfH iZ9MS76NQsiOk5PB0c5g1Kyk9hA6wJzvxoaIWeuW8zTIo3r5u5AI6p1ct31XaX57Z0 eMXLcMXnGF4b1FhFFMWMN7gg4ElbgZIPJ/zmq0+nZmcEN79PyfQnySTOYiSfV3JBFC 7wipp0cJjjDnrnL+6q5to7nTXAK8qMhi1CIx+e9wvqcW969yDcSnhxI6uoEMpeDg1Y CVIWguIXjuOxQ== Date: Thu, 28 Oct 2021 06:58:49 +0900 From: Masami Hiramatsu To: Kalesh Singh Cc: surenb@google.com, hridya@google.com, namhyung@kernel.org, kernel-team@android.com, rostedt@goodmis.org, mhiramat@kernel.org, Ingo Molnar , Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 2/3] tracing/kselftests: Remove triggers with references before their definitions Message-Id: <20211028065849.76b1bd7151e440881298b523@kernel.org> In-Reply-To: <20211027205919.1648553-3-kaleshsingh@google.com> References: <20211027205919.1648553-1-kaleshsingh@google.com> <20211027205919.1648553-3-kaleshsingh@google.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kalesh, On Wed, 27 Oct 2021 13:59:09 -0700 Kalesh Singh wrote: > If an event trigger references a variable defined in another trigger, it > has to be removed before the trigger that defines the variable is > removed. > > Signed-off-by: Kalesh Singh > --- > tools/testing/selftests/ftrace/test.d/functions | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions > index 000fd05e84b1..bd9e85f4d626 100644 > --- a/tools/testing/selftests/ftrace/test.d/functions > +++ b/tools/testing/selftests/ftrace/test.d/functions > @@ -22,6 +22,15 @@ reset_trigger_file() { > file=`echo $line | cut -f1 -d:` > echo "!$cmd" >> $file > done > + > + # remove triggers with references next > + grep -H '\$' $@ | > + while read line; do > + cmd=`echo $line | cut -f2- -d: | cut -f1 -d"["` > + file=`echo $line | cut -f1 -d:` > + echo "!$cmd" >> $file > + done > + Why don't you use 'tac'? I love that idea :) Did you find any issue? I think the function which cleaning up the tracing file should use the 'tac' rollback method, because it is natural, simple and robust. Then the first loop for removing action triggers is not needed anymore. Thank you, > grep -Hv ^# $@ | > while read line; do > cmd=`echo $line | cut -f2- -d: | cut -f1 -d"["` > -- > 2.33.0.1079.g6e70778dc9-goog > -- Masami Hiramatsu