Re: [PATCH] perf test: Change all remaining #!/bin/sh to #!/bin/bash
From: Collin Funk
Date: Mon Jun 23 2025 - 21:29:33 EST
James Clark <james.clark@xxxxxxxxxx> writes:
> There are 43 instances of posix shell tests and 35 instances of bash. To
> give us a single consistent language for testing in, replace
> all #!/bin/sh to #!/bin/bash. Common sources that are included in both
> different shells will now work as expected. And we no longer have to fix
> up bashisms that appear to work when someone's system has sh symlinked
> to bash, but don't work on other systems that have both shells
> installed.
>
> Although we could have chosen sh, it's not backwards compatible so it
> wouldn't be possible to bulk convert without re-writing the existing
> bash tests.
>
> Choosing bash also gives us some nicer features including 'local'
> variable definitions and regexes in if statements that are already
> widely used in the tests.
>
> It's not expected that there are any users with only sh available due to
> the large number of bash tests that exist.
>
> Discussed in relation to running shellcheck here:
> https://lore.kernel.org/linux-perf-users/e3751a74be34bbf3781c4644f518702a7270220b.1749785642.git.collin.funk1@xxxxxxxxx/
>
> Signed-off-by: James Clark <james.clark@xxxxxxxxxx>
> ---
> tools/perf/tests/perf-targz-src-pkg | 2 +-
> tools/perf/tests/shell/amd-ibs-swfilt.sh | 2 +-
> tools/perf/tests/shell/buildid.sh | 2 +-
> tools/perf/tests/shell/coresight/asm_pure_loop.sh | 2 +-
> tools/perf/tests/shell/coresight/memcpy_thread_16k_10.sh | 2 +-
> tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh | 2 +-
> tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh | 2 +-
> tools/perf/tests/shell/coresight/unroll_loop_thread_10.sh | 2 +-
> tools/perf/tests/shell/diff.sh | 2 +-
> tools/perf/tests/shell/ftrace.sh | 2 +-
> tools/perf/tests/shell/lib/perf_has_symbol.sh | 2 +-
> tools/perf/tests/shell/lib/probe_vfs_getname.sh | 2 +-
> tools/perf/tests/shell/lib/setup_python.sh | 2 +-
> tools/perf/tests/shell/lib/waiting.sh | 2 +-
> tools/perf/tests/shell/list.sh | 2 +-
> tools/perf/tests/shell/lock_contention.sh | 2 +-
> tools/perf/tests/shell/perf-report-hierarchy.sh | 2 +-
> tools/perf/tests/shell/probe_vfs_getname.sh | 2 +-
> 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+zstd_comp_decomp.sh | 2 +-
> tools/perf/tests/shell/record_bpf_filter.sh | 2 +-
> tools/perf/tests/shell/record_offcpu.sh | 2 +-
> tools/perf/tests/shell/record_sideband.sh | 2 +-
> tools/perf/tests/shell/script.sh | 2 +-
> tools/perf/tests/shell/stat+csv_summary.sh | 2 +-
> tools/perf/tests/shell/stat+shadow_stat.sh | 2 +-
> tools/perf/tests/shell/stat_all_pfm.sh | 2 +-
> tools/perf/tests/shell/stat_bpf_counters.sh | 2 +-
> tools/perf/tests/shell/stat_bpf_counters_cgrp.sh | 2 +-
> tools/perf/tests/shell/test_arm_callgraph_fp.sh | 2 +-
> tools/perf/tests/shell/test_arm_coresight.sh | 2 +-
> tools/perf/tests/shell/test_arm_coresight_disasm.sh | 2 +-
> tools/perf/tests/shell/test_arm_spe.sh | 2 +-
> tools/perf/tests/shell/test_arm_spe_fork.sh | 2 +-
> tools/perf/tests/shell/test_bpf_metadata.sh | 2 +-
> tools/perf/tests/shell/test_intel_pt.sh | 2 +-
> tools/perf/tests/shell/trace+probe_vfs_getname.sh | 2 +-
> tools/perf/tests/shell/trace_btf_enum.sh | 2 +-
> tools/perf/tests/shell/trace_exit_race.sh | 2 +-
> tools/perf/tests/shell/trace_record_replay.sh | 2 +-
> tools/perf/tests/shell/trace_summary.sh | 2 +-
> tools/perf/tests/tests-scripts.c | 2 +-
> 43 files changed, 43 insertions(+), 43 deletions(-)
Patch looks good to me.
Reviewed-by: Collin Funk <collin.funk1@xxxxxxxxx>
Collin