From: Daniel Vetter <daniel@ffwll.ch>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 8/9] lib/igt_aux: Extend igt_debug_wait_for_keypres.
Date: Wed, 10 Dec 2014 11:20:20 +0100 [thread overview]
Message-ID: <20141210102020.GL27182@phenom.ffwll.local> (raw)
In-Reply-To: <1418176917-16598-8-git-send-email-rodrigo.vivi@intel.com>
On Tue, Dec 09, 2014 at 09:01:56PM -0500, Rodrigo Vivi wrote:
> Return key pressed and allow different messages.
>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Hm, not sure how useful this really is - when the test fails I just hit ^C
and scream ;-)
What kind of use-case do you have in mind which requires such a structured
approach? In case of doubt I prefer my igt helpers to be really simple, so
if you think we really needs this we should add a new fancy version of
wait_for_keypress with the added msg and return code.
-Daniel
> ---
> lib/igt_aux.c | 9 ++++++---
> lib/igt_aux.h | 2 +-
> lib/igt_kms.c | 3 ++-
> tests/kms_psr_sink_crc.c | 5 +++--
> 4 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index ff668d4..a6c5ba6 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -386,9 +386,10 @@ void igt_drop_root(void)
> * inspection of the display is useful. Or when running a testcase in the
> * background.
> */
> -void igt_debug_wait_for_keypress(const char *var)
> +char igt_debug_wait_for_keypress(const char *var, const char *msg)
> {
> struct termios oldt, newt;
> + char key;
>
> if (!isatty(STDIN_FILENO))
> return;
> @@ -400,14 +401,16 @@ void igt_debug_wait_for_keypress(const char *var)
> !strstr(igt_interactive_debug, "all"))
> return;
>
> - igt_info("Press any key to continue ...\n");
> + igt_info(msg);
>
> tcgetattr ( STDIN_FILENO, &oldt );
> newt = oldt;
> newt.c_lflag &= ~ICANON;
> tcsetattr ( STDIN_FILENO, TCSANOW, &newt );
> - getchar();
> + key = getchar();
> tcsetattr ( STDIN_FILENO, TCSANOW, &oldt );
> +
> + return key;
> }
>
> #define POWER_DIR "/sys/devices/pci0000:00/0000:00:02.0/power"
> diff --git a/lib/igt_aux.h b/lib/igt_aux.h
> index 59022cd..158e4c5 100644
> --- a/lib/igt_aux.h
> +++ b/lib/igt_aux.h
> @@ -60,7 +60,7 @@ void igt_system_suspend_autoresume(void);
> /* dropping priviledges */
> void igt_drop_root(void);
>
> -void igt_debug_wait_for_keypress(const char *var);
> +char igt_debug_wait_for_keypress(const char *var, const char *msg);
>
> enum igt_runtime_pm_status {
> IGT_RUNTIME_PM_STATUS_ACTIVE,
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 1387d01..5c7b2c7 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1561,7 +1561,8 @@ static int do_display_commit(igt_display_t *display,
>
> LOG_UNINDENT(display);
>
> - igt_debug_wait_for_keypress("modeset");
> + igt_debug_wait_for_keypress("modeset",
> + "Press any key to continue ...\n");
>
> return 0;
> }
> diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
> index e7a2ef4..8103ebb 100644
> --- a/tests/kms_psr_sink_crc.c
> +++ b/tests/kms_psr_sink_crc.c
> @@ -256,7 +256,7 @@ static void get_sink_crc(data_t *data, char *crc) {
> fclose(file);
>
> igt_debug("%s\n", crc);
> - igt_debug_wait_for_keypress("crc");
> + igt_debug_wait_for_keypress("crc", "Press any key to continue ...\n");
>
> /* The important value was already taken.
> * Now give a time for human eyes
> @@ -305,7 +305,8 @@ static void assert_or_manual(bool condition, const char *expected)
> igt_info("Is %s?\n", expected);
> else
> igt_debug("%s\n", expected);
> - igt_debug_wait_for_keypress("manual");
> + igt_debug_wait_for_keypress("manual",
> + "Press any key to continue ...\n");
> igt_assert(igt_interactive_debug || condition);
> }
>
> --
> 1.9.3
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-12-10 10:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 2:01 [PATCH i-g-t 1/9] tests/kms_psr_sink_crc: Make blt visible to human eyes Rodrigo Vivi
2014-12-10 2:01 ` [PATCH i-g-t 2/9] tests/kms_psr_sink_crc: Make render " Rodrigo Vivi
2014-12-10 2:01 ` [PATCH i-g-t 3/9] tests/kms_psr_sink_crc: Make mmaps " Rodrigo Vivi
2014-12-10 2:01 ` [PATCH i-g-t 4/9] tests/kms_psr_sink_crc: Make plane_move " Rodrigo Vivi
2014-12-10 2:01 ` [PATCH i-g-t 5/9] lib/igt_aux: Don't remove echo from terminal Rodrigo Vivi
2014-12-10 2:01 ` [PATCH i-g-t 6/9] lib: s/IGT_DEBUG_INTERACTIVE/--interactive-debug=var Rodrigo Vivi
2014-12-10 10:17 ` Daniel Vetter
2014-12-10 2:01 ` [PATCH i-g-t 7/9] tests/kms_psr_sink_crc: Add manual mode Rodrigo Vivi
2014-12-10 2:01 ` [PATCH i-g-t 8/9] lib/igt_aux: Extend igt_debug_wait_for_keypres Rodrigo Vivi
2014-12-10 10:20 ` Daniel Vetter [this message]
2014-12-10 2:01 ` [PATCH i-g-t 9/9] tests/kms_psr_sink_crc: Use pressed key to pass/fail Rodrigo Vivi
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=20141210102020.GL27182@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=rodrigo.vivi@intel.com \
/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