From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 3/5] lib/igt_core: add an option to show the testlist
Date: Thu, 6 Jul 2023 13:13:26 +0200 [thread overview]
Message-ID: <20230706111328.508790-4-mauro.chehab@linux.intel.com> (raw)
In-Reply-To: <20230706111328.508790-1-mauro.chehab@linux.intel.com>
From: Mauro Carvalho Chehab <mchehab@kernel.org>
There are several cases where we need to list the tests the same
way as igt_runner displays them.
That should not return errors on failures and should work also
when igt_simple_main() macro is used.
Ideally, it should also show dynamic subtests, but this is more
complex, specially for Kselftest/KUnit ones. So, for now, let's
not handle dynamic ones.
Add an option to produce such testlist.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
lib/igt_core.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 9a0029d294a8..2ae2cb68835e 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -274,6 +274,7 @@ const char *igt_interactive_debug;
bool igt_skip_crc_compare;
/* subtests helpers */
+static bool show_testlist = false;
static bool list_subtests = false;
static bool describe_subtests = false;
static char *run_single_subtest = NULL;
@@ -326,6 +327,7 @@ enum {
* conflict with core ones
*/
OPT_LIST_SUBTESTS = 500,
+ OPT_SHOW_TESTLIST,
OPT_DESCRIBE_SUBTESTS,
OPT_RUN_SUBTEST,
OPT_RUN_DYNAMIC_SUBTEST,
@@ -896,6 +898,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
fprintf(f, "Usage: %s [OPTIONS]\n", command_str);
fprintf(f, " --list-subtests\n"
+ " --show-testlist\n"
" --run-subtest <pattern>\n"
" --dynamic-subtest <pattern>\n"
" --debug[=log-domain]\n"
@@ -1076,6 +1079,7 @@ static int common_init(int *argc, char **argv,
int c, option_index = 0, i, x;
static struct option long_options[] = {
{"list-subtests", no_argument, NULL, OPT_LIST_SUBTESTS},
+ {"show-testlist", no_argument, NULL, OPT_SHOW_TESTLIST},
{"describe", optional_argument, NULL, OPT_DESCRIBE_SUBTESTS},
{"run-subtest", required_argument, NULL, OPT_RUN_SUBTEST},
{"dynamic-subtest", required_argument, NULL, OPT_RUN_DYNAMIC_SUBTEST},
@@ -1189,6 +1193,9 @@ static int common_init(int *argc, char **argv,
if (!run_single_subtest)
list_subtests = true;
break;
+ case OPT_SHOW_TESTLIST:
+ show_testlist = true;
+ break;
case OPT_DESCRIBE_SUBTESTS:
if (optarg)
run_single_subtest = strdup(optarg);
@@ -1257,6 +1264,10 @@ out:
igt_warn("Unknown subtest: %s\n", run_single_subtest);
exit(IGT_EXIT_INVALID);
}
+ if (show_testlist) {
+ printf("igt@%s\n", igt_test_name());
+ exit(0);
+ }
if (list_subtests)
exit(IGT_EXIT_INVALID);
}
@@ -1449,6 +1460,9 @@ bool __igt_run_subtest(const char *subtest_name, const char *file, const int lin
__igt_print_description(subtest_name, file, line);
_clear_current_description();
return false;
+ } else if (show_testlist) {
+ printf("igt@%s@%s\n", igt_test_name(), subtest_name);
+ return false;
} else if (list_subtests) {
printf("%s\n", subtest_name);
return false;
@@ -1522,7 +1536,7 @@ const char *igt_subtest_name(void)
*/
bool igt_only_list_subtests(void)
{
- return list_subtests;
+ return list_subtests || show_testlist;
}
--
2.40.1
next prev parent reply other threads:[~2023-07-06 11:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 11:13 [igt-dev] [PATCH i-g-t v2 0/5] Speedup IGT build time Mauro Carvalho Chehab
2023-07-06 11:13 ` [igt-dev] [PATCH i-g-t v2 1/5] tests/meson.build: Simplify builds for core and i915 targets Mauro Carvalho Chehab
2023-07-06 11:13 ` [igt-dev] [PATCH i-g-t v2 2/5] lib/igt_core: use the macro when checking for list_subtests Mauro Carvalho Chehab
2023-07-06 11:13 ` Mauro Carvalho Chehab [this message]
2023-07-06 11:13 ` [igt-dev] [PATCH i-g-t v2 4/5] tests/meson.build: create testlists for tests Mauro Carvalho Chehab
2023-07-06 11:13 ` [igt-dev] [PATCH i-g-t v2 5/5] scripts/test_list.py: speedup testlist check logic Mauro Carvalho Chehab
2023-07-06 13:36 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Speedup IGT build time (rev2) Patchwork
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=20230706111328.508790-4-mauro.chehab@linux.intel.com \
--to=mauro.chehab@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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