diff mbox

[v2,06/15] tests/exynos: introduce wait_for_user_input

Message ID 1424094405-6314-7-git-send-email-tjakobi@math.uni-bielefeld.de (mailing list archive)
State New, archived
Headers show

Commit Message

Tobias Jakobi Feb. 16, 2015, 1:46 p.m. UTC
Currently getchar() is used to pause execution after each test.
The user isn't informed if one is supposed to do anything for
the tests to continue, so print a simple message to make this
more clear.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
 tests/exynos/exynos_fimg2d_test.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

Comments

Emil Velikov Feb. 23, 2015, 11:22 a.m. UTC | #1
On 16/02/15 13:46, Tobias Jakobi wrote:
> Currently getchar() is used to pause execution after each test.
> The user isn't informed if one is supposed to do anything for
> the tests to continue, so print a simple message to make this
> more clear.
> 
> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> ---
>  tests/exynos/exynos_fimg2d_test.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
> index 55d2970..446a6c6 100644
> --- a/tests/exynos/exynos_fimg2d_test.c
> +++ b/tests/exynos/exynos_fimg2d_test.c
> @@ -237,6 +237,18 @@ void *create_checkerboard_pattern(unsigned int num_tiles_x,
>  	return buf;
>  }
>  
> +static void wait_for_user_input(int last)
> +{
> +	printf("press <ENTER> to ");
> +
> +	if (last)
> +		printf("exit test application\n");
> +	else
> +		printf("skip to next test\n");
> +
If interested you can compact this as

	printf("press <ENTER> to %s\n", last ? "exit test application" :
	                                       "skip to next test");


Cheers
Emil
Daniel Vetter Feb. 23, 2015, 11:28 a.m. UTC | #2
On Mon, Feb 23, 2015 at 11:22:09AM +0000, Emil Velikov wrote:
> On 16/02/15 13:46, Tobias Jakobi wrote:
> > Currently getchar() is used to pause execution after each test.
> > The user isn't informed if one is supposed to do anything for
> > the tests to continue, so print a simple message to make this
> > more clear.
> > 
> > Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> > ---
> >  tests/exynos/exynos_fimg2d_test.c | 20 ++++++++++++++++----
> >  1 file changed, 16 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
> > index 55d2970..446a6c6 100644
> > --- a/tests/exynos/exynos_fimg2d_test.c
> > +++ b/tests/exynos/exynos_fimg2d_test.c
> > @@ -237,6 +237,18 @@ void *create_checkerboard_pattern(unsigned int num_tiles_x,
> >  	return buf;
> >  }
> >  
> > +static void wait_for_user_input(int last)
> > +{
> > +	printf("press <ENTER> to ");
> > +
> > +	if (last)
> > +		printf("exit test application\n");
> > +	else
> > +		printf("skip to next test\n");
> > +
> If interested you can compact this as
> 
> 	printf("press <ENTER> to %s\n", last ? "exit test application" :
> 	                                       "skip to next test");

We have this and a ton of other neat helpers in igt. As I've probably said
countless times on irc and at conferences if someone bothers to make the
core of igt i915-agnostic (just needs changes in the function to open the
drm dev mostly) I'd love to see igt converted into a generic drm
testsuite.

And similar to piglit I think it makes more sense to have that outside of
any userspace components we ship to users, i.e. not in libdrm.

But I really can't justify doing this work to my dear employer ;-)

Cheers, Daniel
diff mbox

Patch

diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index 55d2970..446a6c6 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -237,6 +237,18 @@  void *create_checkerboard_pattern(unsigned int num_tiles_x,
 	return buf;
 }
 
+static void wait_for_user_input(int last)
+{
+	printf("press <ENTER> to ");
+
+	if (last)
+		printf("exit test application\n");
+	else
+		printf("skip to next test\n");
+
+	getchar();
+}
+
 static void exynos_destroy_buffer(struct exynos_bo *bo)
 {
 	exynos_bo_destroy(bo);
@@ -756,7 +768,7 @@  int main(int argc, char **argv)
 		goto err_rm_fb;
 	}
 
-	getchar();
+	wait_for_user_input(0);
 
 	src = exynos_create_buffer(dev, screen_width * screen_height * 4, 0);
 	if (!src) {
@@ -770,7 +782,7 @@  int main(int argc, char **argv)
 		goto err_free_src;
 	}
 
-	getchar();
+	wait_for_user_input(0);
 
 	ret = test_case.copy_with_scale(dev, src, bo, G2D_IMGBUF_GEM);
 	if (ret < 0) {
@@ -778,7 +790,7 @@  int main(int argc, char **argv)
 		goto err_free_src;
 	}
 
-	getchar();
+	wait_for_user_input(0);
 
 	ret = test_case.checkerboard(dev, src, bo, G2D_IMGBUF_GEM);
 	if (ret < 0) {
@@ -786,7 +798,7 @@  int main(int argc, char **argv)
 		goto err_free_src;
 	}
 
-	getchar();
+	wait_for_user_input(1);
 
   /* The blend test uses the userptr functionality of exynos-drm, which     *
    * is currently not safe to use. If the kernel hasn't been build with     *