Re: [PATCH 4/5] dts: add `show port info` command to TestPmdShell

2024-04-18 Thread Luca Vizzarro
On 18/04/2024 07:41, Juraj Linkeš wrote: The equivalent /\n\*.+?(?=\n\*|$)/gs (but slightly more optimised) takes approximately 3*input_length steps to run (according to regex101 at least). If that's reasonable enough, I can do this: iter = re.finditer(input, "\n\*.+?(?=\n\*|$)", re.S) r

Re: [PATCH 4/5] dts: add `show port info` command to TestPmdShell

2024-04-17 Thread Juraj Linkeš
On Wed, Apr 17, 2024 at 5:29 PM Luca Vizzarro wrote: > > On 17/04/2024 15:25, Luca Vizzarro wrote: > > On 17/04/2024 14:22, Juraj Linkeš wrote: > >>> I'll > >>> experiment with some look ahead constructs. The easiest solution is to > >>> match everything that is not * ([^*]+) but can we be certain

Re: [PATCH 4/5] dts: add `show port info` command to TestPmdShell

2024-04-17 Thread Luca Vizzarro
On 17/04/2024 15:25, Luca Vizzarro wrote: On 17/04/2024 14:22, Juraj Linkeš wrote: I'll experiment with some look ahead constructs. The easiest solution is to match everything that is not * ([^*]+) but can we be certain that there won't be any asterisk in the actual information? We can't. But

Re: [PATCH 4/5] dts: add `show port info` command to TestPmdShell

2024-04-17 Thread Luca Vizzarro
On 17/04/2024 14:22, Juraj Linkeš wrote: I agree that it looks much better. I gave it a first attempt to come up with a regular expression that is not too complicated and is able to match blocks individually. I've noticed that blocks start with: \n* Infos for port X but

Re: [PATCH 4/5] dts: add `show port info` command to TestPmdShell

2024-04-17 Thread Juraj Linkeš
On Tue, Apr 16, 2024 at 2:24 PM Luca Vizzarro wrote: > > On 16/04/2024 10:03, Juraj Linkeš wrote: > >> +@dataclass > >> +class TestPmdPort(TextParser): > > > > This and the classes above are missing docstrings. > > Ack. > > >> @@ -225,6 +664,38 @@ def set_forward_mode(self, mode: > >> TestPmdForw

Re: [PATCH 4/5] dts: add `show port info` command to TestPmdShell

2024-04-16 Thread Luca Vizzarro
On 16/04/2024 10:03, Juraj Linkeš wrote: +@dataclass +class TestPmdPort(TextParser): This and the classes above are missing docstrings. Ack. @@ -225,6 +664,38 @@ def set_forward_mode(self, mode: TestPmdForwardingModes, verify: bool = True): f"Test pmd failed to set fwd mo

Re: [PATCH 4/5] dts: add `show port info` command to TestPmdShell

2024-04-16 Thread Juraj Linkeš
On Fri, Apr 12, 2024 at 1:11 PM Luca Vizzarro wrote: > > Add a new TestPmdPort data structure to represent the output > returned by `show port info`, which is implemented as part of > TestPmdShell. > > The TestPmdPort data structure and its derived classes are modelled > based on the relevant test