intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Derek Morton <derek.j.morton@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t] lib/igt_core.c: Expand --run-subtest functionality.
Date: Wed, 27 Jan 2016 14:32:47 +0200	[thread overview]
Message-ID: <20160127123247.GA23290@intel.com> (raw)
In-Reply-To: <1453889156-24489-1-git-send-email-derek.j.morton@intel.com>

On Wed, Jan 27, 2016 at 10:05:56AM +0000, Derek Morton wrote:
> Added support for specifying arbitary lists of subtests to run or
> to exclude from being run by using : or ^ as a seperator.
> 
> :subtest1:subtest2: Will run subtest1 and subtest2
> ^subtest1^subtest2^ will run all subtests except subtest1 and subtest2

Hmm. Getting a bit complicated perhaps. Would it be simpler to just
allow specifying the --r option multiple times? So we'd start with the
full list of subtests, and each --r option would filter the list in
some way?

> 
> Any subtest string not starting : or ^ is treated as a normal wildcard
> expression.
> 
> This is required mainly on android to exclude subtests that test
> features that do not exist in the android driver while still being able
> to run other subtests in the binary when a wildcard expression is
> insufficient.
> 
> Signed-off-by: Derek Morton <derek.j.morton@intel.com>
> ---
>  lib/igt_core.c | 42 ++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 40 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 6b69bb7..b9e7470 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -207,7 +207,15 @@
>   * To do that obtain the lists of subtests with "--list-subtests", which can be
>   * run as non-root and doesn't require the i915 driver to be loaded (or any
>   * intel gpu to be present). Then individual subtests can be run with
> - * "--run-subtest". Usage help for tests with subtests can be obtained with the
> + * "--run-subtest". --run-subtest accepts wildcard characters. A list of
> + * subtests to run may be specified by using : as a seperator. A list of
> + * subtests to exclude may be specified using ^ as a seperator.
> + *
> + * - --run-subtest basic* will run all subtests starting basic.
> + * - --run-subtest :subtest1:subtest2: will run only subtest1 and subtest2
> + * - --run-subtest ^subtest1^subtest2^ will run all except subtest1 and subtest2
> + *
> + * Usage help for tests with subtests can be obtained with the
>   * "--help" command line option.
>   */
>  
> @@ -786,6 +794,35 @@ void igt_simple_init_parse_opts(int *argc, char **argv,
>  		    extra_opt_handler, handler_data);
>  }
>  
> +static bool check_testlist(const char *subtest_name)
> +{
> +	char *p;
> +
> +	/* Run subtests in list
> +	 * Look for subtest_name in list of form :subtest1:subtest2:subtest3:
> +	 * return true if found.
> +	 */
> +	if (run_single_subtest[0] == ':') {
> +		p = strstr(run_single_subtest, subtest_name);
> +		if ((p) && (*(p-1) == ':') && (*(p+strlen(subtest_name)) == ':' ))
> +			return true;
> +	}
> +	/* Run subtests not in list
> +	 * Look for subtest_name in list of form ^test1^subtest2^subtest3^
> +	 * return true if not found.
> +	 */
> +	else if (run_single_subtest[0] == '^') {
> +		p = strstr(run_single_subtest, subtest_name);
> +		if (!((p) && (*(p-1) == '^') && (*(p+strlen(subtest_name)) == '^' )))
> +			return true;
> +	}
> +	/* Run subtests that match shell wildcard */
> +	else if (fnmatch(run_single_subtest, subtest_name, 0) == 0)
> +		return true;
> +
> +	return false;
> +}
> +
>  /*
>   * Note: Testcases which use these helpers MUST NOT output anything to stdout
>   * outside of places protected by igt_run_subtest checks - the piglit
> @@ -814,7 +851,8 @@ bool __igt_run_subtest(const char *subtest_name)
>  	}
>  
>  	if (run_single_subtest) {
> -		if (fnmatch(run_single_subtest, subtest_name, 0) != 0)
> +
> +		if (check_testlist(subtest_name) == false)
>  			return false;
>  		else
>  			run_single_subtest_found = true;
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-01-27 12:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27 10:05 [PATCH i-g-t] lib/igt_core.c: Expand --run-subtest functionality Derek Morton
2016-01-27 12:32 ` Ville Syrjälä [this message]
2016-01-27 13:30   ` Morton, Derek J
2016-01-27 14:30     ` Ville Syrjälä
2016-01-27 15:02       ` Morton, Derek J
2016-01-27 15:36         ` Ville Syrjälä
2016-01-28  8:35           ` Dave Gordon
2016-01-28 10:47             ` Morton, Derek J
2016-01-27 13:39   ` Daniel Vetter
2016-01-27 14:01     ` Morton, Derek J
2016-01-27 15:42       ` Daniel Vetter
2016-01-27 16:45         ` Morton, Derek J
2016-01-27 17:58           ` Daniel Vetter
2016-02-04 11:41 ` David Weinehall

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=20160127123247.GA23290@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=derek.j.morton@intel.com \
    --cc=intel-gfx@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;
as well as URLs for NNTP newsgroup(s).