Message ID | 1414508636-13543-1-git-send-email-thomas.wood@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Oct 28, 2014 at 03:03:53PM +0000, Thomas Wood wrote: > +extern const char* __igt_test_description __attribute__((weak)); > +#define IGT_TEST_DESCRIPTION(a) const char* __igt_test_description = a; It's usual to omit the ';' here to have the macro invokation always finish with a ';' (your next patch mixes both).
On Tue, Oct 28, 2014 at 03:10:25PM +0000, Damien Lespiau wrote: > On Tue, Oct 28, 2014 at 03:03:53PM +0000, Thomas Wood wrote: > > +extern const char* __igt_test_description __attribute__((weak)); > > +#define IGT_TEST_DESCRIPTION(a) const char* __igt_test_description = a; > > It's usual to omit the ';' here to have the macro invokation always > finish with a ';' (your next patch mixes both). Since you need to go through them all anyway small style bikeshed, but I think the multi-line arguments to macros look funny. What about #define IGT_TEST_DESCPIPTION const char * __igt_test_description and use them like IGT_TEST_DESCRIPTION = "blbl" "blbl"; Imo slightly easier on the eyes ;-) Otherwise this looks like a good start. So either way pls push after addressing Damien's feedback. -Daniel
On 3 November 2014 12:26, Daniel Vetter <daniel@ffwll.ch> wrote: > On Tue, Oct 28, 2014 at 03:10:25PM +0000, Damien Lespiau wrote: >> On Tue, Oct 28, 2014 at 03:03:53PM +0000, Thomas Wood wrote: >> > +extern const char* __igt_test_description __attribute__((weak)); >> > +#define IGT_TEST_DESCRIPTION(a) const char* __igt_test_description = a; >> >> It's usual to omit the ';' here to have the macro invokation always >> finish with a ';' (your next patch mixes both). > > Since you need to go through them all anyway small style bikeshed, but I > think the multi-line arguments to macros look funny. What about > > #define IGT_TEST_DESCPIPTION const char * __igt_test_description > > and use them like > > IGT_TEST_DESCRIPTION = > "blbl" > "blbl"; The macro was originally going to include some extra parameters with more details. It may still be useful to add them at some point (perhaps a shorter summary line or some basic requirements). > > Imo slightly easier on the eyes ;-) > > Otherwise this looks like a good start. So either way pls push after > addressing Damien's feedback. The v2 of this series includes Damien's feedback, as well as some other fixes. > -Daniel > -- > Daniel Vetter > Software Engineer, Intel Corporation > +41 (0) 79 365 57 48 - http://blog.ffwll.ch
diff --git a/lib/igt_core.c b/lib/igt_core.c index e3d5fb0..3861121 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -223,6 +223,7 @@ bool test_child; enum { OPT_LIST_SUBTESTS, OPT_RUN_SUBTEST, + OPT_DESCRIPTION, OPT_DEBUG, OPT_HELP = 'h' }; @@ -360,6 +361,12 @@ static void common_exit_handler(int sig) assert(sig != 0 || igt_exit_called); } +static void print_test_description(void) +{ + if (&__igt_test_description) + printf("%s\n", __igt_test_description); +} + static void print_version(void) { struct utsname uts; @@ -380,11 +387,12 @@ static void print_usage(const char *help_str, bool output_on_stderr) { FILE *f = output_on_stderr ? stderr : stdout; - fprintf(f, "Usage: %s [OPTIONS]\n" - " --list-subtests\n" + fprintf(f, "Usage: %s [OPTIONS]\n", command_str); + fprintf(f, " --list-subtests\n" " --run-subtest <pattern>\n" " --debug\n" - " --help\n", command_str); + " --help-description\n" + " --help\n"); if (help_str) fprintf(f, "%s\n", help_str); } @@ -413,6 +421,7 @@ static int common_init(int argc, char **argv, static struct option long_options[] = { {"list-subtests", 0, 0, OPT_LIST_SUBTESTS}, {"run-subtest", 1, 0, OPT_RUN_SUBTEST}, + {"help-description", 0, 0, OPT_DESCRIPTION}, {"debug", 0, 0, OPT_DEBUG}, {"help", 0, 0, OPT_HELP}, {0, 0, 0, 0} @@ -510,6 +519,10 @@ static int common_init(int argc, char **argv, if (!list_subtests) run_single_subtest = strdup(optarg); break; + case OPT_DESCRIPTION: + print_test_description(); + ret = -1; + goto out; case OPT_HELP: print_usage(help_str, false); ret = -1; diff --git a/lib/igt_core.h b/lib/igt_core.h index b8f6702..98b8951 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -38,6 +38,9 @@ #include <stdarg.h> #include <getopt.h> +extern const char* __igt_test_description __attribute__((weak)); +#define IGT_TEST_DESCRIPTION(a) const char* __igt_test_description = a; + /** * IGT_EXIT_TIMEOUT: *
Signed-off-by: Thomas Wood <thomas.wood@intel.com> --- lib/igt_core.c | 19 ++++++++++++++++--- lib/igt_core.h | 3 +++ 2 files changed, 19 insertions(+), 3 deletions(-)