[xts] Add 'q' command line option to count subtests

Submitted by Adam Jackson on April 25, 2018, 7:58 p.m.

Details

Message ID 20180425195807.19145-1-ajax@redhat.com
State New
Series "Add 'q' command line option to count subtests"
Headers show

Commit Message

Adam Jackson April 25, 2018, 7:58 p.m.
At the moment piglit needs a copy of the test _source_ around, because
it parses the .m files looking for >>ASSERTION to know how many subtests
each executable contains. With this patch we can instead do:

datura:~/git/xts% xts5/Xlib4/*/XChangeWindowAttributes q
46

Sorry for the ad-hoc extern, but there's not a header for that
declaration already. The code seems to also have a memory of a "reduced
space" build where all the tests are linked into one giant binary; we
don't support building that anyway, but this change would assuredly
break it too.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 src/tet3/tcm/dtcm.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/tet3/tcm/dtcm.c b/src/tet3/tcm/dtcm.c
index 3d56e8d8..afb8c4eb 100644
--- a/src/tet3/tcm/dtcm.c
+++ b/src/tet3/tcm/dtcm.c
@@ -295,6 +295,12 @@  char	**argv;
 	if (!tcname)
 		tcname = tet_pname;
 
+        if (argc > 1 && !strcmp(argv[1], "q")) {
+            extern int ntests;
+            printf("%d\n", ntests);
+            exit(0);
+        }
+
 #ifdef TET_LITE
 	/* open execution results file (do early, so tet_error() can use it) */
 	tet_openres(argv[0]);

Comments

Peter Hutterer April 26, 2018, 11:28 p.m.
On Wed, Apr 25, 2018 at 03:58:07PM -0400, Adam Jackson wrote:
> At the moment piglit needs a copy of the test _source_ around, because
> it parses the .m files looking for >>ASSERTION to know how many subtests
> each executable contains. With this patch we can instead do:
> 
> datura:~/git/xts% xts5/Xlib4/*/XChangeWindowAttributes q
> 46
> 
> Sorry for the ad-hoc extern, but there's not a header for that
> declaration already. The code seems to also have a memory of a "reduced
> space" build where all the tests are linked into one giant binary; we
> don't support building that anyway, but this change would assuredly
> break it too.
> 
> Signed-off-by: Adam Jackson <ajax@redhat.com>

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
but: any specific reason you don't just name it --count? it's just a strcmp
and would make things clearer

Cheers,
   Peter

> ---
>  src/tet3/tcm/dtcm.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/tet3/tcm/dtcm.c b/src/tet3/tcm/dtcm.c
> index 3d56e8d8..afb8c4eb 100644
> --- a/src/tet3/tcm/dtcm.c
> +++ b/src/tet3/tcm/dtcm.c
> @@ -295,6 +295,12 @@ char	**argv;
>  	if (!tcname)
>  		tcname = tet_pname;
>  
> +        if (argc > 1 && !strcmp(argv[1], "q")) {
> +            extern int ntests;
> +            printf("%d\n", ntests);
> +            exit(0);
> +        }
> +
>  #ifdef TET_LITE
>  	/* open execution results file (do early, so tet_error() can use it) */
>  	tet_openres(argv[0]);
> -- 
> 2.17.0
> 
> _______________________________________________
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
>