All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Nicolas Schier <n.schier@avm.de>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	Veronika Molnarova <vmolnaro@redhat.com>,
	Jakub Brnak <jbrnak@redhat.com>,
	Michael Petlan <mpetlan@redhat.com>, Philipp Hahn <p.hahn@avm.de>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Nicolas Schier <nsc@kernel.org>
Subject: Re: [PATCH v2] perf test perftool_testsuite: Add missing shellcheck source directive
Date: Tue, 6 Jan 2026 23:36:09 -0800	[thread overview]
Message-ID: <aV4M6aJ5oK_xlZ7_@google.com> (raw)
In-Reply-To: <20260106-perf-add-shellcheck-sc1090-annotation-v2-1-bd52dc47369e@avm.de>

Hello,

On Tue, Jan 06, 2026 at 01:59:25PM +0100, Nicolas Schier wrote:
> Add shellcheck source directive to prevent old versions of shellcheck to
> issue warning SC1090 for perf shell scripts, e.g.:
> 
>     In tests/shell/base_probe/test_line_semantics.sh line 20:
>     . "$DIR_PATH/../common/init.sh"
>       ^---------------------------^ SC1090: Can't follow non-constant source. Use a directive to specify location.
> 
> shellcheck versions since 0.7.2 handle such dynamic source includes in a
> more friendly manner [1]; older versions show the warning and thus
> break the perf build unless NO_SHELLCHECK is set to '1'.
> 
> Fixes: 241f21be7d0f ("perf test perftool_testsuite: Use absolute paths")
> Link: https://github.com/koalaman/shellcheck/issues/1998 # [1]
> Signed-off-by: Nicolas Schier <n.schier@avm.de>
> ---
> Changes in v2:
>   * Extend commit message and mention affected shellcheck versions
>     (< 0.7.2)
>   * Link to v1: https://lore.kernel.org/r/20251229-perf-add-shellcheck-sc1090-annotation-v1-1-083821aeefa6@avm.de
> ---
> Another way w/o new shellcheck directives would be to update the minimum
> shellcheck version in tools/perf/Makefile.perf to 0.7.2.  I'll send
> that as an alternative patch.

Thanks for doing this, I think that's much simpler than this.

> 
> Newer versions of shellcheck are available since e.g.
> Debian bookworm 12 (released: 2023/06), Ubuntu jammy 22.04 (released:
> 2022/04), Fedora 37 (released: 2022/11)
> ---
>  tools/perf/tests/shell/base_probe/test_adding_blacklisted.sh | 1 +
>  tools/perf/tests/shell/base_probe/test_adding_kernel.sh      | 1 +
>  tools/perf/tests/shell/base_probe/test_basic.sh              | 1 +
>  tools/perf/tests/shell/base_probe/test_invalid_options.sh    | 1 +
>  tools/perf/tests/shell/base_probe/test_line_semantics.sh     | 1 +
>  tools/perf/tests/shell/base_report/setup.sh                  | 1 +
>  tools/perf/tests/shell/base_report/test_basic.sh             | 1 +
>  7 files changed, 7 insertions(+)
> 
> diff --git a/tools/perf/tests/shell/base_probe/test_adding_blacklisted.sh b/tools/perf/tests/shell/base_probe/test_adding_blacklisted.sh
> index f74aab5c5d7f85b04f68090515acdfa49b6bccf3..06fca7d2cbb407eaea57df79bef11e26b49f9841 100755
> --- a/tools/perf/tests/shell/base_probe/test_adding_blacklisted.sh
> +++ b/tools/perf/tests/shell/base_probe/test_adding_blacklisted.sh
> @@ -17,6 +17,7 @@ DIR_PATH="$(dirname $0)"
>  TEST_RESULT=0
>  
>  # include working environment
> +# shellcheck source=tests/shell/common/init.sh
>  . "$DIR_PATH/../common/init.sh"

I'm not sure how shellcheck handles the source directory, but I think we
used to assume it's the directory where the current script is on.

Something like:

  # shellcheck source=../common/init.sh

But as I said, it'd be better to increase the minimal shellcheck version
if it can handle that automatically.

Thanks,
Namhyung

>  
>  # skip if not supported
> diff --git a/tools/perf/tests/shell/base_probe/test_adding_kernel.sh b/tools/perf/tests/shell/base_probe/test_adding_kernel.sh
> index 555a825d55f24543e3b6d105660c2cb505080e04..b6f9c4a697921b232a4795afcba10882e6101ce9 100755
> --- a/tools/perf/tests/shell/base_probe/test_adding_kernel.sh
> +++ b/tools/perf/tests/shell/base_probe/test_adding_kernel.sh
> @@ -17,6 +17,7 @@ DIR_PATH="$(dirname $0)"
>  TEST_RESULT=0
>  
>  # include working environment
> +# shellcheck source=tests/shell/common/init.sh
>  . "$DIR_PATH/../common/init.sh"
>  
>  # shellcheck source=lib/probe_vfs_getname.sh
> diff --git a/tools/perf/tests/shell/base_probe/test_basic.sh b/tools/perf/tests/shell/base_probe/test_basic.sh
> index 162838ddc974d04d806b22366866f8201802f969..f2db48cb9b8feffc6de1f3ea50a1dc99cb44f377 100755
> --- a/tools/perf/tests/shell/base_probe/test_basic.sh
> +++ b/tools/perf/tests/shell/base_probe/test_basic.sh
> @@ -16,6 +16,7 @@ DIR_PATH="$(dirname $0)"
>  TEST_RESULT=0
>  
>  # include working environment
> +# shellcheck source=tests/shell/common/init.sh
>  . "$DIR_PATH/../common/init.sh"
>  
>  if ! check_kprobes_available; then
> diff --git a/tools/perf/tests/shell/base_probe/test_invalid_options.sh b/tools/perf/tests/shell/base_probe/test_invalid_options.sh
> index 44a3ae014bfa2ffa831b86796b2e5187311d7303..3ae9afe6288b04d90777ebf5cdc64342f270eb75 100755
> --- a/tools/perf/tests/shell/base_probe/test_invalid_options.sh
> +++ b/tools/perf/tests/shell/base_probe/test_invalid_options.sh
> @@ -16,6 +16,7 @@ DIR_PATH="$(dirname $0)"
>  TEST_RESULT=0
>  
>  # include working environment
> +# shellcheck source=tests/shell/common/init.sh
>  . "$DIR_PATH/../common/init.sh"
>  
>  if ! check_kprobes_available; then
> diff --git a/tools/perf/tests/shell/base_probe/test_line_semantics.sh b/tools/perf/tests/shell/base_probe/test_line_semantics.sh
> index 576442d87a44400a65edce95b23070ce56f32993..4a1189c6cb0cbc269672c47efa617d20b0b4e795 100755
> --- a/tools/perf/tests/shell/base_probe/test_line_semantics.sh
> +++ b/tools/perf/tests/shell/base_probe/test_line_semantics.sh
> @@ -17,6 +17,7 @@ DIR_PATH="$(dirname $0)"
>  TEST_RESULT=0
>  
>  # include working environment
> +# shellcheck source=tests/shell/common/init.sh
>  . "$DIR_PATH/../common/init.sh"
>  
>  if ! check_kprobes_available; then
> diff --git a/tools/perf/tests/shell/base_report/setup.sh b/tools/perf/tests/shell/base_report/setup.sh
> index bb49b0fabb11499d4fb20d3c8c325d7f081cf18b..bc1dd8c128a6a57fd0a8ba94e51f0b11453a31de 100755
> --- a/tools/perf/tests/shell/base_report/setup.sh
> +++ b/tools/perf/tests/shell/base_report/setup.sh
> @@ -15,6 +15,7 @@
>  DIR_PATH="$(dirname $0)"
>  
>  # include working environment
> +# shellcheck source=tests/shell/common/init.sh
>  . "$DIR_PATH/../common/init.sh"
>  
>  TEST_RESULT=0
> diff --git a/tools/perf/tests/shell/base_report/test_basic.sh b/tools/perf/tests/shell/base_report/test_basic.sh
> index 0dfe7e5fd1ca609535fa70b03c8301373ec3fe6f..4cbc7c67f7bb9ccd79f950b731c604a426c5bfd0 100755
> --- a/tools/perf/tests/shell/base_report/test_basic.sh
> +++ b/tools/perf/tests/shell/base_report/test_basic.sh
> @@ -16,6 +16,7 @@ DIR_PATH="$(dirname $0)"
>  TEST_RESULT=0
>  
>  # include working environment
> +# shellcheck source=tests/shell/common/init.sh
>  . "$DIR_PATH/../common/init.sh"
>  
>  
> 
> ---
> base-commit: 9ace4753a5202b02191d54e9fdf7f9e3d02b85eb
> change-id: 20251229-perf-add-shellcheck-sc1090-annotation-fec8beb43c1e
> 
> Best regards,
> -- 
> Nicolas Schier
> 

      reply	other threads:[~2026-01-07  7:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-06 12:59 [PATCH v2] perf test perftool_testsuite: Add missing shellcheck source directive Nicolas Schier
2026-01-07  7:36 ` Namhyung Kim [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aV4M6aJ5oK_xlZ7_@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jbrnak@redhat.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=mpetlan@redhat.com \
    --cc=n.schier@avm.de \
    --cc=nsc@kernel.org \
    --cc=p.hahn@avm.de \
    --cc=peterz@infradead.org \
    --cc=vmolnaro@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.