[PATCH 0/2] perf test: Improve shellcheck source directives

James Clark posted 2 patches 3 days, 2 hours ago
tools/perf/Makefile.perf                                  | 2 +-
tools/perf/tests/shell/annotate.sh                        | 1 -
tools/perf/tests/shell/base_probe/test_adding_kernel.sh   | 1 -
tools/perf/tests/shell/diff.sh                            | 1 -
tools/perf/tests/shell/inject_aslr.sh                     | 1 -
tools/perf/tests/shell/jitdump-python.sh                  | 1 -
tools/perf/tests/shell/list.sh                            | 1 -
tools/perf/tests/shell/pipe_test.sh                       | 1 -
tools/perf/tests/shell/probe_vfs_getname.sh               | 2 --
tools/perf/tests/shell/python-use.sh                      | 1 -
tools/perf/tests/shell/record+probe_libc_inet_pton.sh     | 2 --
tools/perf/tests/shell/record+script_probe_vfs_getname.sh | 2 --
tools/perf/tests/shell/record.sh                          | 2 --
tools/perf/tests/shell/record_weak_term.sh                | 1 -
tools/perf/tests/shell/script_dlfilter.sh                 | 1 -
tools/perf/tests/shell/stat+csv_output.sh                 | 1 -
tools/perf/tests/shell/stat+json_output.sh                | 1 -
tools/perf/tests/shell/stat+std_output.sh                 | 1 -
tools/perf/tests/shell/stat_metrics_values.sh             | 1 -
tools/perf/tests/shell/test_arm_callgraph_fp.sh           | 1 -
tools/perf/tests/shell/test_brstack.sh                    | 1 -
tools/perf/tests/shell/test_data_symbol.sh                | 1 -
tools/perf/tests/shell/test_intel_pt.sh                   | 1 -
tools/perf/tests/shell/test_perf_data_converter_json.sh   | 1 -
tools/perf/tests/shell/test_test_junit_output.sh          | 1 -
tools/perf/tests/shell/test_uprobe_from_different_cu.sh   | 1 -
tools/perf/tests/shell/trace+probe_vfs_getname.sh         | 1 -
tools/perf/tests/shell/trace_btf_enum.sh                  | 1 -
tools/perf/tests/shell/trace_btf_general.sh               | 1 -
tools/perf/tests/shell/trace_exit_race.sh                 | 1 -
tools/perf/tests/shell/trace_record_replay.sh             | 2 --
tools/perf/tests/shell/trace_summary.sh                   | 1 -
32 files changed, 1 insertion(+), 37 deletions(-)
[PATCH 0/2] perf test: Improve shellcheck source directives
Posted by James Clark 3 days, 2 hours ago
I was hacking away when I got blocked by a shellcheck warning about an
unassigned variable, despite that variable being assigned in a sourced
file and having visibly correct source= directive.

Confusingly two things turned out to be relevant to this. One is that -a
doesn't make shellcheck follow "external" paths, which these are treated
as. You need -x for that. Secondly, the source= directives don't cause
it to follow the path either, they just suppress a warning message about
dynamic paths in versions of shellcheck before 0.7.2. This warning can
be silenced with "source=/dev/null" and doesn't require any particular
path to be provided if -x isn't used.

Signed-off-by: James Clark <james.clark@linaro.org>
---
James Clark (2):
      perf test: Remove redundant shellcheck source paths
      perf build: Follow sourced files when running shellcheck

 tools/perf/Makefile.perf                                  | 2 +-
 tools/perf/tests/shell/annotate.sh                        | 1 -
 tools/perf/tests/shell/base_probe/test_adding_kernel.sh   | 1 -
 tools/perf/tests/shell/diff.sh                            | 1 -
 tools/perf/tests/shell/inject_aslr.sh                     | 1 -
 tools/perf/tests/shell/jitdump-python.sh                  | 1 -
 tools/perf/tests/shell/list.sh                            | 1 -
 tools/perf/tests/shell/pipe_test.sh                       | 1 -
 tools/perf/tests/shell/probe_vfs_getname.sh               | 2 --
 tools/perf/tests/shell/python-use.sh                      | 1 -
 tools/perf/tests/shell/record+probe_libc_inet_pton.sh     | 2 --
 tools/perf/tests/shell/record+script_probe_vfs_getname.sh | 2 --
 tools/perf/tests/shell/record.sh                          | 2 --
 tools/perf/tests/shell/record_weak_term.sh                | 1 -
 tools/perf/tests/shell/script_dlfilter.sh                 | 1 -
 tools/perf/tests/shell/stat+csv_output.sh                 | 1 -
 tools/perf/tests/shell/stat+json_output.sh                | 1 -
 tools/perf/tests/shell/stat+std_output.sh                 | 1 -
 tools/perf/tests/shell/stat_metrics_values.sh             | 1 -
 tools/perf/tests/shell/test_arm_callgraph_fp.sh           | 1 -
 tools/perf/tests/shell/test_brstack.sh                    | 1 -
 tools/perf/tests/shell/test_data_symbol.sh                | 1 -
 tools/perf/tests/shell/test_intel_pt.sh                   | 1 -
 tools/perf/tests/shell/test_perf_data_converter_json.sh   | 1 -
 tools/perf/tests/shell/test_test_junit_output.sh          | 1 -
 tools/perf/tests/shell/test_uprobe_from_different_cu.sh   | 1 -
 tools/perf/tests/shell/trace+probe_vfs_getname.sh         | 1 -
 tools/perf/tests/shell/trace_btf_enum.sh                  | 1 -
 tools/perf/tests/shell/trace_btf_general.sh               | 1 -
 tools/perf/tests/shell/trace_exit_race.sh                 | 1 -
 tools/perf/tests/shell/trace_record_replay.sh             | 2 --
 tools/perf/tests/shell/trace_summary.sh                   | 1 -
 32 files changed, 1 insertion(+), 37 deletions(-)
---
base-commit: 9453bc6a69ef43755f1c28d5688cacdd69fa16bd
change-id: 20260921-james-perf-shellcheck-source-f48df891cd4f

Best regards,
--  
James Clark <james.clark@linaro.org>
Re: [PATCH 0/2] perf test: Improve shellcheck source directives
Posted by Namhyung Kim 2 days, 21 hours ago
On Mon, Sep 21, 2026 at 04:47:27PM +0100, James Clark wrote:
> I was hacking away when I got blocked by a shellcheck warning about an
> unassigned variable, despite that variable being assigned in a sourced
> file and having visibly correct source= directive.
> 
> Confusingly two things turned out to be relevant to this. One is that -a
> doesn't make shellcheck follow "external" paths, which these are treated
> as. You need -x for that. Secondly, the source= directives don't cause
> it to follow the path either, they just suppress a warning message about
> dynamic paths in versions of shellcheck before 0.7.2. This warning can
> be silenced with "source=/dev/null" and doesn't require any particular
> path to be provided if -x isn't used.
> 
> Signed-off-by: James Clark <james.clark@linaro.org>
> ---
> James Clark (2):
>       perf test: Remove redundant shellcheck source paths
>       perf build: Follow sourced files when running shellcheck

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

> 
>  tools/perf/Makefile.perf                                  | 2 +-
>  tools/perf/tests/shell/annotate.sh                        | 1 -
>  tools/perf/tests/shell/base_probe/test_adding_kernel.sh   | 1 -
>  tools/perf/tests/shell/diff.sh                            | 1 -
>  tools/perf/tests/shell/inject_aslr.sh                     | 1 -
>  tools/perf/tests/shell/jitdump-python.sh                  | 1 -
>  tools/perf/tests/shell/list.sh                            | 1 -
>  tools/perf/tests/shell/pipe_test.sh                       | 1 -
>  tools/perf/tests/shell/probe_vfs_getname.sh               | 2 --
>  tools/perf/tests/shell/python-use.sh                      | 1 -
>  tools/perf/tests/shell/record+probe_libc_inet_pton.sh     | 2 --
>  tools/perf/tests/shell/record+script_probe_vfs_getname.sh | 2 --
>  tools/perf/tests/shell/record.sh                          | 2 --
>  tools/perf/tests/shell/record_weak_term.sh                | 1 -
>  tools/perf/tests/shell/script_dlfilter.sh                 | 1 -
>  tools/perf/tests/shell/stat+csv_output.sh                 | 1 -
>  tools/perf/tests/shell/stat+json_output.sh                | 1 -
>  tools/perf/tests/shell/stat+std_output.sh                 | 1 -
>  tools/perf/tests/shell/stat_metrics_values.sh             | 1 -
>  tools/perf/tests/shell/test_arm_callgraph_fp.sh           | 1 -
>  tools/perf/tests/shell/test_brstack.sh                    | 1 -
>  tools/perf/tests/shell/test_data_symbol.sh                | 1 -
>  tools/perf/tests/shell/test_intel_pt.sh                   | 1 -
>  tools/perf/tests/shell/test_perf_data_converter_json.sh   | 1 -
>  tools/perf/tests/shell/test_test_junit_output.sh          | 1 -
>  tools/perf/tests/shell/test_uprobe_from_different_cu.sh   | 1 -
>  tools/perf/tests/shell/trace+probe_vfs_getname.sh         | 1 -
>  tools/perf/tests/shell/trace_btf_enum.sh                  | 1 -
>  tools/perf/tests/shell/trace_btf_general.sh               | 1 -
>  tools/perf/tests/shell/trace_exit_race.sh                 | 1 -
>  tools/perf/tests/shell/trace_record_replay.sh             | 2 --
>  tools/perf/tests/shell/trace_summary.sh                   | 1 -
>  32 files changed, 1 insertion(+), 37 deletions(-)
> ---
> base-commit: 9453bc6a69ef43755f1c28d5688cacdd69fa16bd
> change-id: 20260921-james-perf-shellcheck-source-f48df891cd4f
> 
> Best regards,
> --  
> James Clark <james.clark@linaro.org>
>
Re: [PATCH 0/2] perf test: Improve shellcheck source directives
Posted by Arnaldo Carvalho de Melo 51 minutes ago
On Mon, Sep 21, 2026 at 01:46:25PM -0700, Namhyung Kim wrote:
> On Mon, Sep 21, 2026 at 04:47:27PM +0100, James Clark wrote:
> > Confusingly two things turned out to be relevant to this. One is that -a
> > doesn't make shellcheck follow "external" paths, which these are treated
> > as. You need -x for that. Secondly, the source= directives don't cause
> > it to follow the path either, they just suppress a warning message about
> > dynamic paths in versions of shellcheck before 0.7.2. This warning can
> > be silenced with "source=/dev/null" and doesn't require any particular
> > path to be provided if -x isn't used.

> > James Clark (2):
> >       perf test: Remove redundant shellcheck source paths
> >       perf build: Follow sourced files when running shellcheck
 
> Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks, applied to perf-tools-next, for v7.4.

- Arnaldo