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 4D1474576F; Thu, 8 Aug 2024 23:49:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3A62042D99; Thu, 8 Aug 2024 23:49:18 +0200 (CEST) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mails.dpdk.org (Postfix) with ESMTP id D6B64402C4 for ; Thu, 8 Aug 2024 23:49:17 +0200 (CEST) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1fd640a6454so13795595ad.3 for ; Thu, 08 Aug 2024 14:49:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1723153757; x=1723758557; 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=S7kf8pbrKWOxvIza1IJQIYMshpUtJRZA+q8yMHV1QDs=; b=EMCCY3zmnytjZTy1loVj1Bj4f8/ZBaQ0sw5hKLY8CMPRJ6oMGiDq9or67whI0oAzuL MS6WLNh7D9hOFI8RuMdeKhGwf0mnHQDsso44+FQ4WEFm+wHRwJOLK4WXdVMQ2CFwJZsJ IlhkpTxP91wN6sJJDZ7Jzud7N0Hq5rYAjT7Jk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723153757; x=1723758557; 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=S7kf8pbrKWOxvIza1IJQIYMshpUtJRZA+q8yMHV1QDs=; b=Y+6Xyj9KbRLBFSZvtbF3ZPjfDOZKIm1ISxA1L9GsPTDjCsmdc5rfEzLZMnK+lsyJqO 6G65t/2Jej1hxQaewVKvorvTTLFwGWfUBro1WqKl0QsqX0aNE58ohncF2ml5HACsVdwE ssOOMFgdJErWk7hMwrbjGwamHP+vVgzPEYP+sNyj60nnsA1XNYKR3DVnnaUamqtT+7pM 0CtxBzkzUl+TDeufAgA+tegckCHXZWL43B7A6IY4YK6b0Z1Y2K5AecQy4hPrwGO3Qu/A ndGFzA1noC4owLY+cmpRgf2qtF89/qIL+80CyYqoB3Rb7vx7wNvFl993LCW4kqpQY0kA UPXg== X-Gm-Message-State: AOJu0YwOSobvEDE/jIIvTaQ8CaKwzLFIKEOq7WLYWRIUk+szzomNqmGC VfKOfhnKPH/aSt76a3dJvkiqDL5CoNVSHusaZ3qYC2/E/571nWTt5+/HBE9/EazdDqF8ULtNdAI guhcS3hPO3gPenYW/HA4TfLl9jscy7JY/oY8rMAEs182U9kOu X-Google-Smtp-Source: AGHT+IHC4i3MmK0FZVl3SqQuAXjDifKk16T5MgcacP2343XZ14kzQRr2ObqtBFAxVgtrDrSXknYuQx4rYSaPGEJQOCM= X-Received: by 2002:a17:903:1ce:b0:1fd:cda0:2f4c with SMTP id d9443c01a7336-2009523df4dmr49329445ad.18.1723153756819; Thu, 08 Aug 2024 14:49:16 -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: <20240808203612.329540-2-jspewock@iol.unh.edu> From: Jeremy Spewock Date: Thu, 8 Aug 2024 17:49:05 -0400 Message-ID: Subject: Re: [PATCH v3 1/1] dts: add text parser for testpmd verbose output To: 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, npratte@iol.unh.edu, alex.chapman@arm.com Cc: 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 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 express= ion matches in the text. > + > + If there are no matches found in the text than None will be retu= rned, otherwise a list > + containing all matches will be returned. Patterns that contain m= ultiple 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 pa= ttern is already compiled. > + > + Returns: > + A :class:`ParserFn` that can be used as metadata for a datac= lass 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 >