Subject: Re: [PATCH 15/17] perf tests task_analyzer: fix bad substitution ${$1}

From: Aditya Gupta <[email-masked]>
Date: Fri, 23 Jun 2023 23:34:47 +0530

Hello Namhyung,

On 23/06/23 04:55, Namhyung Kim wrote:

> Ok, I found two problems.
>
> ...
> The first one is related to this message.  It couldn't find the script
> (task-analyzer.py) because PERF_EXEC_PATH is not set.
> Running with --exec-path=$PWD was ok, but I got a segfault.
>
> The other problem is in set_regs_in_dict().  It tries to capture
> register values in the sample and save them to a dictionary.
> The sample doesn't have registers so it should have no problem.
> But the 'bf' was not initialized properly when size is 0, and it led
> PyUnicode_FromString() returning NULL.
>
> After the changes, it ran ok:
>
> $ sudo ./perf test -v task
> 116: perf script task-analyzer tests                                 :
> --- start ---
> test child forked, pid 204088
> PASS: "test_basic"
> PASS: "test_ns_rename"
> PASS: "test_ms_filtertasks_highlight"
> PASS: "test_extended_times_timelimit_limittasks"
> PASS: "test_summary"
> PASS: "test_summaryextended"
> PASS: "test_summaryonly"
> PASS: "test_extended_times_summary_ns"
> PASS: "test_extended_times_summary_ns"
> PASS: "test_csv"
> PASS: "test_csvsummary"
> PASS: "test_csv_extended_times"
> PASS: "test_csvsummary_extended"
> test child finished with 0
> ---- end ----
> perf script task-analyzer tests: Ok
>
This is interesting. I did not encounter these earlier.

> I'll send the fixes soon.
>
Thanks for fixing it.

>> You can try the perf-tools-next branch in the perf/perft-tools-next.git repo.
>>
>>    git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git
>>
>>    $ make clean all
>>    $ sudo ./perf test -v task
>>
I tested with the steps provided, i.e.. clone, /*apply patch 15 (added this step myself)*/, clean, make, ./perf test -v test. But still- test passed:

'''
~/temp_clones/perf-tools-next/tools/perf git:(master) sudo ./perf test -v test

...

--- start ---
test child forked, pid 75261
PASS: "test_basic"
PASS: "test_ns_rename"
PASS: "test_ms_filtertasks_highlight"
PASS: "test_extended_times_timelimit_limittasks"
PASS: "test_summary"
PASS: "test_summaryextended"
PASS: "test_summaryonly"
PASS: "test_extended_times_summary_ns"
PASS: "test_extended_times_summary_ns"
PASS: "test_csv"
PASS: "test_csvsummary"
PASS: "test_csv_extended_times"
PASS: "test_csvsummary_extended"
test child finished with 0
---- end ----
'''

Maybe my environment had that other things set in such a way that, I did not face any issue (I don't recall doing so though, and these patches have been tested multiple times by more people also).
But thanks for your efforts to debug and fix the issue.

Thanks,

- AdityaG