tests/kms_frontbuffer_tracking: simplify wait_user() calls

I often add new temoprary wait_user() calls when debugging things, and
having to add "if (opt.step)" is annoying, so let's make the step
level check inside wait_user(). As a bonus, our huge macro is 2 lines
shorter.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
This commit is contained in:
Paulo Zanoni 2015-06-23 10:38:19 -03:00
parent 969cb3c575
commit 77e1bac6eb

View File

@ -1206,8 +1206,11 @@ static void teardown_environment(void)
teardown_drm(); teardown_drm();
} }
static void wait_user(const char *msg) static void wait_user(int step, const char *msg)
{ {
if (opt.step < step)
return;
igt_info("%s Press enter...\n", msg); igt_info("%s Press enter...\n", msg);
while (getchar() != '\n') while (getchar() != '\n')
; ;
@ -1298,8 +1301,7 @@ static int adjust_assertion_flags(const struct test_mode *t, int flags)
#define do_assertions(flags) do { \ #define do_assertions(flags) do { \
int flags_ = adjust_assertion_flags(t, (flags)); \ int flags_ = adjust_assertion_flags(t, (flags)); \
\ \
if (opt.step > 1) \ wait_user(2, "Paused before assertions."); \
wait_user("Paused before assertions."); \
\ \
/* Check the CRC to make sure the drawing operations work \ /* Check the CRC to make sure the drawing operations work \
* immediately, independently of the features being enabled. */ \ * immediately, independently of the features being enabled. */ \
@ -1343,8 +1345,7 @@ static int adjust_assertion_flags(const struct test_mode *t, int flags)
igt_assert(!fbc_last_action_changed()); \ igt_assert(!fbc_last_action_changed()); \
} \ } \
\ \
if (opt.step) \ wait_user(1, "Paused after assertions."); \
wait_user("Paused after assertions."); \
} while (0) } while (0)
static void enable_prim_screen_and_wait(const struct test_mode *t) static void enable_prim_screen_and_wait(const struct test_mode *t)