lkml.org 
[lkml]   [2020]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 06/14] perf tests: Add another pmu-events tests
On Mon, Jun 1, 2020 at 6:21 AM Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Mon, Jun 01, 2020 at 12:44:15AM -0700, Ian Rogers wrote:
>
> SNIP
>
> > > + memset(&error, 0, sizeof(error));
> > > + ret = parse_events_fake(evlist, id, &error);
> > > + if (ret) {
> > > + pr_debug("str : %s\n", error.str);
> > > + pr_debug("help : %s\n", error.help);
> > > + pr_debug("first_str : %s\n", error.first_str);
> > > + pr_debug("first_help : %s\n", error.first_help);
> > > + }
> > > +
> > > + evlist__delete(evlist);
> > > + free(error.str);
> > > + free(error.help);
> > > + free(error.first_str);
> > > + free(error.first_help);
> > > + return ret;
> > > +}
> >
> > This is quite similar to check_parse_id, fold them together?
>
> there is the 'same_cpu' logic in check_parse_id,
> so I did not want to mess with that

Agreed. We could handle ret and same_cpu in the caller.

> >
> > > +
> > > +static int metric_parse_fake(const char *str)
> > > +{
> > > + struct expr_parse_ctx ctx;
> > > + struct hashmap_entry *cur;
> > > + double result;
> > > + int ret = -1;
> > > + size_t bkt;
> > > + int i;
> > > +
> > > + pr_debug("parsing '%s'\n", str);
> > > +
> > > + expr__ctx_init(&ctx);
> > > + if (expr__find_other(str, NULL, &ctx, 0) < 0) {
> > > + pr_err("expr__find_other failed\n");
> > > + return -1;
> > > + }
> > > +
> > > + i = 1;
> > > + hashmap__for_each_entry((&ctx.ids), cur, bkt)
> > > + expr__add_id(&ctx, strdup(cur->key), i++);
> >
> > It might make sense to share the code here with that in test_parsing.
> > This initialization of ids is commented there and it is a bit special.
>
> hum, not sure it's worth to add this complexity to test, I'd like
> to keep it simple, it's already not straightforward ;-) I added the
> comment you mentioned

Ok, sounds good to me. More testing is the priority :-)

Thanks,
Ian

> jirka
>

\
 
 \ /
  Last update: 2020-06-01 18:26    [W:0.061 / U:7.712 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site