public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v2 0/1] RFC: Bash autocompletion feature for igt
@ 2026-01-30 13:11 Jan Sokolowski
  2026-01-30 13:11 ` [PATCH i-g-t v2 1/1] RFC /scripts/bash-autocomplete: Create bash autocompletion scripts for tests Jan Sokolowski
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Sokolowski @ 2026-01-30 13:11 UTC (permalink / raw)
  To: igt-dev
  Cc: Jan Sokolowski, Jan Sokolowski, Zbigniew Kempczyński,
	Kamil Konieczny, Katarzyna Piecielska, Juha-Pekka Heikkila,
	Ashutosh Dixit

  This is a RFC for a feature that I've found to be useful not only
for me, but according to the rest of my team, to be of use to other
igt developers and users, that is, bash autocompletion feature.

This RFC currently only has an incomplete support for igt tests,
and supports following suggestions: --*, --run-subtest *, --device *.

Before I'll continue with the work, I'd like to ask what are your
opinions on this feature? Which tools other than tests could benefit
from having autocompletion added? 

Signed-off-by: Jan Sokolowski <jan.sokolowski@gmail.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: Katarzyna Piecielska <katarzyna.piecielska@intel.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>


Jan Sokolowski (1):
  RFC /scripts/bash-autocomplete: Create bash autocompletion scripts for
    tests

 meson.sh                                      |  6 ++
 .../install_completions.sh                    | 85 +++++++++++++++++++
 2 files changed, 91 insertions(+)
 create mode 100755 scripts/bash_autocompletion/install_completions.sh

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH i-g-t v2 1/1] RFC /scripts/bash-autocomplete: Create bash autocompletion scripts for tests
  2026-01-30 13:11 [PATCH i-g-t v2 0/1] RFC: Bash autocompletion feature for igt Jan Sokolowski
@ 2026-01-30 13:11 ` Jan Sokolowski
  2026-02-05 13:34   ` Zbigniew Kempczyński
  2026-02-11 14:07   ` Kamil Konieczny
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Sokolowski @ 2026-01-30 13:11 UTC (permalink / raw)
  To: igt-dev
  Cc: Jan Sokolowski, Zbigniew Kempczyński, Kamil Konieczny,
	Katarzyna Piecielska, Juha-Pekka Heikkila, Ashutosh Dixit

Add installation and uninstallation scripts for bash autocompletion
for tests.

To install: run 'make install-completions' after generating Makefile via
meson.sh.

To uninstall: run 'make uninstall-completions'.

By default autocompletions are installed to
~/.local/share/bash-completion/completions and use
build/tests/test_list.txt directory as list of what completions
to install.

In order to install them as root to
/usr/share/bash-completion/completions, run
./install_completions.sh --install from scripts/bash_autocompletion
directory. It uses /usr/local/libexec/igt-gpu-tools/test_list.txt as
list of what completions to install.

Please note that these completions might be unavailable due to
.bashrc configuration, refer to distribution documentation.

Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: Katarzyna Piecielska <katarzyna.piecielska@intel.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 meson.sh                                      |  6 ++
 .../install_completions.sh                    | 85 +++++++++++++++++++
 2 files changed, 91 insertions(+)
 create mode 100755 scripts/bash_autocompletion/install_completions.sh

diff --git a/meson.sh b/meson.sh
index 1563a85b1..7f1f8b987 100755
--- a/meson.sh
+++ b/meson.sh
@@ -60,6 +60,12 @@ install: build/build.ninja
 uninstall: build/build.ninja
 	\$(Q)ninja -C build uninstall \$(quiet_build)
 
+install-completions:
+	./scripts/bash_autocompletion/install_completions.sh --local-install
+
+uninstall-completions:
+	./scripts/bash_autocompletion/install_completions.sh --local-uninstall
+
 docs:
 	\$(Q)ninja -C build igt-gpu-tools-doc \$(quiet_build)
 
diff --git a/scripts/bash_autocompletion/install_completions.sh b/scripts/bash_autocompletion/install_completions.sh
new file mode 100755
index 000000000..5aa739f2e
--- /dev/null
+++ b/scripts/bash_autocompletion/install_completions.sh
@@ -0,0 +1,85 @@
+#!/bin/bash
+# SPDX-License-Identifier: MIT
+# Copyright © 2025 Intel Corporation
+# Author: Jan Sokolowski <jan.sokolowski@intel.com>
+
+usage() {
+echo "install_completions.sh - creates bash autocompletion scripts for installed igt gpu tools tests."
+echo "Usage: "
+echo "--install : installs completions for installed /usr/local/libexec/igt_gpu_tools tests to ~/.local/share/bash-completion/completions" 
+echo "--local-install : uses ../../build/tests as list of completions to install to ~/.local/share/bash-completion/completions"
+echo "--uninstall : uninstalls completions installed to /usrl/local/libexec/igt_gpu_tools from ~/.local/share/bash-completion/completions"
+echo "--local-uninstall : uses ../../build/tests as list of completions to uninstall from ~/.local/share/bash-completion-completions"
+}
+
+__generate_completion() {
+
+cat <<EOF > $1
+_$1()
+{
+	local cur prev words cword
+	_init_completion || return
+	case \$prev in
+		--run-subtest | --dynamic-subtest)
+			local IFS=$'\n\b'
+			LIST_OF_TESTS="\`\$1 --list-subtest\`"
+			COMPREPLY=(\$(compgen -W "\$LIST_OF_TESTS" -- "\$cur"))
+			return
+			;;
+		--device)
+			COMPREPLY=(\$(compgen -o nospace -W "sys: pci: sriov: drm:" -- "\$cur"))
+			;;
+	esac
+
+	if [[ \$cur == * ]]; then
+		COMPREPLY=(\$(compgen -W '\$(_parse_help "\$1")' -- "\$cur"))
+	fi
+
+} &&
+
+complete -F _$1 $1
+EOF
+
+}
+
+__install_completions() {
+	mkdir -p ~/.local/share/bash-completion/completions
+	cd ~/.local/share/bash-completion/completions
+	for ENTRY in `sed -n 2p $1/test-list-full.txt`;
+	do
+		TEST=`echo $ENTRY | rev | cut -f1 -d'/' | rev`
+		__generate_completion $TEST
+	done
+	cd - > /dev/null
+}
+
+__uninstall_completions() {
+	cd ~/.local/share/bash-completion/completions
+	for ENTRY in `sed -n 2p $1/test-list-full.txt`;
+	do
+		TEST=`echo $ENTRY | rev | cut -f1 -d'/' | rev`
+		rm ~/.local/share/bash-completion/completions/$TEST
+	done
+	cd - > /dev/null
+}
+
+case "$1" in
+	"--install")
+		__install_completions "/usr/local/libexec/igt-gpu-tools"
+		;;
+	"--local-install")
+		__install_completions "$PWD/build/tests"
+		;;
+	"--uninstall")
+		__uninstall_completions "/usr/local/libexec/igt-gpu-tools"
+		;;
+	"--local-uninstall")
+		__uninstall_completions "$PWD/build/tests"
+		;;
+	"--help")
+		usage
+		;;
+	*)
+		__install_completions "/usr/local/libexec/igt-gpu-tools"
+		;;
+esac
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH i-g-t v2 1/1] RFC /scripts/bash-autocomplete: Create bash autocompletion scripts for tests
  2026-01-30 13:11 ` [PATCH i-g-t v2 1/1] RFC /scripts/bash-autocomplete: Create bash autocompletion scripts for tests Jan Sokolowski
@ 2026-02-05 13:34   ` Zbigniew Kempczyński
  2026-02-11 14:07   ` Kamil Konieczny
  1 sibling, 0 replies; 4+ messages in thread
From: Zbigniew Kempczyński @ 2026-02-05 13:34 UTC (permalink / raw)
  To: Jan Sokolowski
  Cc: igt-dev, Kamil Konieczny, Katarzyna Piecielska,
	Juha-Pekka Heikkila, Ashutosh Dixit

On Fri, Jan 30, 2026 at 02:11:22PM +0100, Jan Sokolowski wrote:
> Add installation and uninstallation scripts for bash autocompletion
> for tests.
> 
> To install: run 'make install-completions' after generating Makefile via
> meson.sh.
> 
> To uninstall: run 'make uninstall-completions'.
> 
> By default autocompletions are installed to
> ~/.local/share/bash-completion/completions and use
> build/tests/test_list.txt directory as list of what completions
> to install.

It would be good if during 'install-completions' step you would
print where it is installing the completions.

> 
> In order to install them as root to
> /usr/share/bash-completion/completions, run
> ./install_completions.sh --install from scripts/bash_autocompletion
> directory. It uses /usr/local/libexec/igt-gpu-tools/test_list.txt as
> list of what completions to install.
> 
> Please note that these completions might be unavailable due to
> .bashrc configuration, refer to distribution documentation.

Too vague, add as an example for Ubuntu root may not source
/etc/bash_completion because it is commented out.

> 
> Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> Cc: Katarzyna Piecielska <katarzyna.piecielska@intel.com>
> Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
> ---
>  meson.sh                                      |  6 ++
>  .../install_completions.sh                    | 85 +++++++++++++++++++
>  2 files changed, 91 insertions(+)
>  create mode 100755 scripts/bash_autocompletion/install_completions.sh
> 
> diff --git a/meson.sh b/meson.sh
> index 1563a85b1..7f1f8b987 100755
> --- a/meson.sh
> +++ b/meson.sh
> @@ -60,6 +60,12 @@ install: build/build.ninja
>  uninstall: build/build.ninja
>  	\$(Q)ninja -C build uninstall \$(quiet_build)
>  
> +install-completions:

+install-completions: all


> +	./scripts/bash_autocompletion/install_completions.sh --local-install
> +
> +uninstall-completions:

+uninstall-completions: all

> +	./scripts/bash_autocompletion/install_completions.sh --local-uninstall
> +
>  docs:
>  	\$(Q)ninja -C build igt-gpu-tools-doc \$(quiet_build)
>  
> diff --git a/scripts/bash_autocompletion/install_completions.sh b/scripts/bash_autocompletion/install_completions.sh
> new file mode 100755
> index 000000000..5aa739f2e
> --- /dev/null
> +++ b/scripts/bash_autocompletion/install_completions.sh
> @@ -0,0 +1,85 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: MIT
> +# Copyright © 2025 Intel Corporation
> +# Author: Jan Sokolowski <jan.sokolowski@intel.com>
> +
> +usage() {
> +echo "install_completions.sh - creates bash autocompletion scripts for installed igt gpu tools tests."
> +echo "Usage: "
> +echo "--install : installs completions for installed /usr/local/libexec/igt_gpu_tools tests to ~/.local/share/bash-completion/completions" 

Whitespace at the end.

Anyway it is desirable change for me, just address my minor nits.

--
Zbigniew

> +echo "--local-install : uses ../../build/tests as list of completions to install to ~/.local/share/bash-completion/completions"
> +echo "--uninstall : uninstalls completions installed to /usrl/local/libexec/igt_gpu_tools from ~/.local/share/bash-completion/completions"
> +echo "--local-uninstall : uses ../../build/tests as list of completions to uninstall from ~/.local/share/bash-completion-completions"
> +}
> +
> +__generate_completion() {
> +
> +cat <<EOF > $1
> +_$1()
> +{
> +	local cur prev words cword
> +	_init_completion || return
> +	case \$prev in
> +		--run-subtest | --dynamic-subtest)
> +			local IFS=$'\n\b'
> +			LIST_OF_TESTS="\`\$1 --list-subtest\`"
> +			COMPREPLY=(\$(compgen -W "\$LIST_OF_TESTS" -- "\$cur"))
> +			return
> +			;;
> +		--device)
> +			COMPREPLY=(\$(compgen -o nospace -W "sys: pci: sriov: drm:" -- "\$cur"))
> +			;;
> +	esac
> +
> +	if [[ \$cur == * ]]; then
> +		COMPREPLY=(\$(compgen -W '\$(_parse_help "\$1")' -- "\$cur"))
> +	fi
> +
> +} &&
> +
> +complete -F _$1 $1
> +EOF
> +
> +}
> +
> +__install_completions() {
> +	mkdir -p ~/.local/share/bash-completion/completions
> +	cd ~/.local/share/bash-completion/completions
> +	for ENTRY in `sed -n 2p $1/test-list-full.txt`;
> +	do
> +		TEST=`echo $ENTRY | rev | cut -f1 -d'/' | rev`
> +		__generate_completion $TEST
> +	done
> +	cd - > /dev/null
> +}
> +
> +__uninstall_completions() {
> +	cd ~/.local/share/bash-completion/completions
> +	for ENTRY in `sed -n 2p $1/test-list-full.txt`;
> +	do
> +		TEST=`echo $ENTRY | rev | cut -f1 -d'/' | rev`
> +		rm ~/.local/share/bash-completion/completions/$TEST
> +	done
> +	cd - > /dev/null
> +}
> +
> +case "$1" in
> +	"--install")
> +		__install_completions "/usr/local/libexec/igt-gpu-tools"
> +		;;
> +	"--local-install")
> +		__install_completions "$PWD/build/tests"
> +		;;
> +	"--uninstall")
> +		__uninstall_completions "/usr/local/libexec/igt-gpu-tools"
> +		;;
> +	"--local-uninstall")
> +		__uninstall_completions "$PWD/build/tests"
> +		;;
> +	"--help")
> +		usage
> +		;;
> +	*)
> +		__install_completions "/usr/local/libexec/igt-gpu-tools"
> +		;;
> +esac
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH i-g-t v2 1/1] RFC /scripts/bash-autocomplete: Create bash autocompletion scripts for tests
  2026-01-30 13:11 ` [PATCH i-g-t v2 1/1] RFC /scripts/bash-autocomplete: Create bash autocompletion scripts for tests Jan Sokolowski
  2026-02-05 13:34   ` Zbigniew Kempczyński
@ 2026-02-11 14:07   ` Kamil Konieczny
  1 sibling, 0 replies; 4+ messages in thread
From: Kamil Konieczny @ 2026-02-11 14:07 UTC (permalink / raw)
  To: Jan Sokolowski
  Cc: igt-dev, Zbigniew Kempczyński, Katarzyna Piecielska,
	Juha-Pekka Heikkila, Ashutosh Dixit

Hi Jan,
On 2026-01-30 at 14:11:22 +0100, Jan Sokolowski wrote:

when you address Zbigniew nits please resend without RFC,
also remove '/' from begin, imho you could also make it a little
shorter, so it will be for example:

[PATCH i-g-t v2 1/1] scripts/bash-autocomplete: Create autocompletion for tests

Regards,
Kamil

> Add installation and uninstallation scripts for bash autocompletion
> for tests.
> 
> To install: run 'make install-completions' after generating Makefile via
> meson.sh.
> 
> To uninstall: run 'make uninstall-completions'.
> 
> By default autocompletions are installed to
> ~/.local/share/bash-completion/completions and use
> build/tests/test_list.txt directory as list of what completions
> to install.
> 
> In order to install them as root to
> /usr/share/bash-completion/completions, run
> ./install_completions.sh --install from scripts/bash_autocompletion
> directory. It uses /usr/local/libexec/igt-gpu-tools/test_list.txt as
> list of what completions to install.
> 
> Please note that these completions might be unavailable due to
> .bashrc configuration, refer to distribution documentation.
> 
> Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> Cc: Katarzyna Piecielska <katarzyna.piecielska@intel.com>
> Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
> ---
>  meson.sh                                      |  6 ++
>  .../install_completions.sh                    | 85 +++++++++++++++++++
>  2 files changed, 91 insertions(+)
>  create mode 100755 scripts/bash_autocompletion/install_completions.sh
> 
> diff --git a/meson.sh b/meson.sh
> index 1563a85b1..7f1f8b987 100755
> --- a/meson.sh
> +++ b/meson.sh
> @@ -60,6 +60,12 @@ install: build/build.ninja
>  uninstall: build/build.ninja
>  	\$(Q)ninja -C build uninstall \$(quiet_build)
>  
> +install-completions:
> +	./scripts/bash_autocompletion/install_completions.sh --local-install
> +
> +uninstall-completions:
> +	./scripts/bash_autocompletion/install_completions.sh --local-uninstall
> +
>  docs:
>  	\$(Q)ninja -C build igt-gpu-tools-doc \$(quiet_build)
>  
> diff --git a/scripts/bash_autocompletion/install_completions.sh b/scripts/bash_autocompletion/install_completions.sh
> new file mode 100755
> index 000000000..5aa739f2e
> --- /dev/null
> +++ b/scripts/bash_autocompletion/install_completions.sh
> @@ -0,0 +1,85 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: MIT
> +# Copyright © 2025 Intel Corporation
> +# Author: Jan Sokolowski <jan.sokolowski@intel.com>
> +
> +usage() {
> +echo "install_completions.sh - creates bash autocompletion scripts for installed igt gpu tools tests."
> +echo "Usage: "
> +echo "--install : installs completions for installed /usr/local/libexec/igt_gpu_tools tests to ~/.local/share/bash-completion/completions" 
> +echo "--local-install : uses ../../build/tests as list of completions to install to ~/.local/share/bash-completion/completions"
> +echo "--uninstall : uninstalls completions installed to /usrl/local/libexec/igt_gpu_tools from ~/.local/share/bash-completion/completions"
> +echo "--local-uninstall : uses ../../build/tests as list of completions to uninstall from ~/.local/share/bash-completion-completions"
> +}
> +
> +__generate_completion() {
> +
> +cat <<EOF > $1
> +_$1()
> +{
> +	local cur prev words cword
> +	_init_completion || return
> +	case \$prev in
> +		--run-subtest | --dynamic-subtest)
> +			local IFS=$'\n\b'
> +			LIST_OF_TESTS="\`\$1 --list-subtest\`"
> +			COMPREPLY=(\$(compgen -W "\$LIST_OF_TESTS" -- "\$cur"))
> +			return
> +			;;
> +		--device)
> +			COMPREPLY=(\$(compgen -o nospace -W "sys: pci: sriov: drm:" -- "\$cur"))
> +			;;
> +	esac
> +
> +	if [[ \$cur == * ]]; then
> +		COMPREPLY=(\$(compgen -W '\$(_parse_help "\$1")' -- "\$cur"))
> +	fi
> +
> +} &&
> +
> +complete -F _$1 $1
> +EOF
> +
> +}
> +
> +__install_completions() {
> +	mkdir -p ~/.local/share/bash-completion/completions
> +	cd ~/.local/share/bash-completion/completions
> +	for ENTRY in `sed -n 2p $1/test-list-full.txt`;
> +	do
> +		TEST=`echo $ENTRY | rev | cut -f1 -d'/' | rev`
> +		__generate_completion $TEST
> +	done
> +	cd - > /dev/null
> +}
> +
> +__uninstall_completions() {
> +	cd ~/.local/share/bash-completion/completions
> +	for ENTRY in `sed -n 2p $1/test-list-full.txt`;
> +	do
> +		TEST=`echo $ENTRY | rev | cut -f1 -d'/' | rev`
> +		rm ~/.local/share/bash-completion/completions/$TEST
> +	done
> +	cd - > /dev/null
> +}
> +
> +case "$1" in
> +	"--install")
> +		__install_completions "/usr/local/libexec/igt-gpu-tools"
> +		;;
> +	"--local-install")
> +		__install_completions "$PWD/build/tests"
> +		;;
> +	"--uninstall")
> +		__uninstall_completions "/usr/local/libexec/igt-gpu-tools"
> +		;;
> +	"--local-uninstall")
> +		__uninstall_completions "$PWD/build/tests"
> +		;;
> +	"--help")
> +		usage
> +		;;
> +	*)
> +		__install_completions "/usr/local/libexec/igt-gpu-tools"
> +		;;
> +esac
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-11 14:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-30 13:11 [PATCH i-g-t v2 0/1] RFC: Bash autocompletion feature for igt Jan Sokolowski
2026-01-30 13:11 ` [PATCH i-g-t v2 1/1] RFC /scripts/bash-autocomplete: Create bash autocompletion scripts for tests Jan Sokolowski
2026-02-05 13:34   ` Zbigniew Kempczyński
2026-02-11 14:07   ` Kamil Konieczny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox