From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3B226457A3; Mon, 12 Aug 2024 19:32:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0966F4028C; Mon, 12 Aug 2024 19:32:32 +0200 (CEST) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by mails.dpdk.org (Postfix) with ESMTP id 67DC54027B for ; Mon, 12 Aug 2024 19:32:30 +0200 (CEST) Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2ef2e37a171so8746221fa.2 for ; Mon, 12 Aug 2024 10:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1723483950; x=1724088750; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oMGxtB2m+wa0uTB05vzulLU1HOSPWT1Wnw9zyPgFMac=; b=XqMPxx1KfeVPvt4uUGv10k/FsDrRlg5st0d7EdQw6de4y60dOdF8lbLdBZrXrfZ7+m TziidiYr+R1ywGqAPdfmYR/YoyiY00g1sCFL5CQfBXcOUQSbhVAoLERWX+ifPxZcrIXf eWMJVln9KtIXH5ae5ybUoboH0rWW0HsT9OMAY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723483950; x=1724088750; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oMGxtB2m+wa0uTB05vzulLU1HOSPWT1Wnw9zyPgFMac=; b=ThBNnWR/CrvvsUV6ebMO0C9888defYzivHaNjGr0P/w6WhpqEefXvGGBLXkpmRpcN6 GiWN+K5sIrcLRdN4J+/1p2p5DUAo+9GIdcsEmbii7btdQu3INKWL1aHvBEmdpaK3F7DC H7skUdTf4XQcoH8j1pilAU9MwG7WqPo8UJSYxBYzm5iD/ZfrXeTSzawd7kYjD4F3i8zC vigDJD6cvrbvULq6pHiO5yDqnsFG+dlasUQxWvrNemvhIwDRax3LoKiq2WMZhw+IbQs8 RpRfdjzqTJeVMsob/hfJ3rrDaYwPQeZqLxWV6euWZG5VnYNcBUTuj971qDjano19hQWc hojw== X-Forwarded-Encrypted: i=1; AJvYcCVITyuYJfpags939qRuj3nSQm3iev9lqHoN+KN9Tt/G7fL1xZoY6Dk6VrTHuQNe4gR8Zd4=@dpdk.org X-Gm-Message-State: AOJu0YxBttjf50FsIGt/NilQY/cFr3ez81Y+QNfwZ1DaDyAtYHaWQN9H uWG6KTyuM2mTArZMDK8NONxQNF2DYp/Ez2VQhgvK/IPI+hW8AylVQ3RQTsxafENm3TJ2ZLNanko nPpowzRGfaLiipjrVXhOp41hupByBxkIrmMG2dw== X-Google-Smtp-Source: AGHT+IHA37wV6u3gn/DMSjmeukuvi9kvmHvjZb8rJOytdMVN5aK/GSMq+MFw6WbwudxmfGRC4olWkXZPuHFbSHRmKnM= X-Received: by 2002:a2e:bc1c:0:b0:2f1:5ae2:8589 with SMTP id 38308e7fff4ca-2f2b714bc72mr4176761fa.2.1723483949565; Mon, 12 Aug 2024 10:32:29 -0700 (PDT) MIME-Version: 1.0 References: <20240729203955.267942-1-jspewock@iol.unh.edu> <20240808203612.329540-1-jspewock@iol.unh.edu> <20240808203612.329540-2-jspewock@iol.unh.edu> In-Reply-To: From: Nicholas Pratte Date: Mon, 12 Aug 2024 13:32:18 -0400 Message-ID: Subject: Re: [PATCH v3 1/1] dts: add text parser for testpmd verbose output To: Jeremy Spewock Cc: thomas@monjalon.net, yoan.picchi@foss.arm.com, paul.szczepanek@arm.com, Honnappa.Nagarahalli@arm.com, probb@iol.unh.edu, wathsala.vithanage@arm.com, Luca.Vizzarro@arm.com, juraj.linkes@pantheon.tech, alex.chapman@arm.com, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Great work! I think it'd be fine to just keep if you ask me, I could see this being used in the future. I'm also looking at it from the perspective of 'what if i would have to write this myself,' if it turns out that we need it again for something later. It's easier to remove later if it turns out we aren't using it, but it'd likely be more time-consuming to remove it now and implement it again later, considering that time has already been spent testing and building it. On Thu, Aug 8, 2024 at 5:49=E2=80=AFPM Jeremy Spewock wrote: > > On Thu, Aug 8, 2024 at 4:36=E2=80=AFPM wrote: > > > > From: Jeremy Spewock > > > > Multiple test suites from the old DTS framework rely on being able to > > consume and interpret the verbose output of testpmd. The new framework > > doesn't have an elegant way for handling the verbose output, but test > > suites are starting to be written that rely on it. This patch creates a > > TextParser class that can be used to extract the verbose information > > from any testpmd output and also adjusts the `stop` method of the shell > > to return all output that it collected. > > > > Signed-off-by: Jeremy Spewock > > --- > > dts/framework/parser.py | 30 ++ > > dts/framework/remote_session/testpmd_shell.py | 405 +++++++++++++++++- > > dts/framework/utils.py | 1 + > > 3 files changed, 434 insertions(+), 2 deletions(-) > > > > diff --git a/dts/framework/parser.py b/dts/framework/parser.py > > index 741dfff821..0b39025a48 100644 > > --- a/dts/framework/parser.py > > +++ b/dts/framework/parser.py > > @@ -160,6 +160,36 @@ def _find(text: str) -> Any: > > > > return ParserFn(TextParser_fn=3D_find) > > > > + @staticmethod > > + def find_all( > > I just realized that I forgot to take this method out since it is no > longer used in this patch now that I removed the idea of a block of > output that contains a burst of packets. The method could still be > useful in the future, but it isn't used anywhere now, so I can remove > it in the next version if no one sees a use for it. I'm also open to > leaving it there for the "just in case" it is needed in the future. > What do you all think? > > > + pattern: str | re.Pattern[str], > > + flags: re.RegexFlag =3D re.RegexFlag(0), > > + ) -> ParserFn: > > + """Makes a parser function that finds all of the regular expre= ssion matches in the text. > > + > > + If there are no matches found in the text than None will be re= turned, otherwise a list > > + containing all matches will be returned. Patterns that contain= multiple groups will pack > > + the matches for each group into a tuple. > > + > > + Args: > > + pattern: The regular expression pattern. > > + flags: The regular expression flags. Ignored if the given = pattern is already compiled. > > + > > + Returns: > > + A :class:`ParserFn` that can be used as metadata for a dat= aclass field. > > + """ > > + if isinstance(pattern, str): > > + pattern =3D re.compile(pattern, flags) > > + > > + def _find_all(text: str) -> list[str] | None: > > + m =3D pattern.findall(text) > > + if len(m) =3D=3D 0: > > + return None > > + > > + return m > > + > > + return ParserFn(TextParser_fn=3D_find_all) > > + > > > 2.45.2 > >