From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 15C48FCE07F for ; Thu, 26 Feb 2026 13:34:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B552810E92E; Thu, 26 Feb 2026 13:34:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="DxEtpfsB"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 910C310E92E for ; Thu, 26 Feb 2026 13:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772112887; x=1803648887; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rRfTnYA8cAGY+IWIA/SS/9zpJGSPgrb3T+BLYjcdi08=; b=DxEtpfsBTTKpJKSYkBh7odA3wVF6vsw5CeRDO0g2AWJc56W571Quaayx lYxsDxyBlC5FrCv6wKsemgV4diNAgrqFnmoNu7u1oVsoMexrGSWzJ8GsN 1iszf++uvESAMptGHJbZ+5FPn8jrjpzgdd4tXXloiXxw6lOdEj9eojTGJ ewDa688jmtwSY0R+V6rLPVmieSYbGGtTOhn2AS1tUrOpuHwjhy1OCtxpq mmCL59VCpBfnqRQGEeuSsgdWODD6wJJhHsOoBx7Axya3cJ+ER9VIim2V2 rC3ANchID31X+JacUxcUcycoahA0vk+cI5OWmL5+v/ydyM0P5gVDfIjs3 w==; X-CSE-ConnectionGUID: g/Y0zzO0TaKZKsZ51lWS7Q== X-CSE-MsgGUID: UFslvywiSH+UK+lAOHvFLg== X-IronPort-AV: E=McAfee;i="6800,10657,11713"; a="95789624" X-IronPort-AV: E=Sophos;i="6.21,312,1763452800"; d="scan'208";a="95789624" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2026 05:34:41 -0800 X-CSE-ConnectionGUID: C8jukgMZRSmXAwvjqAUIrA== X-CSE-MsgGUID: REX2THHLT1GEZ7wIH8oAZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,312,1763452800"; d="scan'208";a="247096224" Received: from jsokolow-alderlakeclientplatform.igk.intel.com ([172.28.176.71]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2026 05:34:38 -0800 From: Jan Sokolowski To: igt-dev@lists.freedesktop.org Cc: Jan Sokolowski , =?UTF-8?q?Zbigniew=20Kempczy=C5=84ski?= , Kamil Konieczny , Katarzyna Piecielska , Juha-Pekka Heikkila , Ashutosh Dixit Subject: [PATCH i-g-t 1/1] scripts/bash-autocomplete: Create autocompletion for tests Date: Thu, 26 Feb 2026 14:39:16 +0100 Message-ID: <20260226133916.33621-2-jan.sokolowski@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260226133916.33621-1-jan.sokolowski@intel.com> References: <20260226133916.33621-1-jan.sokolowski@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" 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, for example Ubuntu root does not source bash_completion because it is commented out. Signed-off-by: Jan Sokolowski Cc: Zbigniew Kempczyński Cc: Kamil Konieczny Cc: Katarzyna Piecielska Cc: Juha-Pekka Heikkila Cc: Ashutosh Dixit --- meson.sh | 6 ++ .../install_completions.sh | 88 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100755 scripts/bash_autocompletion/install_completions.sh diff --git a/meson.sh b/meson.sh index 1563a85b1..e5fbdcc0c 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: all + ./scripts/bash_autocompletion/install_completions.sh --local-install + +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..d3db63af0 --- /dev/null +++ b/scripts/bash_autocompletion/install_completions.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Copyright © 2025 Intel Corporation +# Author: Jan Sokolowski + +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 < $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 + + echo "Installing bash autocompletion scripts to ~/.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 + echo "Unnstalling bash autocompletion scripts from ~/.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