From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Yunlong Song <yunlong.song@huawei.com>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Wang Nan <wangnan0@huawei.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 26/31] perf tools: Add the bash completion for listing subsubcommands of perf test
Date: Thu, 19 Mar 2015 14:05:02 -0300 [thread overview]
Message-ID: <1426784707-19466-27-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1426784707-19466-1-git-send-email-acme@kernel.org>
From: Yunlong Song <yunlong.song@huawei.com>
The bash completion does not support listing subsubcommands for 'perf
test <TAB>', so fix it.
Example:
Before this patch:
$ perf test <TAB>
$
As shown above, the subsubcommands of perf test does not come out.
After this patch:
$ perf test <TAB>
list
As shown above, the subsubcommands of perf test can come out now.
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-11-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/perf-completion.sh | 2 +-
tools/perf/tests/builtin-test.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 8739a1345017..35f43fd7a38b 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -143,7 +143,7 @@ __perf_main ()
__perfcomp_colon "$evts" "$cur"
else
# List subcommands for perf commands
- if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data|help|script) ]]; then
+ if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data|help|script|test) ]]; then
subcmds=$($cmd $prev_skip_opts --list-cmds)
__perfcomp_colon "$subcmds" "$cur"
fi
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 4b7d9ab0f049..ed8e05c6839a 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -291,7 +291,7 @@ static int perf_test__list(int argc, const char **argv)
int cmd_test(int argc, const char **argv, const char *prefix __maybe_unused)
{
- const char * const test_usage[] = {
+ const char *test_usage[] = {
"perf test [<options>] [{list <test-name-fragment>|[<test-name-fragments>|<test-numbers>]}]",
NULL,
};
@@ -302,13 +302,14 @@ int cmd_test(int argc, const char **argv, const char *prefix __maybe_unused)
"be more verbose (show symbol address, etc)"),
OPT_END()
};
+ const char * const test_subcommands[] = { "list", NULL };
struct intlist *skiplist = NULL;
int ret = hists__init();
if (ret < 0)
return ret;
- argc = parse_options(argc, argv, test_options, test_usage, 0);
+ argc = parse_options_subcommand(argc, argv, test_options, test_subcommands, test_usage, 0);
if (argc >= 1 && !strcmp(argv[0], "list"))
return perf_test__list(argc, argv);
--
1.9.3
next prev parent reply other threads:[~2015-03-19 17:08 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 01/31] perf hists browser: Simplify symbol annotation menu setup Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 02/31] perf hists browser: Fix up some branch alignment Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 03/31] perf hists: Remove hist_entry->used, not used anymore Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 04/31] perf hists browser: Allow annotating entries in callchains Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 05/31] perf tools: Fix building error for arm64 Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 06/31] perf build: Disable default check for libbabeltrace Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 07/31] perf build: Move features build output under features directory Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 08/31] perf build: Fix pthread-attr-setaffinity-np include in test-all Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 09/31] perf build: Get rid of LIB_INCLUDE variable Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 10/31] perf build: Rename CORE_FEATURE_TESTS to FEATURE_TESTS Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 11/31] perf build: Get rid of VF_FEATURE_TESTS Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 12/31] perf build: Rename display_lib into feature_display Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 13/31] perf build: Rename display_vf to feature_verbose Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 14/31] perf build: Rename PERF-FEATURES into FEATURE-DUMP Arnaldo Carvalho de Melo
2015-03-22 10:19 ` Ingo Molnar
2015-03-23 10:57 ` Jiri Olsa
2015-03-23 14:13 ` Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 15/31] perf build: Rename feature_print_var_code to print_var_code Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 17/31] perf tools: Fix the bash completion for listing options of perf subcommand Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 18/31] perf tools: Fix the bash completion for listing subsubcommands " Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 19/31] perf tools: Provide the right bash completion for listing options of perf subcommand subsubcommand Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 20/31] perf tools: Fix the bash completion for listing events of perf subcommand record|stat|top -e Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 21/31] perf tools: Fix the bash completion to support listing events for --event Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 22/31] perf tools: Fix the bash completion for listing subcommands of perf Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 23/31] perf tools: Add the bash completion for listing subsubcommands of perf data Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 24/31] perf tools: Add the bash completion for listing subsubcommands of perf help Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 25/31] perf tools: Add the bash completion for listing subsubcommands of perf script Arnaldo Carvalho de Melo
2015-03-19 17:05 ` Arnaldo Carvalho de Melo [this message]
2015-03-19 17:05 ` [PATCH 27/31] perf tools: Add the bash completion for listing subsubcommands of perf timechart Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 28/31] perf tools: Add the bash completion for listing subsubcommands of perf trace Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 29/31] perf tools: Avoid confusion with preloaded bash function for perf bash completion Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 30/31] perf callchain: Separate eh/debug frame offset cache Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 31/31] perf report: Don't allow empty argument for '-t' Arnaldo Carvalho de Melo
2015-03-22 9:55 ` [GIT PULL 00/31] perf/core improvements and fixes Ingo Molnar
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=1426784707-19466-27-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulus@samba.org \
--cc=wangnan0@huawei.com \
--cc=yunlong.song@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).