All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH 1/4] lib/igt_core: reserve long options for individual tests
@ 2019-06-05 17:44 Lucas De Marchi
  2019-06-05 17:44 ` [igt-dev] [PATCH 2/4] lib/igt_core: 0 is a valid val for long options Lucas De Marchi
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Lucas De Marchi @ 2019-06-05 17:44 UTC (permalink / raw)
  To: igt-dev; +Cc: Lucas De Marchi, Petri Latvala

Start the core options from 500 so the individual tests can have their
own options starting from 0. This makes it easier to set the long
options without conflicting.

500 is just a magic number, higher than any ascii char that could be
used in the individual test.

While at it, fix the coding style to use tab rather than space.

v2: also fix the test for conflicting args

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 lib/igt_core.c                   | 16 ++++++++++------
 lib/tests/igt_conflicting_args.c |  2 +-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 9c86d664..814f5c72 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -280,12 +280,16 @@ int test_children_sz;
 bool test_child;
 
 enum {
- OPT_LIST_SUBTESTS,
- OPT_RUN_SUBTEST,
- OPT_DESCRIPTION,
- OPT_DEBUG,
- OPT_INTERACTIVE_DEBUG,
- OPT_HELP = 'h'
+	/*
+	 * Let the first values be used by individual tests so options don't
+	 * conflict with core ones
+	 */
+	OPT_LIST_SUBTESTS = 500,
+	OPT_RUN_SUBTEST,
+	OPT_DESCRIPTION,
+	OPT_DEBUG,
+	OPT_INTERACTIVE_DEBUG,
+	OPT_HELP = 'h'
 };
 
 static int igt_exitcode = IGT_EXIT_SUCCESS;
diff --git a/lib/tests/igt_conflicting_args.c b/lib/tests/igt_conflicting_args.c
index c357b6c5..f600abd4 100644
--- a/lib/tests/igt_conflicting_args.c
+++ b/lib/tests/igt_conflicting_args.c
@@ -91,7 +91,7 @@ int main(int argc, char **argv)
 	internal_assert_wsignaled(do_fork(), SIGABRT);
 
 	/* conflict on long option 'val' representations */
-	long_options[0] = (struct option) { "iterations", required_argument, NULL, 0};
+	long_options[0] = (struct option) { "iterations", required_argument, NULL, 500};
 	short_options = "";
 	internal_assert_wsignaled(do_fork(), SIGABRT);
 
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2019-06-07 11:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-05 17:44 [igt-dev] [PATCH 1/4] lib/igt_core: reserve long options for individual tests Lucas De Marchi
2019-06-05 17:44 ` [igt-dev] [PATCH 2/4] lib/igt_core: 0 is a valid val for long options Lucas De Marchi
2019-06-05 17:44 ` [igt-dev] [PATCH 3/4] testdisplay: use first available option values Lucas De Marchi
2019-06-05 17:44 ` [igt-dev] [PATCH 4/4] lib/igt_core: add -h to usage Lucas De Marchi
2019-06-05 18:24 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/4] lib/igt_core: reserve long options for individual tests Patchwork
2019-06-06  9:20 ` [igt-dev] [PATCH 1/4] " Petri Latvala
2019-06-06 16:50   ` Lucas De Marchi
2019-06-07 11:53 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [1/4] " Patchwork

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.