Re: [PATCH 2/2] perf test shell: make perf inet_pton test more portable

From: Michael Petlan
Date: Thu Jun 28 2018 - 16:36:48 EST


On Thu, 21 Jun 2018, Arnaldo Carvalho de Melo wrote:
Em Thu, Jun 21, 2018 at 11:19:15AM -0300, Arnaldo Carvalho de Melo escreveu:
Em Wed, Jun 20, 2018 at 07:45:46PM -0500, Kim Phillips escreveu:
On Wed, 20 Jun 2018 10:46:22 -0300
Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
[...]

Would be good if we had some utility that given a two files, one with
regexps, could tell if, line by line, those expressions matched, better,
one that is present in all these OSes...

I have struggled with this too [1], [2]. I use perl, not sure if it is
all-distro-compliant, probably not, but anyway...

To have:
- regexps generic enough (e.g. to parse "casual perf-script output line")
- regexps adjustable to concrete needs
- regexps to be understandable as much as possible
---> I have $RE_SOMETHING, e.g. RE_LINE_REPORT_CONTENT, such as in [2],
and some primitives which I make the more concrete regexps from, such
as $RE_EVENT_ANY, $RE_PATH, etc. going into e.g.:
REGEXP_STAT_LINE="^\s+$RE_NUMBER\s+$RE_EVENT_ANY\s*"

- various utilities:
- all output lines matched some regexp in the file
- all regexps in the file were matched by something in the output
- at least one of the patterns found in output
- none of the patterns found in the output
- ...
---> I had to write these and few more scripts to handle the parsing
of perf output, as in [1], however it still is not ideal...

[1] https://github.com/rfmvh/perftool-testsuite/tree/master/common
[2] https://github.com/rfmvh/perftool-testsuite/blob/master/common/patterns.sh

Cheers,
Michael

P.S. Could anyone try whether my suite would work on the dash (or any other
"non-fedora" environment)? I haven't had problems with this so far, but
of course I haven't tried many...

- Arnaldo

[...]