tests/shell: Fix shellcheck SC1090 to handle the location of sourced files
authorAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Thu, 7 Sep 2023 17:15:38 +0000 (22:45 +0530)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 27 Sep 2023 04:47:12 +0000 (21:47 -0700)
Running shellcheck on some of the shell scripts throws
below error:

In tests/shell/coresight/unroll_loop_thread_10.sh line 8:
. "$(dirname $0)"/../lib/coresight.sh
  ^-- SC1090: Can't follow non-constant source. Use a directive to specify location.

This happens on shellcheck version "0.6.0". Fix shellcheck
warning for SC1090 using "shellcheck source="i option to mention
the location of sourced files.

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Tested-by: Ian Rogers <irogers@google.com>
Reviewed-by: Kajol Jain <kjain@linux.ibm.com>
Cc: maddy@linux.ibm.com
Cc: disgoel@linux.vnet.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230907171540.36736-2-atrajeev@linux.vnet.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
13 files changed:
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/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.sh
tools/perf/tests/shell/stat+csv_output.sh
tools/perf/tests/shell/stat+std_output.sh
tools/perf/tests/shell/test_intel_pt.sh
tools/perf/tests/shell/trace+probe_vfs_getname.sh

index 779bc8608e1eb684d2a0709f6b13b76744ba3856..04387061e9f3e3c6e1fecc1dbfaa8993d9c82f7d 100755 (executable)
@@ -5,7 +5,10 @@
 # Carsten Haitzler <carsten.haitzler@arm.com>, 2021
 
 TEST="asm_pure_loop"
+
+# shellcheck source=../lib/coresight.sh
 . "$(dirname $0)"/../lib/coresight.sh
+
 ARGS=""
 DATV="out"
 DATA="$DATD/perf-$TEST-$DATV.data"
index 08a44e52ce9b078344f31ff281a48d89aa53d502..c17e442ac741d5288dc22447f4a98e04336a3c49 100755 (executable)
@@ -5,7 +5,10 @@
 # Carsten Haitzler <carsten.haitzler@arm.com>, 2021
 
 TEST="memcpy_thread"
+
+# shellcheck source=../lib/coresight.sh
 . "$(dirname $0)"/../lib/coresight.sh
+
 ARGS="16 10 1"
 DATV="16k_10"
 DATA="$DATD/perf-$TEST-$DATV.data"
index c83a200dede4b6439017e9085a34ce46cee12b6a..e47c4e955d0e82649b157342014cc334235697bb 100755 (executable)
@@ -5,7 +5,10 @@
 # Carsten Haitzler <carsten.haitzler@arm.com>, 2021
 
 TEST="thread_loop"
+
+# shellcheck source=../lib/coresight.sh
 . "$(dirname $0)"/../lib/coresight.sh
+
 ARGS="10 1"
 DATV="check-tid-10th"
 DATA="$DATD/perf-$TEST-$DATV.data"
index 6346fd5e87c8a5e824c4e55030db9892c3ca5c07..8bf94a02e384d7c77ec823e23f97bfd58a70b6ab 100755 (executable)
@@ -5,7 +5,10 @@
 # Carsten Haitzler <carsten.haitzler@arm.com>, 2021
 
 TEST="thread_loop"
+
+# shellcheck source=../lib/coresight.sh
 . "$(dirname $0)"/../lib/coresight.sh
+
 ARGS="2 20"
 DATV="check-tid-2th"
 DATA="$DATD/perf-$TEST-$DATV.data"
index 7304e3d3a6ff6a6d5793c8e2955e8fc71c2f489d..0dc9ef424233e3ded0c1ed9c6481bc65cb178ea4 100755 (executable)
@@ -5,7 +5,10 @@
 # Carsten Haitzler <carsten.haitzler@arm.com>, 2021
 
 TEST="unroll_loop_thread"
+
+# shellcheck source=../lib/coresight.sh
 . "$(dirname $0)"/../lib/coresight.sh
+
 ARGS="10"
 DATV="10"
 DATA="$DATD/perf-$TEST-$DATV.data"
index 871243d6d03a2260a6a3464cc93ef52d0d4fe2ab..554e12e83c55fd5684e37b32d87b020b4408417f 100755 (executable)
@@ -4,10 +4,12 @@
 # SPDX-License-Identifier: GPL-2.0
 # Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
 
+# shellcheck source=lib/probe.sh
 . "$(dirname $0)"/lib/probe.sh
 
 skip_if_no_perf_probe || exit 2
 
+# shellcheck source=lib/probe_vfs_getname.sh
 . "$(dirname $0)"/lib/probe_vfs_getname.sh
 
 add_probe_vfs_getname || skip_if_no_debuginfo
index 89214a6d9951f1d2c173a638037d928f706cc2f9..eebeea6bdc767a73168c81cd64bd13d049060508 100755 (executable)
@@ -10,7 +10,9 @@
 # SPDX-License-Identifier: GPL-2.0
 # Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
 
+# shellcheck source=lib/probe.sh
 . "$(dirname "$0")/lib/probe.sh"
+# shellcheck source=lib/probe_vfs_getname.sh
 . "$(dirname "$0")/lib/probe_vfs_getname.sh"
 
 libc=$(grep -w libc /proc/self/maps | head -1 | sed -r 's/.*[[:space:]](\/.*)/\1/g')
index 7f664f1889d9ced128d0baf354e85db979adf0f3..5eedbe29bba1eab90b70cd9759106486eefa22a8 100755 (executable)
@@ -9,10 +9,12 @@
 # SPDX-License-Identifier: GPL-2.0
 # Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
 
+# shellcheck source=lib/probe.sh
 . "$(dirname "$0")/lib/probe.sh"
 
 skip_if_no_perf_probe || exit 2
 
+# shellcheck source=lib/probe_vfs_getname.sh
 . "$(dirname "$0")/lib/probe_vfs_getname.sh"
 
 record_open_file() {
index 4fbc74805d526a6b54df154fcf5fc59900aabe28..29443b8e8876502aa5cb7e291dcb0e104f8a3da1 100755 (executable)
@@ -5,6 +5,7 @@
 set -e
 
 shelldir=$(dirname "$0")
+# shellcheck source=lib/waiting.sh
 . "${shelldir}"/lib/waiting.sh
 
 err=0
index d890eb26e914c9ed5d1049e53ffccd96fde370b2..f1818fa6d9ce931c956d8383e07f764f6c4236dd 100755 (executable)
@@ -6,6 +6,7 @@
 
 set -e
 
+# shellcheck source=lib/stat_output.sh
 . "$(dirname $0)"/lib/stat_output.sh
 
 csv_sep=@
index fb2b10547a113d79fd87aa1891f9ae31589716b9..4fcdd1a9142c682c357568600f9def3e05d7aaae 100755 (executable)
@@ -6,6 +6,7 @@
 
 set -e
 
+# shellcheck source=lib/stat_output.sh
 . "$(dirname $0)"/lib/stat_output.sh
 
 stat_output=$(mktemp /tmp/__perf_test.stat_output.std.XXXXX)
index 3a8b9bffa022553cd96aaf39d6e3da05c88990b9..723ec501f99abe036d8cee1cd7d1182ea6aee52c 100755 (executable)
@@ -8,6 +8,7 @@ set -e
 perf list | grep -q 'intel_pt//' || exit 2
 
 shelldir=$(dirname "$0")
+# shellcheck source=lib/waiting.sh
 . "${shelldir}"/lib/waiting.sh
 
 skip_cnt=0
index 4014487cf4d933daf714c1e5d1d0ae594cfe0593..3146a1eece0789ae7e75e0ccf12a42951441a12a 100755 (executable)
@@ -10,6 +10,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
 
+# shellcheck source=lib/probe.sh
 . "$(dirname $0)"/lib/probe.sh
 
 skip_if_no_perf_probe || exit 2