perf test: Change all remaining #!/bin/sh to #!/bin/bash
authorJames Clark <james.clark@linaro.org>
Mon, 23 Jun 2025 09:00:12 +0000 (10:00 +0100)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 26 Jun 2025 17:31:05 +0000 (10:31 -0700)
commit2f5d370dec3f800b44bbf7b68875d521e0af43cd
tree98c7f302f54c4157c5eaf0228d3a4a7fc2b8df56
parentf0d0f978f3f5830ab06d71d1f37b3b30d47d6219
perf test: Change all remaining #!/bin/sh to #!/bin/bash

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@gmail.com/

Signed-off-by: James Clark <james.clark@linaro.org>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/r/20250623-james-perf-bash-tests-v1-1-f572f54d4559@linaro.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
43 files changed:
tools/perf/tests/perf-targz-src-pkg
tools/perf/tests/shell/amd-ibs-swfilt.sh
tools/perf/tests/shell/buildid.sh
tools/perf/tests/shell/coresight/asm_pure_loop.sh
tools/perf/tests/shell/coresight/memcpy_thread_16k_10.sh
tools/perf/tests/shell/coresight/thread_loop_check_tid_10.sh
tools/perf/tests/shell/coresight/thread_loop_check_tid_2.sh
tools/perf/tests/shell/coresight/unroll_loop_thread_10.sh
tools/perf/tests/shell/diff.sh
tools/perf/tests/shell/ftrace.sh
tools/perf/tests/shell/lib/perf_has_symbol.sh
tools/perf/tests/shell/lib/probe_vfs_getname.sh
tools/perf/tests/shell/lib/setup_python.sh
tools/perf/tests/shell/lib/waiting.sh
tools/perf/tests/shell/list.sh
tools/perf/tests/shell/lock_contention.sh
tools/perf/tests/shell/perf-report-hierarchy.sh
tools/perf/tests/shell/probe_vfs_getname.sh
tools/perf/tests/shell/record+probe_libc_inet_pton.sh
tools/perf/tests/shell/record+script_probe_vfs_getname.sh
tools/perf/tests/shell/record+zstd_comp_decomp.sh
tools/perf/tests/shell/record_bpf_filter.sh
tools/perf/tests/shell/record_offcpu.sh
tools/perf/tests/shell/record_sideband.sh
tools/perf/tests/shell/script.sh
tools/perf/tests/shell/stat+csv_summary.sh
tools/perf/tests/shell/stat+shadow_stat.sh
tools/perf/tests/shell/stat_all_pfm.sh
tools/perf/tests/shell/stat_bpf_counters.sh
tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
tools/perf/tests/shell/test_arm_callgraph_fp.sh
tools/perf/tests/shell/test_arm_coresight.sh
tools/perf/tests/shell/test_arm_coresight_disasm.sh
tools/perf/tests/shell/test_arm_spe.sh
tools/perf/tests/shell/test_arm_spe_fork.sh
tools/perf/tests/shell/test_bpf_metadata.sh
tools/perf/tests/shell/test_intel_pt.sh
tools/perf/tests/shell/trace+probe_vfs_getname.sh
tools/perf/tests/shell/trace_btf_enum.sh
tools/perf/tests/shell/trace_exit_race.sh
tools/perf/tests/shell/trace_record_replay.sh
tools/perf/tests/shell/trace_summary.sh
tools/perf/tests/tests-scripts.c